diff --git a/.github/workflows/unix.yml b/.github/workflows/unix.yml index 4817a5f..855cde8 100644 --- a/.github/workflows/unix.yml +++ b/.github/workflows/unix.yml @@ -55,60 +55,29 @@ jobs: matrix: config: - name: macOS x86_64 Release - cxx: clang++ - cc: clang - mode: Release - mimalloc: on - cxxflags: -stdlib=libc++ os: macos-13 + preset: clang-release artifact: macos-x86_64 - name: macOS arm64 Release - cxx: clang++ - cc: clang - mode: Release - mimalloc: on - cxxflags: -stdlib=libc++ os: macos-14 + preset: clang-release artifact: macos-arm64 - name: GCC ${{ needs.env-vars.outputs.GCC_VERSION }} Release - cxx: g++-${{ needs.env-vars.outputs.GCC_VERSION }} - cc: gcc-${{ needs.env-vars.outputs.GCC_VERSION }} - mode: Release - mimalloc: on os: ubuntu-latest - artifact: linux + preset: gcc-${{ needs.env-vars.outputs.GCC_VERSION }}-release + artifact: linux-amd64 - name: GCC ${{ needs.env-vars.outputs.GCC_VERSION }} Debug - cxx: g++-${{ needs.env-vars.outputs.GCC_VERSION }} - cc: gcc-${{ needs.env-vars.outputs.GCC_VERSION }} - mode: Debug - mimalloc: on os: ubuntu-latest + preset: gcc-${{ needs.env-vars.outputs.GCC_VERSION }}-debug - name: Clang ${{ needs.env-vars.outputs.LLVM_VERSION }} Release - cxx: clang++-${{ needs.env-vars.outputs.LLVM_VERSION }} - cc: clang-${{ needs.env-vars.outputs.LLVM_VERSION }} - mode: Release - mimalloc: on - cxxflags: -stdlib=libc++ - ldflags: -lc++abi os: ubuntu-latest + preset: clang-${{ needs.env-vars.outputs.LLVM_VERSION }}-release - name: Clang Tidy - cxx: clang++-${{ needs.env-vars.outputs.LLVM_VERSION }} - cc: clang-${{ needs.env-vars.outputs.LLVM_VERSION }} - mode: Release - mimalloc: on - cxxflags: -stdlib=libc++ - ldflags: -lc++abi - lint: true os: ubuntu-latest - # - key: Clang ${{ needs.env-vars.outputs.LLVM_VERSION }} Sanitizer - # cxx: clang++-${{ needs.env-vars.outputs.LLVM_VERSION }} - # cc: clang-${{ needs.env-vars.outputs.LLVM_VERSION }} - # mode: Release - # mimalloc: on - # cflags: -fsanitize=address,undefined -fno-omit-frame-pointer - # cxxflags: -fsanitize=address,undefined -fno-omit-frame-pointer -stdlib=libc++ - # ldflags: -lc++abi - # os: ubuntu-latest + preset: clang-${{ needs.env-vars.outputs.LLVM_VERSION }}-tidy + - key: Clang ${{ needs.env-vars.outputs.LLVM_VERSION }} Sanitizer + os: ubuntu-latest + preset: clang-${{ needs.env-vars.outputs.LLVM_VERSION }}-sanitizer env: BUILDCACHE_COMPRESS: true BUILDCACHE_DIRECT_MODE: true @@ -172,17 +141,7 @@ jobs: # ==== BUILD ==== - name: CMake - run: | - cmake \ - -G Ninja -S . -B build \ - -DCMAKE_C_COMPILER=${{ matrix.config.cc }} \ - -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \ - -DCMAKE_C_FLAGS="${{ matrix.config.cflags }}" \ - -DCMAKE_CXX_FLAGS="${{ matrix.config.cxxflags }}" \ - -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.config.ldflags }}" \ - -DCMAKE_BUILD_TYPE=${{ matrix.config.mode }} \ - -DPPR_LINT=${{ matrix.config.lint }} \ - -DPPR_MIMALLOC=${{ matrix.config.mimalloc }} + run: cmake -S . -B build --preset=${{ matrix.config.preset }} - name: Build run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index feac23a..d1b9889 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -59,14 +59,19 @@ jobs: restore-keys: deps- # ==== BUILD ==== - - name: Build + - name: Setup VS Dev SHell run: | $devShell = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find **\Microsoft.VisualStudio.DevShell.dll $installPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationpath Import-Module $devShell Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments "-arch=amd64" Get-ChildItem env: - cmake -GNinja -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DPPR_DEBUG_SYMBOLS=OFF -DPPR_MIMALLOC=ON + + - name: CMake + run: cmake -S . -B build --preset=${{ matrix.config.preset }} + + - name: Build + run: | .\build\buildcache\bin\buildcache.exe -z cmake --build build --target ppr-preprocess ppr-backend footrouting ppr-benchmark ppr-test $CompilerExitCode = $LastExitCode diff --git a/CMakePresets.json b/CMakePresets.json index a29ee91..a5a6554 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,90 +10,163 @@ "name": "base-preset", "hidden": true, "generator": "Ninja", - "binaryDir": "${sourceDir}/build/${presetName}" + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "PPR_MIMALLOC": true + } }, { "name": "clang-preset", "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-lc++abi" + } + }, + { + "name": "clang-16-preset", + "hidden": true, "cacheVariables": { "CMAKE_C_COMPILER": "clang-16", - "CMAKE_CXX_COMPILER": "clang++-16" + "CMAKE_CXX_COMPILER": "clang++-16", + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-lc++abi" } }, { - "name": "gcc-preset", + "name": "gcc-12-preset", "hidden": true, "cacheVariables": { "CMAKE_C_COMPILER": "gcc-12", "CMAKE_CXX_COMPILER": "g++-12" } }, + { + "name": "msvc-preset", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, { "name": "clang-release", - "displayName": "Linux AMD64 clang Release", + "displayName": "Clang Release", "inherits": [ - "base-preset", - "clang-preset" + "clang-preset", + "base-preset" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "clang-debug", - "displayName": "Linux AMD64 clang Debug", + "name": "clang-16-release", + "displayName": "Clang 16 Release", "inherits": [ - "base-preset", - "clang-preset" + "clang-16-preset", + "base-preset" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "clang-16-debug", + "displayName": "Clang 16 Debug", + "inherits": [ + "clang-16-preset", + "base-preset" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "clang-tidy", - "displayName": "Clang Tidy", + "name": "clang-16-tidy", + "displayName": "Clang 16 Tidy", "inherits": [ - "base-preset", - "clang-preset" + "clang-16-preset", + "base-preset" ], "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "PPR_LINT": "ON" + "CMAKE_BUILD_TYPE": "Release", + "PPR_LINT": true } }, { - "name": "gcc-release", - "displayName": "Linux AMD64 GCC Release", + "name": "clang-16-sanitizer", + "displayName": "Clang 16 Sanitizer", "inherits": [ - "base-preset", - "gcc-preset" + "clang-16-preset", + "base-preset" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_C_FLAGS": "-fsanitize=address,undefined -fno-omit-frame-pointer", + "CMAKE_CXX_FLAGS": "-fsanitize=address,undefined -fno-omit-frame-pointer -stdlib=libc++", + "MI_TRACK_ASAN": true + } + }, + { + "name": "gcc-12-release", + "displayName": "GCC 12 Release", + "inherits": [ + "gcc-12-preset", + "base-preset" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "gcc-debug", - "displayName": "Linux AMD64 GCC Debug", + "name": "gcc-12-debug", + "displayName": "GCC 12 Debug", "inherits": [ - "base-preset", - "gcc-preset" + "gcc-12-preset", + "base-preset" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "gcc-relwithdebinfo", - "displayName": "Linux AMD64 GCC RelWithDebInfo", + "name": "gcc-12-relwithdebinfo", + "displayName": "GCC 12 RelWithDebInfo", "inherits": [ - "base-preset", - "gcc-preset" + "gcc-12-preset", + "base-preset" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } + }, + { + "name": "msvc-release", + "displayName": "MSVC Release", + "inherits": [ + "msvc-preset", + "base-preset" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "PPR_DEBUG_SYMBOLS": false + } + }, + { + "name": "msvc-debug", + "displayName": "MSVC Debug", + "inherits": [ + "msvc-preset", + "base-preset" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "PPR_DEBUG_SYMBOLS": true + } } ] -} \ No newline at end of file +} diff --git a/ubuntu.Dockerfile b/ubuntu.Dockerfile index 5a8c01e..2fd24fe 100644 --- a/ubuntu.Dockerfile +++ b/ubuntu.Dockerfile @@ -36,12 +36,8 @@ ENV GITHUB_ACTIONS=true RUN mkdir /build \ && cmake \ -GNinja -S /src -B /build \ - -DCMAKE_C_COMPILER=/usr/bin/clang-16 \ - -DCMAKE_CXX_COMPILER=/usr/bin/clang++-16 \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ - -DCMAKE_BUILD_TYPE=Release \ + --preset=clang-16-release \ -DNO_BUILDCACHE=ON \ - -DPPR_MIMALLOC=ON \ && cmake \ --build /build \ --target ppr-preprocess ppr-backend footrouting \