Fixed windows compile showstopper #288
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows Build | |
on: [push] | |
env: | |
# Path to the solution file relative to the root of the project. | |
# -G "Visual Studio 16 2019" | |
SOLUTION_FILE_PATH: . | |
VSCP_PATH: ${{github.workspace}}/third_party/vscp | |
#ENVIRONMENT_SCRIPT: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
GENERATORS: "Visual Studio 17 2022" | |
BUILD_CONFIGURATION: Release | |
TRIPLET: x64-windows | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
# | |
# https://github.com/marketplace/actions/run-vcpkg | |
# https://github.com/ilammy/msvc-dev-cmd | |
jobs: | |
build: | |
name: Windows x64 | |
runs-on: windows-latest | |
steps: | |
- name: Install ms-dev environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64_x86 | |
toolset: 14.0 | |
# https://ddalcino.github.io/aqt-list-server/ | |
- name: Prepare Qt Libraries | |
# uses: Kidev/[email protected] | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.8.1' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2022_64' | |
modules: 'qtcharts qtconnectivity qtserialbus qtserialport' | |
cache: 'true' | |
cache-key-prefix: 'install-qt-action' | |
setup-python: 'true' | |
set-env: 'true' | |
tools-only: 'false' | |
aqtversion: '==3.1.*' | |
py7zrversion: '==0.20.*' | |
extra: '--external 7z' | |
- name: Clone | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# Install latest CMake. | |
- name: Get latest CMake and ninja | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: 'latest' | |
ninjaVersion: 'latest' | |
# Setup vcpkg: ensures vcpkg is downloaded and built. | |
# Since vcpkg.json is being used later on to install the packages | |
# when `run-cmake` runs, no packages are installed at this time | |
# (and vcpkg does not run). | |
- name: Setup anew (or from cache) vcpkg (and does not build any package) | |
uses: lukka/run-vcpkg@v11 | |
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages | |
uses: lukka/run-cmake@v10 | |
with: | |
# This is the default path to the CMakeLists.txt along side the | |
# CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json | |
# located elsewhere. | |
# cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' | |
# You could use CMake workflow presets defined in the CMakePresets.json | |
# with just this line below. Note this one cannot be used with any other | |
# preset input, it is mutually exclusive. | |
# workflowPreset: 'workflow-name' | |
# This is the name of the CMakePresets.json's configuration to use to generate | |
# the project files. This configuration leverages the vcpkg.cmake toolchain file to | |
# run vcpkg and install all dependencies specified in vcpkg.json. | |
configurePreset: 'ninja-multi-vcpkg' | |
# Additional arguments can be appended to the cmake command. | |
# This is useful to reduce the number of CMake's Presets since you can reuse | |
# an existing preset with different variables. | |
configurePresetAdditionalArgs: "['-DENABLE_YOUR_FEATURE=1']" | |
# This is the name of the CMakePresets.json's configuration to build the project. | |
buildPreset: 'ninja-multi-vcpkg' | |
# Additional arguments can be appended when building, for example to specify the | |
# configuration to build. | |
# This is useful to reduce the number of CMake's Presets you need in CMakePresets.json. | |
buildPresetAdditionalArgs: "['--config Release']" | |
# This is the name of the CMakePresets.json's configuration to test the project with. | |
testPreset: 'ninja-multi-vcpkg' | |
# Additional arguments can be appended when testing, for example to specify the config | |
# to test. | |
# This is useful to reduce the number of CMake's Presets you need in CMakePresets.json. | |
testPresetAdditionalArgs: "['--config Release']" | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
- name: Install 7Zip PowerShell Module | |
shell: powershell | |
run: Install-Module 7Zip4PowerShell -Force -Verbose | |
- name: Integrate with development environment and install | |
shell: cmd | |
working-directory: ${{github.workspace}}/vcpkg/ | |
run: | | |
'ls ${{github.workspace}}/vcpkg/' | |
'call ${{github.workspace}}/vcpkg/vcpkg.exe/bootstrap-vcpkg.bat' | |
'${{github.workspace}}/vcpkg/vcpkg.exe integrate install | |
'${{github.workspace}}/vcpkg/vcpkg.exe install curl:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install expat:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install spdlog:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install libmosquitto:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install mosquitto:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install pthread:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install dlfcn-win32:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install openssl:${{ env.TRIPLET }}' | |
'${{github.workspace}}/vcpkg/vcpkg.exe install libwebsockets:${{ env.TRIPLET }}' | |
- name: Configure CMake and build | |
run: | | |
mkdir build | |
cd build | |
cmake -S .. -B . -G '${{ env.GENERATORS }}' -A x64 -DVCPKG_TARGET_TRIPLET=x64-windows -D"CMAKE_BUILD_TYPE=${{ env.BUILD_CONFIGURATION }}" -D"CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
cmake --build . --config '${{ env.BUILD_CONFIGURATION }}' --target ALL_BUILD -- -m | |
# msbuild libvscphelper.sln /p:Configuration=Release | |
#cpack . | |