diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf57e5fc..c96af8fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,22 +176,19 @@ jobs: - name: Create build directory run: cmake -E make_directory build - name: Run CMake (for Windows) - working-directory: build - run: cmake -G "Ninja" -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake -DUSE_STATIC_RUNTIME=1 -DCBOT_STATIC=1 -DBOOST_STATIC=1 -DGLEW_STATIC=1 -DSNDFILE_STATIC=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\build\install -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 .. + run: cmake --preset Windows-CI -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake - name: Build - working-directory: build run: | $nproc = (Get-CIMInstance -Class 'CIM_Processor').NumberOfLogicalProcessors - cmake --build . -j $nproc + cmake --build --preset Windows-CI -j $nproc shell: pwsh - name: Install - working-directory: build - run: cmake --install . + run: cmake --build --preset Windows-CI --target install - name: Upload build uses: actions/upload-artifact@v2 with: name: windows-msvc-debug-${{ matrix.arch }} - path: build/install + path: install - name: Run tests working-directory: build run: ./colobot_ut --gtest_output=xml:gtestresults.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 767544df..0e56b813 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # Contains global options and definitions ## -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.21) project(colobot VERSION 0.2.1.0 diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..59af9ea3 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,45 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "CI", + "description": "Base configuration for CI pipeline", + "hidden": true, + "binaryDir": "${sourceDir}/build", + "installDir": "${sourceDir}/install" + }, + { + "name": "Windows-CI", + "description": "Windows configuration for CI pipeline", + "generator": "Ninja", + "inherits": ["CI"], + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "USE_STATIC_RUNTIME": true, + "CBOT_STATIC": true, + "BOOST_STATIC": true, + "GLEW_STATIC": true, + "SNDFILE_STATIC": true, + "DEV_BUILD": true, + "PORTABLE": true, + "TOOLS": true, + "TESTS": true, + "DESKTOP": true + } + } + ], + "buildPresets": [ + { + "name": "Windows-CI", + "configurePreset": "Windows-CI", + "configuration": "RelWithDebInfo" + } + ] +}