diff --git a/.github/workflows/build-windows-vcpkg.yaml b/.github/workflows/build-windows-vcpkg.yaml new file mode 100644 index 00000000..0e93a39d --- /dev/null +++ b/.github/workflows/build-windows-vcpkg.yaml @@ -0,0 +1,57 @@ +# Copyright (c) 2019-2020-2021-2022 Luca Cappa +# Released under the term specified in file LICENSE.txt +# SPDX short identifier: MIT +# +# Source: https://raw.githubusercontent.com/lukka/CppBuildTasks-Validation/v10/.github/workflows/hosted-ninja-vcpkg_submod-autocache.yml +name: Build on Windows with VCPKG +on: [push, workflow_dispatch] + +jobs: + job: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [windows-latest] + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + # This is useful to avoid https://github.com/microsoft/vcpkg/issues/25349 + # which is caused by missing Git history on the vcpkg submodule which ports + # try to access. + fetch-depth: 0 + + - uses: lukka/get-cmake@latest + - name: List $RUNNER_WORKSPACE before vcpkg is setup + run: find $RUNNER_WORKSPACE + shell: bash + + - name: Restore vcpkg executable and data files from GH Action cache, or setup vcpkg from scratch if there is a cache-miss + uses: lukka/run-vcpkg@v11 + id: runvcpkg + with: + # This one is not needed, as it is the default value anyway. + # vcpkgDirectory: '${{ github.workspace }}/vcpkg' + vcpkgJsonGlob: 'vcpkg.json' + # Leverage the cache containing vcpkg executable and data files (e.g. port files). + doNotCache: false + + - name: List $RUNNER_WORKSPACE before build + run: find $RUNNER_WORKSPACE + shell: bash + - name: Prints output of run-vcpkg's action. + run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " + - name: Run CMake+vcpkg+Ninja + uses: lukka/run-cmake@v10 + id: runcmake + with: + cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' + configurePreset: 'windows-release' + buildPreset: 'windows-release' + #packagePreset: 'windows-release' + - name: List $RUNNER_WORKSPACE after build + run: find $RUNNER_WORKSPACE + shell: bash \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a0a57f3d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..93a321f0 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,63 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "debug", + "displayName": "Debug build settings", + "binaryDir": "${sourceDir}/build/debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "release", + "displayName": "Release build settings", + "binaryDir": "${sourceDir}/build/release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "windows", + "displayName": "Windows build vcpkg & ninja settings", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "./vcpkg/scripts/buildsystems/vcpkg.cmake", + "VCPKG_TARGET_TRIPLET": "x64-windows" + } + }, + { + "name": "windows-release", + "displayName": "Windows release build", + "inherits": [ + "release", + "windows" + ] + }, + { + "name": "windows-debug", + "displayName": "Windows debug build", + "inherits": [ + "debug", + "windows" + ] + } + ], + "buildPresets": [ + { + "name": "windows-release", + "displayName": "Windows release build", + "configurePreset": "windows-release" + }, + { + "name": "windows-debug", + "displayName": "Windows debug build", + "configurePreset": "windows-debug" + } + ] +} \ No newline at end of file diff --git a/vcpkg b/vcpkg new file mode 160000 index 00000000..b0d9d516 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit b0d9d516272c599145009c4c28b779a678fc97f8