@echo off setlocal enabledelayedexpansion REM --- Validate argument --------------------------------------------------- if "%~1"=="force" (set "build_option=--build=*" & goto :parseargs) if "%~1"=="missing" (set "build_option=--build=missing" & goto :parseargs) call :usage exit /b 1 :usage echo Usage: %~n0 [force^|missing] [Release^|RelWithDebInfo^|Debug] [--profile ^] [--build-profile ^] [--variant toolmode^|game] [--unity ON^|OFF] [--tracy True^|False] echo force - Rebuild all packages from source echo missing - Only build packages not already cached echo build_type (optional) - One of: Release, RelWithDebInfo, Debug echo If omitted, all build types are processed echo --profile ^ (optional) - Conan host profile name under ConanProfiles\host (default: msvc) echo --build-profile ^ (optional) - Conan build profile name under ConanProfiles\build (default: msvc) echo --variant ^ (optional) - One of: toolmode, game. If omitted, both are processed echo --unity ^ (optional) - Sets CMAKE_UNITY_BUILD. If omitted, CMake's own default applies echo --tracy ^ (optional) - Sets the bigfoot/*:tracy option (default: True) REM NOTE: flags take their value as a separate argument (space-separated, not --flag=value): REM cmd.exe splits an unquoted --flag=value into two argv entries on the "=", so a single REM %1-style token would only ever see "--flag". exit /b 0 :parseargs set "profile_name=msvc" set "build_profile_name=msvc" set "variant_arg=" set "unity_val=" set "tracy_val=True" set "build_type_arg=" shift :argloop if "%~1"=="" goto :argsdone set "arg=%~1" if /i "%arg%"=="--profile" ( set "profile_name=%~2" shift shift goto :argloop ) if /i "%arg%"=="--build-profile" ( set "build_profile_name=%~2" shift shift goto :argloop ) if /i "%arg%"=="--variant" ( set "variant_arg=%~2" if /i not "!variant_arg!"=="toolmode" if /i not "!variant_arg!"=="game" goto :bad_variant shift shift goto :argloop ) if /i "%arg%"=="--unity" ( set "unity_val=%~2" if /i not "!unity_val!"=="ON" if /i not "!unity_val!"=="OFF" goto :bad_unity shift shift goto :argloop ) if /i "%arg%"=="--tracy" ( set "tracy_val=%~2" if /i not "!tracy_val!"=="True" if /i not "!tracy_val!"=="False" goto :bad_tracy shift shift goto :argloop ) if /i "%arg%"=="Release" (set "build_type_arg=Release" & shift & goto :argloop) if /i "%arg%"=="RelWithDebInfo" (set "build_type_arg=RelWithDebInfo" & shift & goto :argloop) if /i "%arg%"=="Debug" (set "build_type_arg=Debug" & shift & goto :argloop) echo ERROR: Unrecognized argument '%arg%' call :usage exit /b 1 REM goto targets below are unindented on purpose: exit /b from deep inside nested REM if-blocks does not reliably propagate its code out to the caller of this script, REM so validation failures jump out to a plain top-level "exit /b" instead. :bad_variant echo ERROR: Invalid variant '%variant_arg%'. Must be one of: toolmode, game exit /b 1 :bad_unity echo ERROR: Invalid value for --unity '%unity_val%'. Must be ON or OFF exit /b 1 :bad_tracy echo ERROR: Invalid value for --tracy '%tracy_val%'. Must be True or False exit /b 1 :argsdone if defined build_type_arg ( set "build_types=!build_type_arg!" ) else ( set "build_types=Release RelWithDebInfo Debug" ) if defined variant_arg ( set "variants=!variant_arg!" ) else ( set "variants=toolmode game" ) set "profile_stripped=!profile_name:asan=!" if not "!profile_stripped!"=="!profile_name!" (set "is_asan=1") else (set "is_asan=0") REM --- Register remote (skip if already registered) ------------------------ conan remote list | findstr /i "bigfootpackages" >nul 2>&1 if errorlevel 1 ( echo Adding Conan remote: bigfootpackages conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages if errorlevel 1 ( echo ERROR: Failed to add Conan remote. exit /b 1 ) ) else ( echo Conan remote 'bigfootpackages' already registered, skipping. ) REM --- Shared flags ----------------------------------------------------------- set "conan_common_base=--remote=bigfootpackages -pr:h=./ConanProfiles/host/!profile_name! -pr:b=./ConanProfiles/build/!build_profile_name! -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=!tracy_val! -o bigfoot/*:vulkan=True" REM --- Install dependencies for each build type/variant ----------------------- for %%C in (%build_types%) do ( echo. echo [%%C] Installing dependencies... if /i "%%C"=="Release" set "config_profile=./ConanProfiles/Configurations/release" if /i "%%C"=="RelWithDebInfo" set "config_profile=./ConanProfiles/Configurations/relwithdebinfo" if /i "%%C"=="Debug" set "config_profile=./ConanProfiles/Configurations/debug" if "!is_asan!"=="1" if /i "%%C"=="Release" set "config_profile=./ConanProfiles/Configurations/release_noipo" for %%V in (%variants%) do ( set "toolmode_val=False" if /i "%%V"=="toolmode" set "toolmode_val=True" conan install . !conan_common_base! -of build-windows-%%V -o bigfoot/*:toolmode=!toolmode_val! %build_option% -pr:h=!config_profile! -pr:b=!config_profile! if errorlevel 1 ( echo ERROR: conan install failed for build type %%C ^(%%V^) exit /b 1 ) ) echo [%%C] Done. ) echo. echo All build types installed successfully. REM --- Activate build environment and run CMake -------------------------------- echo. echo Activating build environment and configuring CMake... set "unity_args=" if defined unity_val set "unity_args=-DCMAKE_UNITY_BUILD=!unity_val!" for %%V in (%variants%) do ( mkdir graphviz-windows-%%V 2>nul powershell -ExecutionPolicy Bypass -Command "& 'build-windows-%%V/build/generators/conanbuild.ps1'; cmake -S . -B build-windows-%%V --toolchain build-windows-%%V/build/generators/conan_toolchain.cmake !unity_args! --graphviz=graphviz-windows-%%V/graph.dot; if ($LASTEXITCODE -ne 0) { Write-Host 'ERROR: CMake configuration failed'; exit 1 }" if errorlevel 1 ( echo ERROR: Build environment or CMake step failed for %%V. exit /b 1 ) ) echo. echo CMake configuration successful. endlocal