proto: link velox::proto in the C++ conformance runner, per CORE's request
core/docs/proto-requests-conformance-cmake.md: the runner's header comment said it links libveloxproto, but it actually compiled core/generated/velox_proto.cpp straight into the executable and found nlohmann_json itself — the only option while ADR 0009's target didn't exist. It exists now on main as velox::proto (core/CMakeLists.txt, PUBLIC generated include dir, PUBLIC nlohmann_json). if(TARGET velox::proto): link it. else: fall back to compiling the generated .cpp directly, for a configure with no core/ in the tree. Both paths verified — full tree links libveloxproto.a (compiled once, by veloxproto's own target); with core/CMakeLists.txt hidden the fallback compiles the .cpp and finds nlohmann itself. conformance_cpp passes either way. Beyond tidiness: once GUI links velox::proto too, the conformance runner linking the same target is what guarantees the suite and the clients exercise byte-identical generated code, rather than two compiles of one .cpp under two warning configs — the exact skew a conformance suite exists to catch. run.sh's own direct g++ compile is unaffected and stays independent by design; this only changes the ctest-driven path CI and lanes use. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fgjnqFCS5h5L7gZTZo3rV
This commit is contained in:
@@ -1,27 +1,34 @@
|
|||||||
# Conformance runner, C++ side. Owned by lane PROTO.
|
# Conformance runner, C++ side. Owned by lane PROTO.
|
||||||
#
|
#
|
||||||
# Links libveloxproto (the generated protocol code in core/generated/), not libveloxcore:
|
# Links libveloxproto (the generated wire code, ADR 0009's velox::proto target), not
|
||||||
# this exercises the wire types, which is a separate concern from the engine. See
|
# libveloxcore: this exercises the wire types, which is a separate concern from the engine.
|
||||||
# docs/adr/0009-generated-protocol-library.md.
|
#
|
||||||
|
# Linking the same target GUI and daemon link — rather than compiling
|
||||||
|
# core/generated/velox_proto.cpp into a second executable with its own flag set — is what
|
||||||
|
# guarantees the conformance suite is checking byte-identical generated code to what the
|
||||||
|
# clients ship. Two compiles of one .cpp under two warning configs is exactly the skew a
|
||||||
|
# conformance suite exists to catch.
|
||||||
|
|
||||||
# The root CMakeLists.txt only find_package(nlohmann_json)'s when daemon/CMakeLists.txt
|
if(TARGET velox::proto)
|
||||||
# exists (daemon is its real consumer), so this target may not exist yet when this
|
add_executable(velox_conformance_cpp conformance_main.cpp)
|
||||||
# directory configures on its own — this suite must not depend on daemon having landed.
|
target_link_libraries(velox_conformance_cpp PRIVATE velox::proto)
|
||||||
# Self-sufficient rather than reaching into the root file to widen that guard.
|
else()
|
||||||
if(NOT TARGET nlohmann_json::nlohmann_json)
|
# Standalone configure of tests/conformance/ with no core/ in the tree: compile the
|
||||||
|
# generated source directly, as before the velox::proto target existed. Keeps the
|
||||||
|
# suite buildable on its own.
|
||||||
|
if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||||
find_package(nlohmann_json 3.11 REQUIRED)
|
find_package(nlohmann_json 3.11 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
add_executable(velox_conformance_cpp
|
||||||
add_executable(velox_conformance_cpp
|
|
||||||
conformance_main.cpp
|
conformance_main.cpp
|
||||||
${CMAKE_SOURCE_DIR}/core/generated/velox_proto.cpp)
|
${CMAKE_SOURCE_DIR}/core/generated/velox_proto.cpp)
|
||||||
|
target_include_directories(velox_conformance_cpp PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/core/generated)
|
||||||
|
target_link_libraries(velox_conformance_cpp PRIVATE nlohmann_json::nlohmann_json)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(velox_conformance_cpp PRIVATE
|
target_include_directories(velox_conformance_cpp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_SOURCE_DIR}/core/generated
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
target_compile_features(velox_conformance_cpp PRIVATE cxx_std_23)
|
target_compile_features(velox_conformance_cpp PRIVATE cxx_std_23)
|
||||||
target_link_libraries(velox_conformance_cpp PRIVATE nlohmann_json::nlohmann_json)
|
|
||||||
|
|
||||||
# The runner needs the repository root so it can find contracts/fixtures.
|
# The runner needs the repository root so it can find contracts/fixtures.
|
||||||
add_test(NAME conformance_cpp
|
add_test(NAME conformance_cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user