Mold/Ninja through conan

This commit is contained in:
2026-04-26 22:16:42 +02:00
parent 3fbb05a9bb
commit 742af1ae59
20 changed files with 205 additions and 151 deletions

View File

@@ -1,3 +1,74 @@
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
#!/usr/bin/env bash
set -euo pipefail
# ─── Validate argument ────────────────────────────────────────────────────────
case "${1:-}" in
force) build_option="--build=*" ;;
missing) build_option="--build=missing" ;;
*)
echo "Usage: $(basename "$0") [force|missing]"
echo " force - Rebuild all packages from source"
echo " missing - Only build packages not already cached"
exit 1
;;
esac
# ─── 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
)
# ─── Install dependencies for each build type ─────────────────────────────────
for build_type in Release RelWithDebInfo Debug; 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 Release RelWithDebInfo Debug; 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."