Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmake/compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<$<CXX_COMPILER_ID:MSVC>:/bigobj>
)
endfunction()

function(apply_fuzzer target)
# tests/fuzz/*: libFuzzer harnesses over morph::wire::decode and
# RemoteServer::dispatchMessage. Only meaningful on Clang (libFuzzer ships
Expand Down
3 changes: 3 additions & 0 deletions examples/bank/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ 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.

# ── CLI driver ───────────────────────────────────────────────────────────────
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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/bank/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions examples/bank/gui_wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions examples/concepts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 1 addition & 11 deletions examples/forms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<$<CXX_COMPILER_ID:MSVC>:/bigobj>
)
apply_bigobj(morph_forms_demo)

if(DEFINED AF_SANITIZER)
apply_sanitizers(morph_forms_demo ${AF_SANITIZER})
Expand Down
1 change: 1 addition & 0 deletions examples/forms/gui_qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/qt_tls_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions examples/vetted_hmac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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)
Expand All @@ -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).
Expand All @@ -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)
Expand Down
Loading