Skip to content

Commit

Permalink
build: Add Windows CMake presets
Browse files Browse the repository at this point in the history
  • Loading branch information
oboukli committed Mar 3, 2024
1 parent 6eb9062 commit d459773
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/building-and-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ permissions: {}
jobs:
windows_vcpp:
name: Build and test on Windows with VC++
env:
preset_name: x64-debug
runs-on: windows-latest

steps:
Expand Down Expand Up @@ -51,14 +53,10 @@ jobs:
) }}
- name: Configure CMake
run: >-
cmake -B "${{ env.build_dir }}"
-DBUILD_SHARED_LIBS=TRUE
-DCMAKE_BUILD_TYPE="${{ env.config }}"
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE
run: cmake --preset "${{ env.preset_name }}"

- name: Build
run: cmake --build "${{ env.build_dir }}" --config "${{ env.config }}"
run: cmake --build --preset "${{ env.preset_name }}"
working-directory: ${{github.workspace}}

- name: Run tests
Expand All @@ -67,15 +65,15 @@ jobs:
--reporter console::out=-::colour-mode=ansi
--rng-seed 1654047489
--success
working-directory: ${{ env.build_dir }}\${{ env.config }}
working-directory: ${{github.workspace}}\out\build\${{ env.preset_name }}

- name: Run benchmarks
run: >-
.\benchmark.exe
--rng-seed 1654047489
--durations yes
--reporter console::out=-::colour-mode=ansi
working-directory: ${{ env.build_dir }}\${{ env.config }}
working-directory: ${{github.workspace}}\out\build\${{ env.preset_name }}

linux:
name: Build and test on Ubuntu
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.vs/
out/
vcpkg/
42 changes: 42 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"description": "Target Windows with the Visual Studio development environment.",
"hidden": true,
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": true
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
]
}

0 comments on commit d459773

Please sign in to comment.