From 5e6267daf9d195df6c1953d54b6395f9b8e4bac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Wasylk=C3=B3w?= Date: Sat, 13 Jan 2024 17:38:56 +0100 Subject: [PATCH] Set up build action --- .github/workflows/workflow.yml | 11 +++++---- CMakePresets.json | 41 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index b36ae5eb6..8298396a8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,11 +1,10 @@ name: libdispatch Windows clang + on: [push] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release - C_COMPILER: clang - CPP_COMPILER: clang++ jobs: build: @@ -16,18 +15,18 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1.4.1 - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=${{env.CPP_COMPILER}} -DCMAKE_C_COMPILER=${{env.C_COMPILER}} + run: cmake --preset windows-release - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + run: cmake --build ${{github.workspace}}\out\build\windows-release - name: Install - run: cmake --install ${{github.workspace}}/out --config ${{env.BUILD_TYPE}} + run: cmake --install ${{github.workspace}}\out\build\windows-release - name: Upload artifact windows-release-${{ steps.vars.outputs.sha_short }}.zip if: ${{ !env.ACT }} diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..d8ddbc4db --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,41 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "windows-release", + "displayName": "Windows x64 Release", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + }, + "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } + }, + { + "name": "windows-debug", + "displayName": "Windows x64 Debug", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + }, + "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } + } + ] +} \ No newline at end of file