Skip to content

Commit 8cc49f8

Browse files
committed
Use Ninja in CI, enable CMAKE_EXPORT_COMPILE_COMMANDS by default
1 parent e580bb5 commit 8cc49f8

2 files changed

Lines changed: 32 additions & 24 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm]
12+
os: [windows-2025, ubuntu-latest, ubuntu-24.04-arm]
1313
include:
14-
- os: windows-latest
14+
- os: windows-2025
1515
name: win64
16-
target: ALL_BUILD
17-
release_dir: Release # dir of driver binaries within env.CMAKE_BUILD_DIR, VS multi-config uses <CONFIG>/ subfolder
1816
- os: ubuntu-latest
1917
name: x64-linux
20-
target: all
21-
release_dir: "" # makefile single config won't have subfolder
2218
- os: ubuntu-24.04-arm
2319
name: aarch64-linux
24-
target: all
25-
release_dir: "" # makefile single config won't have subfolder
2620
env:
2721
# Indicates the CMake build directory where project files and binaries are being produced.
2822
CMAKE_BUILD_DIR: ${{ github.workspace }}/build
@@ -32,31 +26,47 @@ jobs:
3226
with:
3327
submodules: true
3428

29+
- if: matrix.os == 'ubuntu-latest'
30+
name: Install Ninja
31+
uses: awalsh128/cache-apt-pkgs-action@v1.6.0
32+
with:
33+
add-repository: 'ppa:ubuntu-toolchain-r/test'
34+
packages: ninja-build
35+
version: 1.0
36+
3537
- uses: lukka/get-cmake@latest
3638

3739
- uses: hendrikmuhs/ccache-action@v1.2
3840

3941
- name: Get submodule commit hashes
4042
id: submodule_hashes
4143
run: git submodule foreach --recursive git rev-parse HEAD > submodule_hashes.txt
42-
43-
- name: Configure CMake
44-
run: cmake -S "${{github.workspace}}" -B "${{env.CMAKE_BUILD_DIR}}" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DSLIMEVR_BUILD_TESTS=ON
45-
46-
- name: Build
47-
run: cmake --build "${{env.CMAKE_BUILD_DIR}}" --config Release --target "${{ matrix.target }}" -j 6 --
44+
45+
- if: matrix.os == 'windows-2025'
46+
name: Configure and build on Windows
47+
shell: cmd
48+
run: |
49+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
50+
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DSLIMEVR_BUILD_TESTS=ON
51+
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config Release -j 6 --
52+
53+
- if: matrix.os != 'windows-2025'
54+
name: Configure and build on Unix
55+
run: |
56+
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DSLIMEVR_BUILD_TESTS=ON
57+
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config Release -j 6 --
4858
4959
- name: Upload driver
5060
uses: actions/upload-artifact@v7
5161
with:
5262
name: slimevr-openvr-driver-${{ matrix.name }}
53-
path: ${{ env.CMAKE_BUILD_DIR }}/${{ matrix.release_dir }}/driver
63+
path: ${{ env.CMAKE_BUILD_DIR }}/driver
5464

5565
- name: Upload tests
5666
uses: actions/upload-artifact@v7
5767
with:
5868
name: tests-${{ matrix.name }}
59-
path: ${{ env.CMAKE_BUILD_DIR }}/${{ matrix.release_dir }}/tests*
69+
path: ${{ env.CMAKE_BUILD_DIR }}/tests*
6070

6171
test:
6272
name: Run tests (${{ matrix.os }})
@@ -65,28 +75,25 @@ jobs:
6575
strategy:
6676
fail-fast: false
6777
matrix:
68-
os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm]
78+
os: [windows-2025, ubuntu-latest, ubuntu-24.04-arm]
6979
include:
70-
- os: windows-latest
80+
- os: windows-2025
7181
name: win64
72-
target: ALL_BUILD
7382
- os: ubuntu-latest
7483
name: x64-linux
75-
target: all
7684
- os: ubuntu-24.04-arm
7785
name: aarch64-linux
78-
target: all
7986
steps:
8087
- name: Download build artifact
8188
uses: actions/download-artifact@v8
8289
with:
8390
name: tests-${{ matrix.name }}
8491
path: ${{ github.workspace }}
85-
- if: matrix.os == 'windows-latest'
92+
- if: matrix.os == 'windows-2025'
8693
name: Run tests on Windows
8794
working-directory: ${{ github.workspace }}/
8895
run: .\tests.exe
89-
- if: matrix.os != 'windows-latest'
96+
- if: matrix.os != 'windows-2025'
9097
name: Run tests on Unix
9198
working-directory: ${{ github.workspace }}/
9299
run: chmod +x ./tests && ./tests

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ cmake_minimum_required(VERSION 3.19)
33
# PIE is required
44
include(CheckPIESupported)
55
check_pie_supported()
6-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
76

7+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
88
set(CMAKE_CXX_STANDARD 20)
9+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
910

1011
project(SlimeVR-OpenVR-Driver VERSION 0.2.0)
1112
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

0 commit comments

Comments
 (0)