From fb2633eff1494fc48c09bffb15cb06679c875090 Mon Sep 17 00:00:00 2001 From: Yaraslau Tamashevich Date: Wed, 12 Aug 2026 18:16:31 +0300 Subject: [PATCH] ci: apply /bigobj globally to demo/example/ladder targets via apply_bigobj() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several unrelated targets (morph_forms_demo, lab_forms_demo_module, morph_tests) have each independently hit MSVC's C1128 ('number of sections exceeded object file format limit') as they grew, requiring a one-off /bigobj fix each time. Rather than keep discovering this target by target, add a shared apply_bigobj() helper (matching the existing apply_warnings/apply_sanitizers/apply_coverage pattern) and call it from every demo/example/ladder target: bank_lib, bank_cli, bank_tests, bank_gui, bank_gui_wasm, morph_concepts_tests, morph_forms_demo, lab_forms_demo_module, morph_qt_tls_example, and both vetted-HMAC demo/test pairs. Replaces morph_forms_demo's one-off manual flag (#80) with the shared helper. Verified locally under cl-debug: default config (77/77 targets) and with -DMORPH_BUILD_FORMS_QML=ON (180/180 targets, including lab_forms_demo_module and morph_forms_qml) both build clean; full suite passes 915/915 with QML enabled. examples/bank's GUI targets could not be exercised locally (Lightweight ORM's yaml-cpp dependency unavailable in this environment) but use the identical one-line apply_bigobj(...) call already proven on every other target — CI will confirm. Co-Authored-By: Claude Sonnet 5 --- cmake/compiler_options.cmake | 16 ++++++++++++++++ examples/bank/CMakeLists.txt | 3 +++ examples/bank/gui/CMakeLists.txt | 1 + examples/bank/gui_wasm/CMakeLists.txt | 1 + examples/concepts/CMakeLists.txt | 1 + examples/forms/CMakeLists.txt | 12 +----------- examples/forms/gui_qml/CMakeLists.txt | 1 + examples/qt_tls_client/CMakeLists.txt | 1 + examples/vetted_hmac/CMakeLists.txt | 4 ++++ 9 files changed, 29 insertions(+), 11 deletions(-) diff --git a/cmake/compiler_options.cmake b/cmake/compiler_options.cmake index 1c9817b1..d9f9b1c8 100644 --- a/cmake/compiler_options.cmake +++ b/cmake/compiler_options.cmake @@ -208,6 +208,22 @@ function(apply_coverage target) -fprofile-instr-generate) endfunction() +function(apply_bigobj target) + # Demo/example/test binaries that instantiate schema, rule, or form + # templates over many action types push their .obj's COFF section count + # past the 32-bit SN_LOFF format's limit under MSVC Debug (no /Og + # folding, full /Zi debug info), aborting with C1128 ("number of + # sections exceeded object file format limit"). Several unrelated + # targets have hit this independently as they grew (morph_forms_demo, + # lab_forms_demo_module, morph_tests) -- call this on any target built + # from demo/example/ladder sources instead of waiting for it to recur. + # /bigobj switches to the extended section-count format; harmless on + # Release and on other compilers. + target_compile_options(${target} PRIVATE + $<$:/bigobj> + ) +endfunction() + function(apply_fuzzer target) # tests/fuzz/*: libFuzzer harnesses over morph::wire::decode and # RemoteServer::dispatchMessage. Only meaningful on Clang (libFuzzer ships diff --git a/examples/bank/CMakeLists.txt b/examples/bank/CMakeLists.txt index 112b315b..8bd6798e 100644 --- a/examples/bank/CMakeLists.txt +++ b/examples/bank/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(bank_lib STATIC target_include_directories(bank_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) target_link_libraries(bank_lib PUBLIC morph::morph Lightweight::Lightweight) target_compile_features(bank_lib PUBLIC cxx_std_23) +apply_bigobj(bank_lib) # Note: deliberately NOT calling apply_warnings() here — the third-party ORM # headers are not -Werror clean and would fail the build. @@ -72,6 +73,7 @@ target_compile_features(bank_lib PUBLIC cxx_std_23) add_executable(bank_cli src/cli/main.cpp) target_link_libraries(bank_cli PRIVATE bank_lib) target_compile_features(bank_cli PRIVATE cxx_std_23) +apply_bigobj(bank_cli) # ── Qt 6 GUI (opt-in) ──────────────────────────────────────────────────────── if(MORPH_BUILD_BANK_GUI) @@ -103,6 +105,7 @@ if(MORPH_BUILD_TESTS) target_include_directories(bank_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests) target_link_libraries(bank_tests PRIVATE bank_lib Catch2::Catch2WithMain) target_compile_features(bank_tests PRIVATE cxx_std_23) + apply_bigobj(bank_tests) list(APPEND CMAKE_MODULE_PATH ${Catch2_DIR}) include(Catch) diff --git a/examples/bank/gui/CMakeLists.txt b/examples/bank/gui/CMakeLists.txt index 30b4a889..dd4ff9a3 100644 --- a/examples/bank/gui/CMakeLists.txt +++ b/examples/bank/gui/CMakeLists.txt @@ -40,3 +40,4 @@ qt_add_qml_module(bank_gui target_include_directories(bank_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(bank_gui PRIVATE bank_lib Qt6::Quick Qt6::Qml Qt6::QuickControls2) target_compile_features(bank_gui PRIVATE cxx_std_23) +apply_bigobj(bank_gui) diff --git a/examples/bank/gui_wasm/CMakeLists.txt b/examples/bank/gui_wasm/CMakeLists.txt index 83a8b261..234cddff 100644 --- a/examples/bank/gui_wasm/CMakeLists.txt +++ b/examples/bank/gui_wasm/CMakeLists.txt @@ -72,3 +72,4 @@ target_link_libraries(bank_gui_wasm PRIVATE Qt6::Core Qt6::Gui Qt6::Qml Qt6::Quick Qt6::QuickControls2 ) target_compile_features(bank_gui_wasm PRIVATE cxx_std_23) +apply_bigobj(bank_gui_wasm) diff --git a/examples/concepts/CMakeLists.txt b/examples/concepts/CMakeLists.txt index 45784db8..d85b2db1 100644 --- a/examples/concepts/CMakeLists.txt +++ b/examples/concepts/CMakeLists.txt @@ -41,6 +41,7 @@ if(MORPH_BUILD_TESTS) ) target_link_libraries(morph_concepts_tests PRIVATE morph::morph Catch2::Catch2WithMain) apply_warnings(morph_concepts_tests) + apply_bigobj(morph_concepts_tests) list(APPEND CMAKE_MODULE_PATH ${Catch2_DIR}) include(Catch) diff --git a/examples/forms/CMakeLists.txt b/examples/forms/CMakeLists.txt index 45a6a718..61db6d3f 100644 --- a/examples/forms/CMakeLists.txt +++ b/examples/forms/CMakeLists.txt @@ -8,17 +8,7 @@ add_executable(morph_forms_demo main.cpp) target_link_libraries(morph_forms_demo PRIVATE morph::morph) apply_warnings(morph_forms_demo) - -# main.cpp instantiates schema/rule templates over every demo action type; -# under MSVC Debug (more sections per symbol than Release: no /Og folding, -# full /Zi debug info) that pushes main.cpp.obj's COFF section count past the -# 32-bit SN_LOFF format's limit -- MSVC then aborts with C1128 ("number of -# sections exceeded object file format limit"). /bigobj switches the object -# file to the extended section-count format; harmless on Release and on -# other compilers, so it is unconditional for this target. -target_compile_options(morph_forms_demo PRIVATE - $<$:/bigobj> -) +apply_bigobj(morph_forms_demo) if(DEFINED AF_SANITIZER) apply_sanitizers(morph_forms_demo ${AF_SANITIZER}) diff --git a/examples/forms/gui_qml/CMakeLists.txt b/examples/forms/gui_qml/CMakeLists.txt index 396cc216..0f1a3858 100644 --- a/examples/forms/gui_qml/CMakeLists.txt +++ b/examples/forms/gui_qml/CMakeLists.txt @@ -27,6 +27,7 @@ qt_add_qml_module(lab_forms_demo_module target_include_directories(lab_forms_demo_module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) target_link_libraries(lab_forms_demo_module PUBLIC morph::morph morph::qt_forms morph_forms_moduleplugin Qt6::Quick Qt6::Qml) target_compile_features(lab_forms_demo_module PUBLIC cxx_std_23) +apply_bigobj(lab_forms_demo_module) qt_add_executable(morph_forms_qml main.cpp) target_link_libraries(morph_forms_qml PRIVATE lab_forms_demo_moduleplugin Qt6::Quick) diff --git a/examples/qt_tls_client/CMakeLists.txt b/examples/qt_tls_client/CMakeLists.txt index 8656a531..c8710321 100644 --- a/examples/qt_tls_client/CMakeLists.txt +++ b/examples/qt_tls_client/CMakeLists.txt @@ -10,6 +10,7 @@ add_executable(morph_qt_tls_example main.cpp) target_link_libraries(morph_qt_tls_example PRIVATE morph_qt_impl) apply_warnings(morph_qt_tls_example) +apply_bigobj(morph_qt_tls_example) target_compile_definitions(morph_qt_tls_example PRIVATE QT_TLS_EXAMPLE_CERTS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/certs" diff --git a/examples/vetted_hmac/CMakeLists.txt b/examples/vetted_hmac/CMakeLists.txt index d13957e3..f6261bba 100644 --- a/examples/vetted_hmac/CMakeLists.txt +++ b/examples/vetted_hmac/CMakeLists.txt @@ -25,6 +25,7 @@ if(MORPH_BUILD_HMAC_EXAMPLE_LIBSODIUM) add_executable(morph_vetted_hmac_libsodium_demo libsodium_adapter_demo.cpp) target_link_libraries(morph_vetted_hmac_libsodium_demo PRIVATE morph::morph PkgConfig::SODIUM) + apply_bigobj(morph_vetted_hmac_libsodium_demo) # Deliberately NOT calling apply_warnings() here — libsodium's public # headers are not -Weverything/-Werror clean and would fail the strict # build (same rationale as examples/bank/CMakeLists.txt's ORM headers). @@ -45,6 +46,7 @@ if(MORPH_BUILD_HMAC_EXAMPLE_LIBSODIUM) add_executable(morph_vetted_hmac_libsodium_tests test_libsodium_adapter.cpp) target_link_libraries(morph_vetted_hmac_libsodium_tests PRIVATE morph::morph PkgConfig::SODIUM Catch2::Catch2WithMain) + apply_bigobj(morph_vetted_hmac_libsodium_tests) list(APPEND CMAKE_MODULE_PATH ${Catch2_DIR}) include(Catch) @@ -59,6 +61,7 @@ if(MORPH_BUILD_HMAC_EXAMPLE_OPENSSL) add_executable(morph_vetted_hmac_openssl_demo openssl_adapter_demo.cpp) target_link_libraries(morph_vetted_hmac_openssl_demo PRIVATE morph::morph OpenSSL::Crypto) + apply_bigobj(morph_vetted_hmac_openssl_demo) # Deliberately NOT calling apply_warnings() here — OpenSSL's public # headers are not -Weverything/-Werror clean and would fail the strict # build (same rationale as examples/bank/CMakeLists.txt's ORM headers). @@ -75,6 +78,7 @@ if(MORPH_BUILD_HMAC_EXAMPLE_OPENSSL) add_executable(morph_vetted_hmac_openssl_tests test_openssl_adapter.cpp) target_link_libraries(morph_vetted_hmac_openssl_tests PRIVATE morph::morph OpenSSL::Crypto Catch2::Catch2WithMain) + apply_bigobj(morph_vetted_hmac_openssl_tests) list(APPEND CMAKE_MODULE_PATH ${Catch2_DIR}) include(Catch)