diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6910e21..419717a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - { value: "RelWithDebInfo", profile: "relwithdebinfo" } - { value: "Release", profile: "release" } unity_build: ["ON", "OFF"] - conan_profile: ["./ConanProfiles/host/clang", "./ConanProfiles/host/clang_asan"] + conan_profile: ["clang", "clang_asan"] variant: - { value: "True", name: "toolmode" } - { value: "False", name: "game" } @@ -36,22 +36,17 @@ jobs: - name: Build run: | - CONFIG_PROFILE=./ConanProfiles/Configurations/${{ matrix.build_type.profile }} - if [ "${{ matrix.build_type.profile }}" = "release" ] && [[ "${{ matrix.conan_profile }}" == *asan* ]]; then - CONFIG_PROFILE=./ConanProfiles/Configurations/release_noipo - fi - conan install . --remote=bigfootpackages -pr:h=${{ matrix.conan_profile }} -pr:h=$CONFIG_PROFILE -pr:b=./ConanProfiles/build/clang -pr:b=$CONFIG_PROFILE --build=missing -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:vulkan=True -o bigfoot/*:toolmode=${{ matrix.variant.value }} -of build-${{ matrix.variant.name }} - . ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/conanbuild.sh - cmake -S . -B ./build-${{ matrix.variant.name }}/${{ matrix.build_type.value }} --toolchain ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type.value }} -DCMAKE_UNITY_BUILD=${{ matrix.unity_build }} -G "Ninja" - cmake --build build-${{ matrix.variant.name }}/${{ matrix.build_type.value }} --parallel $(nproc) - . ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/deactivate_conanbuild.sh + bash ./generate_bigfoot.sh missing ${{ matrix.build_type.value }} --profile=${{ matrix.conan_profile }} --variant=${{ matrix.variant.name }} --unity=${{ matrix.unity_build }} --tracy=False + . ./build-linux-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/conanbuild.sh + cmake --build build-linux-${{ matrix.variant.name }}/${{ matrix.build_type.value }} --parallel $(nproc) + . ./build-linux-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/deactivate_conanbuild.sh - name: Unit Tests run: | - cd ./build-${{ matrix.variant.name }}/${{ matrix.build_type.value }} - . ../../build-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/conanbuild.sh + cd ./build-linux-${{ matrix.variant.name }}/${{ matrix.build_type.value }} + . ../../build-linux-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/conanbuild.sh weston-run ctest . --output-on-failure - . ../../build-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/deactivate_conanbuild.sh + . ../../build-linux-${{ matrix.variant.name }}/build/${{ matrix.build_type.value }}/generators/deactivate_conanbuild.sh clang-format: runs-on: ubuntu-latest diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml index 3afae4b..3f62091 100644 --- a/.gitea/workflows/sonarqube.yml +++ b/.gitea/workflows/sonarqube.yml @@ -42,24 +42,23 @@ jobs: - name: Build run: | - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/host/clang_coverage -pr:b=./ConanProfiles/build/clang --build=missing -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:toolmode=${{ matrix.variant.value }} -o bigfoot/*:vulkan=True -of build-${{ matrix.variant.name }} - . ./build-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh - cmake -S . -B ./build-${{ matrix.variant.name }}/Debug --toolchain ./build-${{ matrix.variant.name }}/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" - cmake --build build-${{ matrix.variant.name }}/Debug --parallel $(nproc) - . ./build-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh + bash ./generate_bigfoot.sh missing Debug --profile=clang_coverage --variant=${{ matrix.variant.name }} --tracy=False + . ./build-linux-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh + cmake --build build-linux-${{ matrix.variant.name }}/Debug --parallel $(nproc) + . ./build-linux-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh - name: Run tests run: | - cd ./build-${{ matrix.variant.name }}/Debug - . ../../build-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh + cd ./build-linux-${{ matrix.variant.name }}/Debug + . ../../build-linux-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh LLVM_PROFILE_FILE="%p.profraw%c" weston-run ctest --output-on-failure - . ../../build-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh + . ../../build-linux-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh - name: Clang-Tidy - run: run-clang-tidy -p ./build-${{ matrix.variant.name }}/Debug/ > tidy_result.txt + run: run-clang-tidy -p ./build-linux-${{ matrix.variant.name }}/Debug/ > tidy_result.txt - name: Infer - run: infer run --compilation-database build-${{ matrix.variant.name }}/Debug/compile_commands.json + run: infer run --compilation-database build-linux-${{ matrix.variant.name }}/Debug/compile_commands.json - name: Generate coverage report shell: bash @@ -69,8 +68,8 @@ jobs: # rejects outright ("Wrong major version"). Bypassing gcovr's JSON # path entirely: llvm-cov's lcov exporter is a separate, unaffected # code path, so merge -> export lcov -> convert lcov to Cobertura. - llvm-profdata merge -sparse $(find build-${{ matrix.variant.name }}/Debug -name "*.profraw") -o merged.profdata - BINARIES=($(find build-${{ matrix.variant.name }}/Debug -maxdepth 8 -type f -executable -iname "*Tests")) + llvm-profdata merge -sparse $(find build-linux-${{ matrix.variant.name }}/Debug -name "*.profraw") -o merged.profdata + BINARIES=($(find build-linux-${{ matrix.variant.name }}/Debug -maxdepth 8 -type f -executable -iname "*Tests")) OBJECT_ARGS=$(printf -- '-object %s ' "${BINARIES[@]:1}") llvm-cov export -format=lcov -instr-profile=merged.profdata "${BINARIES[0]}" $OBJECT_ARGS > coverage.lcov # lcov_cobertura isn't preinstalled on the image; inject it into @@ -85,8 +84,8 @@ jobs: -Dsonar.projectKey=${{ matrix.variant.projectKey }} "-Dsonar.projectName=${{ matrix.variant.projectName }}" -Dsonar.projectVersion=${{ steps.version.outputs.version }} - -Dsonar.cxx.jsonCompilationDatabase=./build-${{ matrix.variant.name }}/Debug/compile_commands.json - -Dsonar.cxx.xunit.reportPaths=build-${{ matrix.variant.name }}/Debug/TestResults/*.xml + -Dsonar.cxx.jsonCompilationDatabase=./build-linux-${{ matrix.variant.name }}/Debug/compile_commands.json + -Dsonar.cxx.xunit.reportPaths=build-linux-${{ matrix.variant.name }}/Debug/TestResults/*.xml -Dsonar.qualitygate.wait=true ${{ github.event_name == 'pull_request' && format('-Dsonar.pullrequest.key={0} -Dsonar.pullrequest.branch={1} -Dsonar.pullrequest.base={2} -Dsonar.analysis.sqbot={3}', diff --git a/Bigfoot/Libs/Graphics/GraphicsVulkan/VulkanInstance.cpp b/Bigfoot/Libs/Graphics/GraphicsVulkan/VulkanInstance.cpp index 9c15c24..0879020 100644 --- a/Bigfoot/Libs/Graphics/GraphicsVulkan/VulkanInstance.cpp +++ b/Bigfoot/Libs/Graphics/GraphicsVulkan/VulkanInstance.cpp @@ -9,6 +9,8 @@ #include #include +#include + #include #include @@ -106,7 +108,11 @@ VulkanInstance::VulkanInstance(const eastl::string_view p_applicationName, const const vk::InstanceCreateInfo instanceCreateInfo {{}, &applicationInfo, enabledLayers, enabledExtensions}; - const vk::ResultValue instance = vk::createInstance(instanceCreateInfo); + vk::ResultValue instance {vk::Result::eSuccess, vk::Instance {}}; + { + BIGFOOT_LSAN_ONLY(const __lsan::ScopedDisabler lsanDisabler;) + instance = vk::createInstance(instanceCreateInfo); + } CRITICAL_ASSERT(GraphicsVulkanAssertHandler, instance.result == vk::Result::eSuccess, "({}) Failed to create Vulkan instance", diff --git a/Bigfoot/Tests/Graphics/GraphicsVulkan/VulkanSurface.cpp b/Bigfoot/Tests/Graphics/GraphicsVulkan/VulkanSurface.cpp index afdfb96..e76dc32 100644 --- a/Bigfoot/Tests/Graphics/GraphicsVulkan/VulkanSurface.cpp +++ b/Bigfoot/Tests/Graphics/GraphicsVulkan/VulkanSurface.cpp @@ -27,8 +27,8 @@ class VulkanSurfaceFixture: public ::testing::Test const SDL_PropertiesID windowProperties = SDL_GetWindowProperties(m_window); #ifdef BIGFOOT_WINDOWS - m_surfaceCreateInfo.m_windowHandle = - static_cast(SDL_GetPointerProperty(windowProperties, SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr)); + m_surfaceCreateInfo.m_windowHandle = static_cast( + SDL_GetPointerProperty(windowProperties, SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr)); m_surfaceCreateInfo.m_windowInstance = GetModuleHandle(nullptr); #elif defined BIGFOOT_LINUX m_surfaceCreateInfo.m_display = static_cast( diff --git a/ConanProfiles/build/clang_asan b/ConanProfiles/build/clang_asan new file mode 100644 index 0000000..15c0d54 --- /dev/null +++ b/ConanProfiles/build/clang_asan @@ -0,0 +1,20 @@ +[settings] +os=Linux +arch=x86_64 +compiler=clang +compiler.version=20 +compiler.libcxx=libstdc++11 +compiler.cppstd=20 +compiler.cstd=17 +compiler.runtime=static + +[conf] +tools.system.package_manager:mode=install +tools.system.package_manager:sudo=True + +tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} + +tools.info.package_id:confs=["tools.build:cflags$", "tools.build:cxxflags$", "tools.build:defines$", "tools.build:sharedlinkflags$", "tools.build:exelinkflags$", "tools.build:compiler_executables$", "tools.cmake.cmaketoolchain:user_toolchain$", "tools.meson.mesontoolchain:extra_machine_files$"] + +[tool_requires] +!cmake/*: cmake/4.3.2 diff --git a/generate_bigfoot.bat b/generate_bigfoot.bat index 0b627c0..6f83208 100644 --- a/generate_bigfoot.bat +++ b/generate_bigfoot.bat @@ -2,15 +2,113 @@ setlocal enabledelayedexpansion REM --- Validate argument --------------------------------------------------- -if "%~1"=="force" set "build_option=--build=*" & goto :start -if "%~1"=="missing" set "build_option=--build=missing" & goto :start +if "%~1"=="force" (set "build_option=--build=*" & goto :parseargs) +if "%~1"=="missing" (set "build_option=--build=missing" & goto :parseargs) -echo Usage: %~n0 [force^|missing] -echo force - Rebuild all packages from source -echo missing - Only build packages not already cached +call :usage exit /b 1 -:start +: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 ( @@ -25,19 +123,21 @@ if errorlevel 1 ( ) REM --- Shared flags ----------------------------------------------------------- -set "conan_common_base=--remote=bigfootpackages -pr:h=./ConanProfiles/host/msvc -pr:b=./ConanProfiles/build/msvc -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=True -o bigfoot/*:vulkan=True" +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 (Release RelWithDebInfo Debug) do ( +for %%C in (%build_types%) do ( echo. echo [%%C] Installing dependencies... - if "%%C"=="Release" set "config_profile=release" - if "%%C"=="RelWithDebInfo" set "config_profile=relwithdebinfo" - if "%%C"=="Debug" set "config_profile=debug" - for %%V in (toolmode game) do ( + 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 "%%V"=="toolmode" set "toolmode_val=True" - conan install . !conan_common_base! -of build-windows-%%V -o bigfoot/*:toolmode=!toolmode_val! %build_option% -pr:h=./ConanProfiles/Configurations/!config_profile! -pr:b=./ConanProfiles/Configurations/!config_profile! + 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 @@ -53,10 +153,13 @@ REM --- Activate build environment and run CMake ------------------------------- echo. echo Activating build environment and configuring CMake... -for %%V in (toolmode game) do ( +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 --graphviz=graphviz-windows-%%V/graph.dot; if ($LASTEXITCODE -ne 0) { Write-Host 'ERROR: CMake configuration failed'; exit 1 }" + 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 diff --git a/generate_bigfoot.sh b/generate_bigfoot.sh index e2139a9..3e402e8 100644 --- a/generate_bigfoot.sh +++ b/generate_bigfoot.sh @@ -1,44 +1,110 @@ #!/usr/bin/env bash set -euo pipefail -# ─── Validate arguments ─────────────────────────────────────────────────────── -if [[ $# -lt 1 ]]; then - echo "Usage: $(basename "$0") [force|missing] [Release|RelWithDebInfo|Debug]" - echo " force - Rebuild all packages from source" - echo " missing - Only build packages not already cached" +usage() { + echo "Usage: $(basename "$0") [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 under ./ConanProfiles/host (default: clang)" + echo " --build-profile= (optional) - Conan build profile under ./ConanProfiles/build" + echo " If omitted, it is derived from --profile: ./ConanProfiles/build/clang," + echo " or .../clang_asan when contains 'asan'" + 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)" +} + +# ─── Validate arguments ─────────────────────────────────────────────────────── +if [[ $# -lt 1 ]]; then + usage exit 1 fi -case "${1:-}" in +case "$1" in force) build_option="--build=*" ;; missing) build_option="--build=missing" ;; *) - echo "Usage: $(basename "$0") [force|missing] [Release|RelWithDebInfo|Debug]" - echo " force - Rebuild all packages from source" - echo " missing - Only build packages not already cached" + usage exit 1 ;; esac +shift -# ─── Validate optional build_type argument ──────────────────────────────────── -all_build_types=(Release RelWithDebInfo Debug) +profile_name="clang" +build_profile_arg="" +variant_arg="" +unity_val="" +tracy_val="True" +build_type_arg="" -if [[ -n "${2:-}" ]]; then - case "${2}" in +for arg in "$@"; do + case "$arg" in + --profile=*) + profile_name="${arg#--profile=}" + ;; + --build-profile=*) + build_profile_arg="${arg#--build-profile=}" + ;; + --variant=*) + variant_arg="${arg#--variant=}" + case "$variant_arg" in + toolmode|game) ;; + *) + echo "ERROR: Invalid variant '${variant_arg}'. Must be one of: toolmode, game" + exit 1 + ;; + esac + ;; + --unity=*) + unity_val="${arg#--unity=}" + case "$unity_val" in + ON|OFF) ;; + *) + echo "ERROR: Invalid value for --unity '${unity_val}'. Must be ON or OFF" + exit 1 + ;; + esac + ;; + --tracy=*) + tracy_val="${arg#--tracy=}" + case "$tracy_val" in + True|False) ;; + *) + echo "ERROR: Invalid value for --tracy '${tracy_val}'. Must be True or False" + exit 1 + ;; + esac + ;; Release|RelWithDebInfo|Debug) - build_types=("${2}") + if [[ -n "$build_type_arg" ]]; then + echo "ERROR: build type specified more than once" + exit 1 + fi + build_type_arg="$arg" ;; *) - echo "ERROR: Invalid build type '${2}'. Must be one of: Release, RelWithDebInfo, Debug" + echo "ERROR: Unrecognized argument '${arg}'" + usage exit 1 ;; esac +done + +all_build_types=(Release RelWithDebInfo Debug) +if [[ -n "$build_type_arg" ]]; then + build_types=("$build_type_arg") else build_types=("${all_build_types[@]}") fi +if [[ -n "$variant_arg" ]]; then + variants=("$variant_arg") +else + variants=(toolmode game) +fi + # ─── Register remote (skip if already registered) ───────────────────────────── if conan remote list 2>/dev/null | grep -qi "bigfootpackages"; then echo "Conan remote 'bigfootpackages' already registered, skipping." @@ -51,43 +117,48 @@ else fi # ─── Shared flags ───────────────────────────────────────────────────────────── -conan_common_toolmode=( +host_profile="./ConanProfiles/host/${profile_name}" +if [[ -n "$build_profile_arg" ]]; then + build_profile="./ConanProfiles/build/${build_profile_arg}" +else + build_profile="./ConanProfiles/build/clang" + if [[ "$profile_name" == *asan* ]]; then + build_profile="./ConanProfiles/build/clang_asan" + fi +fi + +conan_common_base=( --remote=bigfootpackages - -pr:h=./ConanProfiles/host/clang - -pr:b=./ConanProfiles/build/clang - -of build-linux-toolmode + -pr:h="${host_profile}" + -pr:b="${build_profile}" -o "bigfoot/*:build_tests=True" -o "bigfoot/*:build_benchmarks=True" - -o "bigfoot/*:tracy=True" + -o "bigfoot/*:tracy=${tracy_val}" -o "bigfoot/*:vulkan=True" - -o "bigfoot/*:toolmode=True" ) -conan_common_game=( - --remote=bigfootpackages - -pr:h=./ConanProfiles/host/clang - -pr:b=./ConanProfiles/build/clang - -of build-linux-game - -o "bigfoot/*:build_tests=True" - -o "bigfoot/*:build_benchmarks=True" - -o "bigfoot/*:tracy=True" - -o "bigfoot/*:vulkan=True" - -o "bigfoot/*:toolmode=False" -) - -# ─── Install dependencies for each build type ───────────────────────────────── +# ─── Install dependencies for each build type/variant ───────────────────────── for build_type in "${build_types[@]}"; do echo echo "[${build_type}] Installing dependencies..." - build_type_profile="./ConanProfiles/Configurations/${build_type,,}" - if ! conan install . "${conan_common_toolmode[@]}" ${build_option} -pr:h="${build_type_profile}" -pr:b="${build_type_profile}"; then - echo "ERROR: conan install failed for build type ${build_type}" - exit 1 - fi - if ! conan install . "${conan_common_game[@]}" ${build_option} -pr:h="${build_type_profile}" -pr:b="${build_type_profile}"; then - echo "ERROR: conan install failed for build type ${build_type}" - exit 1 + + config_profile="./ConanProfiles/Configurations/${build_type,,}" + if [[ "$profile_name" == *asan* && "$build_type" == "Release" ]]; then + config_profile="./ConanProfiles/Configurations/release_noipo" fi + + for variant in "${variants[@]}"; do + toolmode_val="False" + [[ "$variant" == "toolmode" ]] && toolmode_val="True" + + if ! conan install . "${conan_common_base[@]}" ${build_option} \ + -pr:h="${config_profile}" -pr:b="${config_profile}" \ + -o "bigfoot/*:toolmode=${toolmode_val}" \ + -of "build-linux-${variant}"; then + echo "ERROR: conan install failed for build type ${build_type} (${variant})" + exit 1 + fi + done echo "[${build_type}] Done." done @@ -98,11 +169,16 @@ echo "All build types installed successfully." echo echo "Configuring CMake for each build type..." +unity_args=() +if [[ -n "$unity_val" ]]; then + unity_args=(-DCMAKE_UNITY_BUILD="${unity_val}") +fi + for build_type in "${build_types[@]}"; do echo echo "[${build_type}] Activating build environment..." - for variant in toolmode game; do + for variant in "${variants[@]}"; do # shellcheck disable=SC1090 source "build-linux-${variant}/build/${build_type}/generators/conanbuild.sh" @@ -112,6 +188,7 @@ for build_type in "${build_types[@]}"; do if ! cmake -S . -B "build-linux-${variant}/${build_type}" \ --toolchain "build-linux-${variant}/build/${build_type}/generators/conan_toolchain.cmake" \ -DCMAKE_BUILD_TYPE="${build_type}" \ + "${unity_args[@]}" \ -G "Ninja" \ --graphviz="graphviz-linux-${variant}/${build_type}/graph.dot"; then echo "ERROR: CMake configuration failed for build type ${build_type} (${variant})." @@ -122,4 +199,4 @@ for build_type in "${build_types[@]}"; do done echo -echo "CMake configuration successful." \ No newline at end of file +echo "CMake configuration successful."