From 157feec05dbf888bfbfaabf8c4ae0cb366a7f9e8 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 21 Feb 2023 16:25:55 -0700 Subject: [PATCH] Simplify CI with CMake presets --- .github/workflows/ci.yml | 8 ++++---- CMakePresets.json | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5acaae77..648c7f51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: - name: Configure CMake 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 shell: bash @@ -206,8 +206,8 @@ jobs: if: matrix.platform.name != 'Android' shell: bash 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 --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.suffix}} + 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' }} format: name: Formatting @@ -272,7 +272,7 @@ jobs: - name: Configure 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 shell: bash diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..c47ab3c1 --- /dev/null +++ b/CMakePresets.json @@ -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" + } + } + ] +}