Repository navigation
build(tests): respect CMAKE_BUILD_TYPE flags, expand format PCHs, and clean unity builds - #261
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
… clean unity builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tests/CMakeLists.txthardcodes-O3 -ggdbintoCMAKE_CXX_FLAGSfor GCC and Clang regardless ofCMAKE_BUILD_TYPE. Release test builds emit full DWARF debug info (788 MiBacross 340 objects for the default JSON suites alone), whileDebugtest builds silently compile at-O3.Meanwhile,
tests/generichas no precompiled header at all, the other test targets only precompilerfl.hpprather than their format headers, and standard CMake unity builds (-DCMAKE_UNITY_BUILD=ON) fail on macro-redefining enum-range tests and global test types.reflect-cpp-selfJSON-5, 607/607 CTests, Apple M1 arm64, Apple Clang 17.0.0,-j4, Release, paired vs.290bdb24):176.9 → 129.0 s(-27.1%), CPU695.5 → 491.4 s(-29.3%), peak RSS809 → 576 MiB(-28.8%), total.o788 → 46 MiB(-94.2%, 17.1x smaller).-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=16: wall176.9 → 67.7 s(-61.7%, 2.61x faster), CPU695.5 → 245.3 s(-64.7%), peak RSS809 → 709 MiB(-12.4%), total.o788 → 27 MiB(-96.6%, 29.2x smaller; 340 → 28 objects).Summary
-O3 -ggdbfromtests/CMakeLists.txt(keeping-Wall -Werror -ftemplate-backtrace-limit=0) soCMAKE_BUILD_TYPEandCMAKE_CXX_FLAGS_<CONFIG>control optimization and debug info, and adds/bigobj(MSVC) /-Wa,-mbig-obj(MinGW) underCMAKE_UNITY_BUILD. All 12 upstream GitHub Actionscmake -Sjobs already pass-DCMAKE_BUILD_TYPE=Release.tests/generic(excludingtest_enum_range*.cppfrom PCH and unity viaSKIP_PRECOMPILE_HEADERS/SKIP_UNITY_BUILD_INCLUSIONsince they redefineRFL_ENUM_RANGE_MIN/MAXbefore<rfl.hpp>) and upgrades the 7 verified test targets (generic,json,json_c_arrays_and_inheritance,cli,env,xml,boost_serialization) to public format headers only (no localwrite_and_read.hpp, preservingREFLECTCPP_JSON=OFF; remaining 13 format suites stay untouched for a CI-verified follow-up).-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON, GCC 16-O2, and-DCMAKE_UNITY_BUILD=ON(BATCH_SIZE=16and0)-Wall -Werror-clean across all 7 verified suites with zeroinclude/orsrc/edits (target_compile_definitions+ non-MSVC-Wno-missing-bracesinjson_c_arrays_and_inheritancefor C-array brace elision when PCH is disabled,reserve(4 + N)intests/check_bitset.hppcheck_native/check_sizeto prevent GCC 16-O2-Werror=array-bounds, and file-scoped namespaces in 4 test files).For Agents
upstream-queue(283ad7d7) · Score69/100(S=27,M=18,D=12,R=12) ·+57/-17(13f)generic,json,json_c_arrays_and_inheritance,cli,env,xml,boost_serialization) 721/721 PASS across 4 modes — Release default (UNITY=OFF), ReleaseCMAKE_UNITY_BUILD=ON(BATCH_SIZE=16andBATCH_SIZE=0single-TU),CMAKE_BUILD_TYPE=Debug(-O0 -g,__DWARFverified), andCMAKE_DISABLE_PRECOMPILE_HEADERS=ON; GCC 16.2.0 41/41 compile units across 5 GCC-buildable suites +-O2 -Wall -Werroroncheck_size&check_native0 warnings;upstream-queueREFLECTCPP_JSON=OFF(xml+boost_serialization) 114/114 PASS andREFLECTCPP_JSON=ON(#258yyjson.cisolated outside unity) 147/147 PASS.reflect-cpp-selfJSON-5,-j4, Release, Apple Clang 17 vs.290bdb24): Default Release wall176.9 → 129.0 s(-27.1%), CPU695.5 → 491.4 s(-29.3%), RSS809 → 576 MiB(-28.8%),.o788 → 46 MiB(-94.2%); with-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=16wall67.7 s(-61.7%), CPU245.3 s(-64.7%), RSS709 MiB(-12.4%),.o27 MiB(-96.6%,340 → 28objs).maintainer-review-guide.md(dropped all 5 bespokeREFLECTCPP_TEST_*options in favor of standard CMake, droppedwrite_and_read.hppfrom PCHs, fixed bothcheck_bitset.hppGCC-O2paths, reverted 13 unbuilt format suites). Applies with 0 conflicts toorigin/main(aaa991b5) andfork/upstream-queue(3d33e721); all 12.github/workflows/cmake -Sjobs already pass-DCMAKE_BUILD_TYPE=Release. Optional: land after#258when using-DCMAKE_UNITY_BUILD=ONwith extra formats (isolatessrc/yyjson.cfrom unity batches); remaining 13 format suites are a CI-verified follow-up.