mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 07:23:24 +09:00
- ROADMAP P0.5 asks for a CI assertion on the include closure of the two headers the phase extracts, and ROADMAP.md:7 asks every gate to be able to fail for the reason it exists. `nm --undefined-only` cannot express either: a header that is included but whose types are never named leaves no symbol behind, and "included at all" is exactly the coupling P1 and P7 have to sever. The preprocessor's own `-H` transcript can. - Three probes, coded against the fixed path contract of the P0.5 brief so this package lands before the headers do: value-header (MG_Pipe/MGPipeValueTypes.h: no MG_State/, MG_Impl/, MG_Backend/, MG_Remote/), artifacts-header (ProgramArtifacts.h: no ShaderObject.h, ShaderTranspiler/, Config.h, MG_Backend/, BufferState/, ProgramState/ Shader*, plus a budget of two `glslang::` tokens for the two members D5 keeps verbatim) and wire-header (ITransport.h must not reach Includes.h - green today, so the gate has a live probe from its first commit). - The forbidden sets say nothing about glslang, spirv-cross or vulkan on purpose: Includes.h pulls all three unconditionally and both new headers are allowed <Includes.h>, so a textually glslang-free closure is unsatisfiable by construction. P7 measures that with `nm -D | grep glslang` on the server binary instead. - Two modes because they check different things. Text mode walks literal #include lines, needs no compiler and no submodules, and is what the ctest runs (the CI `test` job's runner has neither); clang mode is the arbiter, and adds a -fsyntax-only pass proving the header is self-contained. `--mode both` additionally fails on a disagreement between the two violation sets, so text mode's blindness to `#if` cannot hide a hit. - -H parsing normalises before matching (today's transcripts contain TextureState/../SamplerState/SamplerObject.h) and accepts only `^\.+ ` lines, which discards the "Multiple include guards may be useful for:" paragraph g++ appends. Both are pinned by a canned-transcript check inside --self-test. - D9 skip semantics: a probe whose header does not exist prints SKIP and is counted, and --require-all turns every SKIP into a failure. That is what lets the gate land first and still stops an all-SKIP run from passing for free once the headers exist; the integrator flips --require-all on after all three P0.5 packages land. - --self-test is always on in both the ctest and the CI job: it synthesizes its TUs in a tempdir (it never touches a tracked file) and requires a negative control that does not depend on P0.5 at all - MGPipeHandles.h plus RenderState.h checked against the value-header list - to report RenderState.h as a depth-1 violation in every enabled mode. Zero trips anywhere is an ::error:: and exit 1, because a gate that cannot go red is not a gate. Controls 2 and 3 arm themselves as the two headers appear. - Registered as MobileGLPurity.IncludeClosure with LABELS unit so `ctest -L unit` runs it, and with no ENVIRONMENT property, which would replace the job env wholesale.
108 lines
3.3 KiB
CMake
108 lines
3.3 KiB
CMake
cmake_minimum_required(VERSION 3.24)
|
|
project(MobileGLTest)
|
|
|
|
message(STATUS "Generating build files for MobileGL Test...")
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(MGL_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
|
|
|
|
# # Add the directory containing our custom Find modules
|
|
# list(APPEND CMAKE_MODULE_PATH "${MGL_ROOT}/buildsystem/cmake")
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
googletest
|
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
GIT_TAG v1.17.0
|
|
)
|
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
enable_testing()
|
|
|
|
# # Find the required libraries using our custom Find modules
|
|
# find_package(glslang REQUIRED)
|
|
# find_package(SPIRVCross REQUIRED)
|
|
# find_package(SPIRVTools)
|
|
|
|
add_executable(
|
|
SanityTest
|
|
SanityTest.cpp
|
|
)
|
|
target_link_libraries(
|
|
SanityTest
|
|
GTest::gtest_main
|
|
MobileGL_s
|
|
)
|
|
|
|
target_include_directories(SanityTest PRIVATE
|
|
${MGL_ROOT}/include
|
|
${MGL_ROOT}/MobileGL
|
|
)
|
|
|
|
# message(STATUS "glslang_LIBRARIES: ${glslang_LIBRARIES}")
|
|
# message(STATUS "SPIRVTools_LIBRARIES: ${SPIRVTools_LIBRARIES}")
|
|
# message(STATUS "SPIRVCross_LIBRARIES: ${SPIRVCross_LIBRARIES}")
|
|
|
|
# # Set the libraries to link against
|
|
# set(LINK_LIBRARIES
|
|
# ${glslang_LIBRARIES}
|
|
# ${SPIRVCross_LIBRARIES}
|
|
# )
|
|
|
|
# if (SPIRVTools_FOUND)
|
|
# list(APPEND LINK_LIBRARIES ${SPIRVTools_LIBRARIES})
|
|
# endif()
|
|
|
|
set(LINK_LIBRARIES
|
|
MobileGL_s
|
|
)
|
|
|
|
include(GoogleTest)
|
|
gtest_discover_tests(SanityTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit)
|
|
|
|
if (MSVC)
|
|
# The GL headers declare gl* as dllimport on Windows, so any test that pulls
|
|
# GetProcAddress.cpp out of the static library references __imp_gl*, which only
|
|
# resolves when the in-library entry-point definitions are part of the link.
|
|
# Applies to every test executable below, the way the DirectVulkan and
|
|
# integration test targets already do it for themselves.
|
|
add_link_options(/WHOLEARCHIVE:MobileGL_s)
|
|
endif()
|
|
|
|
add_subdirectory(BackendLoader)
|
|
add_subdirectory(Buffer)
|
|
# The heap-address-is-not-an-identity invariant the backends' per-object memos
|
|
# rest on. No GL context, no driver: it only needs the allocator.
|
|
add_subdirectory(State)
|
|
add_subdirectory(EGLState)
|
|
add_subdirectory(Framebuffer)
|
|
add_subdirectory(Texture)
|
|
add_subdirectory(VertexArray)
|
|
add_subdirectory(Program)
|
|
add_subdirectory(Query)
|
|
add_subdirectory(Pipeline)
|
|
# The MGPipe catalogue arithmetic: no GL context and no driver, just the .def, the seven
|
|
# generated files and the payload layouts.
|
|
add_subdirectory(Pipe)
|
|
# The P0.5 interface-purity gate: a python walk of #include lines, so it registers with no
|
|
# MobileGL build, no GL context and no submodules (scripts/check_include_closure.py).
|
|
add_subdirectory(Purity)
|
|
add_subdirectory(ShaderTranspiler)
|
|
add_subdirectory(Util)
|
|
add_subdirectory(SelfTest)
|
|
# The DirectGLES post-transpile ESSL passes are pure String -> String, so unlike the
|
|
# DirectVulkan suite below this one needs no device and always builds.
|
|
add_subdirectory(Backend/DirectGLES)
|
|
if (ENABLE_INTEGRATION_TESTS)
|
|
add_subdirectory(Backend/DirectVulkan)
|
|
endif()
|
|
# The wire layer only exists in the disaggregated configuration, so its suite
|
|
# is only registered there. Nothing under MG_Remote is compiled otherwise.
|
|
if (MOBILEGL_BUILD_DISAGGREGATED)
|
|
add_subdirectory(Wire)
|
|
endif()
|