Simplify CI with CMake presets

This commit is contained in:
Chris Thrasher 2023-02-21 16:25:55 -07:00
parent 5c41a7c6bb
commit 157feec05d
2 changed files with 20 additions and 4 deletions

View File

@ -128,7 +128,7 @@ jobs:
- name: Configure CMake - name: Configure CMake
shell: bash shell: bash
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -DSFML_BUILD_EXAMPLES=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DSFML_BUILD_TEST_SUITE=TRUE ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}} run: cmake --preset dev -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
- name: Build - name: Build
shell: bash shell: bash
@ -206,8 +206,8 @@ jobs:
if: matrix.platform.name != 'Android' if: matrix.platform.name != 'Android'
shell: bash shell: bash
run: | run: |
cmake -S $GITHUB_WORKSPACE/test/install -B $GITHUB_WORKSPACE/test/install/build -DSFML_ROOT=$GITHUB_WORKSPACE/install -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}} cmake -S $GITHUB_WORKSPACE/test/install -B $GITHUB_WORKSPACE/test/install/build -DSFML_ROOT=$GITHUB_WORKSPACE/build/install -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
cmake --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.suffix}} cmake --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
format: format:
name: Formatting name: Formatting
@ -272,7 +272,7 @@ jobs:
- name: Configure - name: Configure
shell: bash shell: bash
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_UNITY_BUILD=ON -DSFML_BUILD_EXAMPLES=TRUE -DSFML_BUILD_TEST_SUITE=TRUE ${{matrix.platform.flags}} run: cmake --preset dev -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_UNITY_BUILD=ON ${{matrix.platform.flags}}
- name: Analyze Code - name: Analyze Code
shell: bash shell: bash

16
CMakePresets.json Normal file
View File

@ -0,0 +1,16 @@
{
"version": 3,
"configurePresets":[
{
"name": "dev",
"binaryDir": "build",
"installDir": "${sourceDir}/build/install",
"cacheVariables": {
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"SFML_BUILD_EXAMPLES": "ON",
"SFML_BUILD_TEST_SUITE": "ON"
}
}
]
}