From 6133345e1a7019e784057eedf8b7ec53319ee3c6 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Sat, 31 Oct 2026 17:16:24 +0100 Subject: [PATCH 1/5] Enable /bigobj for MSVC and default to Release (#464) --- CMakeLists.txt | 3 +++ cmake/StandardProjectSettings.cmake | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01124945..3e6f3dda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,9 @@ if(WEBFRONT_IS_TOP_LEVEL) endif() add_library(WebFront_options INTERFACE) target_compile_features(WebFront_options INTERFACE cxx_std_23) +# The header-only library instantiates enough templates for the examples to exceed MSVC's default +# object-file section limit (error C1128). +target_compile_options(WebFront_options INTERFACE "$<$:/bigobj>") # Do not force-define __cpp_lib_format on the command line: unlike a header setting it after # actually providing , a command-line -D applies from the start of every translation # unit, so other standard headers (e.g. ) that gate their own integration on diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 72439bc4..06d39acf 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -1,8 +1,8 @@ # Set a default build type if none was specified if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE - RelWithDebInfo + Release CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui, ccmake set_property( @@ -12,6 +12,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "Release" "MinSizeRel" "RelWithDebInfo") +elseif(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_DEFAULT_BUILD_TYPE) + # Used by Ninja Multi-Config. Visual Studio and Xcode ignore it: select the configuration with --config. + set(CMAKE_DEFAULT_BUILD_TYPE Release) endif() # Generate compile_commands.json to make it easier to work with clang based tools From 833dabeaff75e5b7a11ca4ca54471091ace73b13 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Sat, 31 Oct 2026 17:31:09 +0100 Subject: [PATCH 2/5] Make WebFrontLifeReact project optional, restore RelWithDebInfo default (#464) --- cmake/StandardProjectSettings.cmake | 10 +++++----- docs/REACT.md | 3 ++- examples/life/react/LifeReact.cpp | 12 +++++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 06d39acf..c8e6c8fc 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -1,8 +1,8 @@ # Set a default build type if none was specified if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") + message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") set(CMAKE_BUILD_TYPE - Release + RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui, ccmake set_property( @@ -12,9 +12,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "Release" "MinSizeRel" "RelWithDebInfo") -elseif(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_DEFAULT_BUILD_TYPE) - # Used by Ninja Multi-Config. Visual Studio and Xcode ignore it: select the configuration with --config. - set(CMAKE_DEFAULT_BUILD_TYPE Release) +elseif(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND NOT CMAKE_DEFAULT_BUILD_TYPE) + # Only Ninja Multi-Config accepts this variable. Visual Studio and Xcode build Debug unless --config is given. + set(CMAKE_DEFAULT_BUILD_TYPE RelWithDebInfo) endif() # Generate compile_commands.json to make it easier to work with clang based tools diff --git a/docs/REACT.md b/docs/REACT.md index 9c2f3628..9076261b 100644 --- a/docs/REACT.md +++ b/docs/REACT.md @@ -131,7 +131,8 @@ containing the packed grid, generation and population. Each browser owns a separ simulation, released on disconnect. The original Life starter remains available. Build the `WebFrontLifeReact` CMake target and run it with a writable copy of -`main.tsx` and `webfront.project.json` from that directory as its project argument. +`main.tsx` and `webfront.project.json` from that directory as its project argument +(without argument it uses `./life-project`, created when missing). In its terminal, run `wf install`, then `wf preview`. The configured registry must carry `@webfront/react@0.1.0`; this change prepares the archive but does not publish to npm. The repository's test registry already carries the package. For a local diff --git a/examples/life/react/LifeReact.cpp b/examples/life/react/LifeReact.cpp index cfc143bb..83631815 100644 --- a/examples/life/react/LifeReact.cpp +++ b/examples/life/react/LifeReact.cpp @@ -1,17 +1,23 @@ #include "LifeReact.hpp" +#include "../LifeDeveloperOptions.hpp" #include "../LifeFrontend.hpp" #include +#include #include int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Usage: WebFrontLifeReact \n"; + if (argc > 2 || (argc == 2 && *argv[1] == '\0')) { + std::cerr << "Usage: WebFrontLifeReact []\n" + "Without argument the project is ./" + << webfront::demo::LifeDeveloperOptions::defaultProject << ", created when missing.\n"; return 2; } try { - webfront::demo::LifeApp app{argv[1]}; + const std::filesystem::path project = argc == 2 ? argv[1] : webfront::demo::LifeDeveloperOptions::defaultProject; + webfront::demo::prepareLifeProject(project); + webfront::demo::LifeApp app{project}; auto subscription = webfront::demo::installLifeReact(app); app.bootstrap("developer"); app.show(); From b19a9dde3725a534cf217d9e86a146054ebacdeb Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:01:00 +0100 Subject: [PATCH 3/5] Pick a default configuration present in CMAKE_CONFIGURATION_TYPES and document the Life React project files --- cmake/StandardProjectSettings.cmake | 11 ++++++++++- docs/REACT.md | 15 ++++++++++++--- examples/life/react/LifeReact.cpp | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index c8e6c8fc..036cf89d 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -14,7 +14,16 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "RelWithDebInfo") elseif(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND NOT CMAKE_DEFAULT_BUILD_TYPE) # Only Ninja Multi-Config accepts this variable. Visual Studio and Xcode build Debug unless --config is given. - set(CMAKE_DEFAULT_BUILD_TYPE RelWithDebInfo) + # The default must belong to CMAKE_CONFIGURATION_TYPES, or generation fails. + foreach(_webfront_candidate RelWithDebInfo Release Debug) + if(_webfront_candidate IN_LIST CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEFAULT_BUILD_TYPE ${_webfront_candidate}) + break() + endif() + endforeach() + if(NOT CMAKE_DEFAULT_BUILD_TYPE AND CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 CMAKE_DEFAULT_BUILD_TYPE) + endif() endif() # Generate compile_commands.json to make it easier to work with clang based tools diff --git a/docs/REACT.md b/docs/REACT.md index 9076261b..a04137f9 100644 --- a/docs/REACT.md +++ b/docs/REACT.md @@ -130,9 +130,18 @@ The C++ event computes a generation, updates the island and sets a tuple snapsho containing the packed grid, generation and population. Each browser owns a separate simulation, released on disconnect. The original Life starter remains available. -Build the `WebFrontLifeReact` CMake target and run it with a writable copy of -`main.tsx` and `webfront.project.json` from that directory as its project argument -(without argument it uses `./life-project`, created when missing). +Build the `WebFrontLifeReact` CMake target. The application only creates an +empty project directory when it is missing (without argument `./life-project`); +it does not copy the example's sources. Copy `main.tsx` and +`webfront.project.json` from `examples/life/react/` into that directory first, +then start the application: + +```sh +mkdir -p life-project +cp examples/life/react/main.tsx examples/life/react/webfront.project.json life-project/ +./build/examples/WebFrontLifeReact life-project +``` + In its terminal, run `wf install`, then `wf preview`. The configured registry must carry `@webfront/react@0.1.0`; this change prepares the archive but does not publish to npm. The repository's test registry already carries the package. For a local diff --git a/examples/life/react/LifeReact.cpp b/examples/life/react/LifeReact.cpp index 83631815..30435f6e 100644 --- a/examples/life/react/LifeReact.cpp +++ b/examples/life/react/LifeReact.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) { if (argc > 2 || (argc == 2 && *argv[1] == '\0')) { std::cerr << "Usage: WebFrontLifeReact []\n" "Without argument the project is ./" - << webfront::demo::LifeDeveloperOptions::defaultProject << ", created when missing.\n"; + << webfront::demo::LifeDeveloperOptions::defaultProject << ", created empty when missing: copy main.tsx and webfront.project.json from examples/life/react/ into it first.\n"; return 2; } try { From 06ea727b7586a60b5bf61bb3f81b1354a440042b Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:02:10 +0100 Subject: [PATCH 4/5] Use a new directory and refuse overwriting in the Life React instructions --- docs/REACT.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/REACT.md b/docs/REACT.md index a04137f9..9f663720 100644 --- a/docs/REACT.md +++ b/docs/REACT.md @@ -132,14 +132,14 @@ simulation, released on disconnect. The original Life starter remains available. Build the `WebFrontLifeReact` CMake target. The application only creates an empty project directory when it is missing (without argument `./life-project`); -it does not copy the example's sources. Copy `main.tsx` and +it does not copy the example's sources. Use a new directory, so that no existing project is touched: `mkdir` fails if it exists and `cp -n` never overwrites a file. Copy `main.tsx` and `webfront.project.json` from `examples/life/react/` into that directory first, then start the application: ```sh -mkdir -p life-project -cp examples/life/react/main.tsx examples/life/react/webfront.project.json life-project/ -./build/examples/WebFrontLifeReact life-project +mkdir life-react-project +cp -n examples/life/react/main.tsx examples/life/react/webfront.project.json life-react-project/ +./build/examples/WebFrontLifeReact life-react-project ``` In its terminal, run `wf install`, then `wf preview`. The configured registry must From 10b70f96345f47a9b18676bba7cc1b925f0db001 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:13:12 +0100 Subject: [PATCH 5/5] Do not set CMAKE_DEFAULT_BUILD_TYPE when CMAKE_DEFAULT_CONFIGS is given --- cmake/StandardProjectSettings.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 036cf89d..6b8cbd8d 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -12,7 +12,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "Release" "MinSizeRel" "RelWithDebInfo") -elseif(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND NOT CMAKE_DEFAULT_BUILD_TYPE) +elseif(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND NOT CMAKE_DEFAULT_BUILD_TYPE AND NOT CMAKE_DEFAULT_CONFIGS) # Only Ninja Multi-Config accepts this variable. Visual Studio and Xcode build Debug unless --config is given. # The default must belong to CMAKE_CONFIGURATION_TYPES, or generation fails. foreach(_webfront_candidate RelWithDebInfo Release Debug)