From 4af978fdeb8c22b20302e6867e2d2747ef63c835 Mon Sep 17 00:00:00 2001 From: Romain BOULLARD Date: Mon, 27 Apr 2026 21:05:37 +0200 Subject: [PATCH] CI --- .gitea/workflows/ci.yml | 2 + .gitea/workflows/sonarqube.yml | 2 + ConanProfiles/Toolchains/ccache.cmake | 30 -------- ConanProfiles/Toolchains/mold.cmake | 9 +++ ConanProfiles/Tools/clang | 14 +--- ConanProfiles/Tools/msvc | 9 +-- ConanProfiles/clang | 14 ++-- ConanProfiles/clang_asan | 13 ++-- ConanProfiles/clang_coverage | 12 +-- ConanProfiles/msvc | 6 +- ConanProfiles/msvc_asan | 5 -- conanfile.py | 2 +- generate_bigfoot.sh | 106 +++++++++++++++++++++++++- generate_dependencies.sh | 45 ----------- 14 files changed, 135 insertions(+), 134 deletions(-) delete mode 100644 ConanProfiles/Toolchains/ccache.cmake create mode 100644 ConanProfiles/Toolchains/mold.cmake mode change 100644 => 100755 generate_bigfoot.sh delete mode 100644 generate_dependencies.sh diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6e360d1..c7dbc02 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -40,8 +40,10 @@ jobs: - name: Build run: | conan install . --remote=bigfootpackages -pr:h=${{ matrix.conan_profile }} -pr:b=./ConanProfiles/Tools/clang --build=* -s build_type=${{ matrix.build_type }} -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=False -o bigfoot/*:vulkan=True + . ./build/${{ matrix.build_type }}/generators/conanbuild.sh cmake -S . -B ./build/${{ matrix.build_type }} --toolchain ./build/${{ matrix.build_type }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_UNITY_BUILD=${{ matrix.unity_build }} -G "Ninja" cmake --build build/${{ matrix.build_type }} --parallel $(nproc) + . ./build/${{ matrix.build_type }}/generators/deactivate_conanbuild.sh - name: Show ccache stats run: ccache --show-stats diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml index b7132c6..de8b1a2 100644 --- a/.gitea/workflows/sonarqube.yml +++ b/.gitea/workflows/sonarqube.yml @@ -36,8 +36,10 @@ jobs: - name: Build run: | conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang_coverage -pr:b=./ConanProfiles/Tools/clang --build=* -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=False -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True + . ./build/Debug/generators/conanbuild.sh cmake -S . -B ./build/Debug --toolchain ./build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" cmake --build build/Debug --parallel $(nproc) + . ./build/Debug/generators/deactivate_conanbuild.sh - name: Show ccache stats run: ccache --show-stats diff --git a/ConanProfiles/Toolchains/ccache.cmake b/ConanProfiles/Toolchains/ccache.cmake deleted file mode 100644 index 5fce6ee..0000000 --- a/ConanProfiles/Toolchains/ccache.cmake +++ /dev/null @@ -1,30 +0,0 @@ -include_guard() - -# Find ccache executable -find_program(CCACHE_PROGRAM NAMES ccache) - -if(CCACHE_PROGRAM) - message(STATUS "ccache found: ${CCACHE_PROGRAM}, enabling via CMake launcher and environment.") - if (CMAKE_GENERATOR MATCHES "Visual Studio") - # Copy original ccache.exe and rename to cl.exe, this way intermediate cmd file is not needed - file(COPY_FILE ${CCACHE_PROGRAM} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT) - - # Set Visual Studio global variables: - # - Use above cl.exe (ccache.exe) as a compiler - # - Enable parallel compilation - list(APPEND CMAKE_VS_GLOBALS - "CLToolExe=cl.exe" - "CLToolPath=${CMAKE_BINARY_DIR}" - "UseMultiToolTask=true" - "UseStructuredOutput=false" - ) - elseif(CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Unix Makefiles") - message(STATUS "Using ccache as compiler launcher for Ninja or Makefiles.") - set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE FILEPATH "CXX compiler cache used" FORCE) - set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE FILEPATH "C compiler cache used" FORCE) - else() - message(WARNING "Unsupported generator for ccache integration: ${CMAKE_GENERATOR}. ccache will not be used.") - endif() -else() - message(WARNING "ccache not found. Not enabling ccache integration.") -endif() \ No newline at end of file diff --git a/ConanProfiles/Toolchains/mold.cmake b/ConanProfiles/Toolchains/mold.cmake new file mode 100644 index 0000000..8d48ddf --- /dev/null +++ b/ConanProfiles/Toolchains/mold.cmake @@ -0,0 +1,9 @@ +include_guard() + +find_program(MOLD_PROGRAM mold) +if (MOLD_PROGRAM) + set(CMAKE_LINKER_TYPE MOLD) + message(STATUS "mold linker found: ${MOLD_PROGRAM}") +else () + message(WARNING "mold linker not found") +endif () \ No newline at end of file diff --git a/ConanProfiles/Tools/clang b/ConanProfiles/Tools/clang index 45bd6b6..a840b7c 100644 --- a/ConanProfiles/Tools/clang +++ b/ConanProfiles/Tools/clang @@ -10,22 +10,10 @@ compiler.runtime=static build_type=Release [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/../Toolchains/ccache.cmake tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/../Toolchains/ipo.cmake tools.meson.mesontoolchain:extra_machine_files+={{profile_dir}}/../Toolchains/ipo.ini tools.system.package_manager:mode=install tools.system.package_manager:sudo=True -tools.build:exelinkflags=["-fuse-ld=mold"] -tools.build:sharedlinkflags=["-fuse-ld=mold"] - -tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} - -tools.cmake.cmaketoolchain:generator=Ninja - -[tool_requires] -!cmake/*: cmake/4.3.2 - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} \ No newline at end of file diff --git a/ConanProfiles/Tools/msvc b/ConanProfiles/Tools/msvc index ec09115..9485978 100644 --- a/ConanProfiles/Tools/msvc +++ b/ConanProfiles/Tools/msvc @@ -9,17 +9,10 @@ compiler.runtime=static build_type=Release [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/../Toolchains/ccache.cmake tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/../Toolchains/ipo.cmake tools.meson.mesontoolchain:extra_machine_files+={{profile_dir}}/../Toolchains/ipo.ini tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1"] tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope"] -tools.env.virtualenv:powershell=powershell.exe - -[tool_requires] -!cmake/*: cmake/4.3.2 - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +tools.env.virtualenv:powershell=powershell.exe \ No newline at end of file diff --git a/ConanProfiles/clang b/ConanProfiles/clang index bd370f2..99256b0 100644 --- a/ConanProfiles/clang +++ b/ConanProfiles/clang @@ -10,16 +10,13 @@ compiler.runtime=static build_type=Release [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake +tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/mold.cmake tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ipo.cmake tools.meson.mesontoolchain:extra_machine_files+={{profile_dir}}/Toolchains/ipo.ini tools.system.package_manager:mode=install tools.system.package_manager:sudo=True -tools.build:exelinkflags=["-fuse-ld=mold"] -tools.build:sharedlinkflags=["-fuse-ld=mold"] - tools.build:cxxflags=["-fno-exceptions", "-fno-rtti"] tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} @@ -27,10 +24,9 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} tools.cmake.cmaketoolchain:generator=Ninja [tool_requires] -!cmake/*: cmake/4.3.2 +!cmake/*:cmake/4.3.2 +!mold/*:mold/2.41.0@bigfootdev/main +!ninja/*:ninja/1.13.2 [options] -bigfoot/*:build_tests=True - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +bigfoot/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/clang_asan b/ConanProfiles/clang_asan index 2bedb0d..b607aeb 100644 --- a/ConanProfiles/clang_asan +++ b/ConanProfiles/clang_asan @@ -10,13 +10,13 @@ compiler.runtime=static build_type=Debug [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake +tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/mold.cmake tools.system.package_manager:mode=install tools.system.package_manager:sudo=True -tools.build:exelinkflags=["-fuse-ld=mold", "-fsanitize=address,undefined,leak"] -tools.build:sharedlinkflags=["-fuse-ld=mold", "-fsanitize=address,undefined,leak"] +tools.build:exelinkflags=[-fsanitize=address,undefined,leak"] +tools.build:sharedlinkflags=["-fsanitize=address,undefined,leak"] tools.build:cflags=["-fsanitize=address,undefined,leak", "-fno-sanitize-recover=all"] tools.build:cxxflags=["-fno-exceptions", "-fno-rtti", "-fsanitize=address,undefined,leak", "-fno-sanitize-recover=all"] @@ -27,10 +27,9 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} [tool_requires] !cmake/*: cmake/4.3.2 +!mold/*: mold/2.41.0@bigfootdev/main +!ninja/*: ninja/1.13.2 [options] bigfoot/*:asan=True -bigfoot/*:build_tests=True - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +bigfoot/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/clang_coverage b/ConanProfiles/clang_coverage index 7e86b66..0ee4944 100644 --- a/ConanProfiles/clang_coverage +++ b/ConanProfiles/clang_coverage @@ -10,14 +10,11 @@ compiler.runtime=static build_type=Debug [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake +tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/mold.cmake tools.system.package_manager:mode=install tools.system.package_manager:sudo=True -tools.build:exelinkflags=["-fuse-ld=mold"] -tools.build:sharedlinkflags=["-fuse-ld=mold"] - tools.build:cxxflags=["-fno-exceptions", "-fno-rtti"] tools.cmake.cmaketoolchain:generator=Ninja @@ -26,10 +23,9 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} [tool_requires] !cmake/*: cmake/4.3.2 +!mold/*: mold/2.41.0@bigfootdev/main +!ninja/*: ninja/1.13.2 [options] bigfoot/*:build_tests=True -bigfoot/*:coverage=True - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +bigfoot/*:coverage=True \ No newline at end of file diff --git a/ConanProfiles/msvc b/ConanProfiles/msvc index c0076f3..1a1111c 100644 --- a/ConanProfiles/msvc +++ b/ConanProfiles/msvc @@ -9,7 +9,6 @@ compiler.runtime=static build_type=Release [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ipo.cmake tools.meson.mesontoolchain:extra_machine_files+={{profile_dir}}/Toolchains/ipo.ini @@ -24,7 +23,4 @@ tools.env.virtualenv:powershell=powershell.exe !cmake/*: cmake/4.3.2 [options] -bigfoot/*:build_tests=True - -[buildenv] -CCACHE_NOHASHDIR=1 \ No newline at end of file +bigfoot/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/msvc_asan b/ConanProfiles/msvc_asan index 6af525a..dc8b37c 100644 --- a/ConanProfiles/msvc_asan +++ b/ConanProfiles/msvc_asan @@ -9,8 +9,6 @@ compiler.runtime=static build_type=Debug [conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake - tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1", "/fsanitize=address"] tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/EHs-c-", "/GR-", "/fsanitize=address"] @@ -24,6 +22,3 @@ tools.env.virtualenv:powershell=powershell.exe [options] bigfoot/*:asan=True bigfoot/*:build_tests=True - -[buildenv] -CCACHE_NOHASHDIR=1 diff --git a/conanfile.py b/conanfile.py index bb13aef..2581b0e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -61,7 +61,7 @@ class Bigfoot(ConanFile): def requirements(self): self.requires("eastl/3.27.01@bigfootdev/main", transitive_headers=True) self.requires("unordered_dense/4.8.1@bigfootdev/main", transitive_headers=True) - self.requires("mimalloc/3.2.8@bigfootdev/main", transitive_headers=True) + self.requires("mimalloc/3.3.1@bigfootdev/main", transitive_headers=True) self.requires("stduuid/1.2.3@bigfootdev/main", transitive_headers=True) self.requires("sqlite3/3.51.2@bigfootdev/main", transitive_headers=True) self.requires("rapidhash/3.0@bigfootdev/main", transitive_headers=True) diff --git a/generate_bigfoot.sh b/generate_bigfoot.sh old mode 100644 new mode 100755 index 1b72527..7054f1c --- a/generate_bigfoot.sh +++ b/generate_bigfoot.sh @@ -1,3 +1,103 @@ -cmake -S . -B build/Debug --toolchain build/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="Debug" -G "Ninja" --graphviz=graphviz/Debug/graph.dot -cmake -S . -B build/Release --toolchain build/build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="Release" -G "Ninja" --graphviz=graphviz/Release/graph.dot -cmake -S . -B build/RelWithDebInfo --toolchain build/build/RelWithDebInfo/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="RelWithDebInfo" -G "Ninja" --graphviz=graphviz/RelWithDebInfo/graph.dot \ No newline at end of file +#!/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" + echo " build_type (optional) - One of: Release, RelWithDebInfo, Debug" + echo " If omitted, all build types are processed" + exit 1 +fi + +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" + exit 1 + ;; +esac + +# ─── Validate optional build_type argument ──────────────────────────────────── +all_build_types=(Release RelWithDebInfo Debug) + +if [[ -n "${2:-}" ]]; then + case "${2}" in + Release|RelWithDebInfo|Debug) + build_types=("${2}") + ;; + *) + echo "ERROR: Invalid build type '${2}'. Must be one of: Release, RelWithDebInfo, Debug" + exit 1 + ;; + esac +else + build_types=("${all_build_types[@]}") +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." +else + echo "Adding Conan remote: bigfootpackages" + if ! conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages; then + echo "ERROR: Failed to add Conan remote." + exit 1 + fi +fi + +# ─── Shared flags ───────────────────────────────────────────────────────────── +conan_common=( + --remote=bigfootpackages + -pr:h=./ConanProfiles/clang + -pr:b=./ConanProfiles/Tools/clang + -of build + -o "bigfoot/*:build_tests=True" + -o "bigfoot/*:tracy=True" + -o "bigfoot/*:vulkan=True" +) + +# ─── Install dependencies for each build type ───────────────────────────────── +for build_type in "${build_types[@]}"; do + echo + echo "[${build_type}] Installing dependencies..." + if ! conan install . "${conan_common[@]}" ${build_option} -s:h "build_type=${build_type}"; then + echo "ERROR: conan install failed for build type ${build_type}" + exit 1 + fi + echo "[${build_type}] Done." +done + +echo +echo "All build types installed successfully." + +# ─── Configure CMake for each build type ───────────────────────────────────── +echo +echo "Configuring CMake for each build type..." + +for build_type in "${build_types[@]}"; do + echo + echo "[${build_type}] Activating build environment..." + # shellcheck disable=SC1090 + source "build/build/${build_type}/generators/conanbuild.sh" + + mkdir -p "graphviz/${build_type}" + + echo "[${build_type}] Running CMake..." + if ! cmake -S . -B "build/${build_type}" \ + --toolchain "build/build/${build_type}/generators/conan_toolchain.cmake" \ + -DCMAKE_BUILD_TYPE="${build_type}" \ + -G "Ninja" \ + --graphviz="graphviz/${build_type}/graph.dot"; then + echo "ERROR: CMake configuration failed for build type ${build_type}." + exit 1 + fi + echo "[${build_type}] Done." +done + +echo +echo "CMake configuration successful." \ No newline at end of file diff --git a/generate_dependencies.sh b/generate_dependencies.sh deleted file mode 100644 index bb82439..0000000 --- a/generate_dependencies.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# ─── Validate argument ─────────────────────────────────────────────────────── -usage() { - echo "Usage: $0 [force|missing]" - echo " force - Rebuild all packages from source" - echo " missing - Only build packages not already cached" - exit 1 -} - -if [ -z "$1" ]; then - usage -elif [ "$1" == "force" ]; then - build_option="--build=*" -elif [ "$1" == "missing" ]; then - build_option="--build=missing" -else - echo "Invalid argument: $1" - usage -fi - -# ─── Register remote (skip if already registered) ──────────────────────────── -if ! conan remote list | grep -qi "bigfootpackages"; then - echo "Adding Conan remote: bigfootpackages" - conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages || exit 1 -else - echo "Conan remote 'bigfootpackages' already registered, skipping." -fi - -# ─── Shared flags ──────────────────────────────────────────────────────────── -conan_common="--remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/Tools/clang -of build -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:vulkan=True" - -# ─── Install dependencies for each build type ──────────────────────────────── -for build_type in Release RelWithDebInfo Debug; do - echo "" - echo "[$build_type] Installing dependencies..." - conan install . $conan_common $build_option -s build_type=$build_type || { - echo "ERROR: conan install failed for build type $build_type" - exit 1 - } - echo "[$build_type] Done." -done - -echo "" -echo "All build types installed successfully." \ No newline at end of file