windows action live #226
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: x64 | |
# https://ddalcino.github.io/aqt-list-server/ | |
- name: Prepare Qt Libraries | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.8.0' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2022_64' | |
modules: 'qtcharts' | |
archives: 'qtbase qtsvg qttools qtwebsockets qtserialbus qtserialport qtdeclarative' | |
cache: 'true' | |
cache-key-prefix: 'install-qt-action' | |
setup-python: 'true' | |
tools: 'tools_qtcreator,qt.tools.qtcreator' | |
set-env: 'true' | |
tools-only: 'false' | |
aqtversion: '==3.1.*' | |
py7zrversion: '==0.20.*' | |
extra: '--external 7z' | |
- name: Clone | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# - name: Install vcpkg | |
# uses: lukka/run-vcpkg@v2 | |
# with: | |
# vcpkgDirectory: 'C:/vcpkg/' | |
# vcpkgArguments: '@C:/vcpkg/.txt' | |
# appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} | |
# Install latest CMake. | |
- name: Get latest CMake and ninja | |
uses: lukka/get-cmake@latest | |
with: | |
# Just install vcpkg for now, do not install any ports in this step yet. | |
setupOnly: true | |
# Location of the vcpkg as submodule of the repository. | |
vcpkgDirectory: 'C:/vcpkg/' | |
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's | |
# compute its hash and append this to the computed cache's key. | |
appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }} | |
vcpkgTriplet: '${{ env.TRIPLET }}' | |
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed'. | |
additionalCachedPaths: '${{ env.buildDir }}/vcpkg_installed' | |
- 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: Prepare Qt Libraries | |
# uses: jurplel/install-qt-action@v2 | |
# - name: Cache vcpkg | |
# id: cache-vcpkg | |
# uses: actions/cache@v2 | |
# with: | |
# path: vcpkg | |
# key: ${{ runner.os }}-vcpkg | |
# - name: Checkout vcpkg repo | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: microsoft/vcpkg | |
# path: C:/vcpkg | |
- name: Integrate with development environment and install | |
shell: cmd | |
working-directory: C:/vcpkg/ | |
run: | | |
call C:/vcpkg/vcpkg.exe/bootstrap-vcpkg.bat | |
C:/vcpkg/vcpkg.exe integrate install | |
C:/vcpkg/vcpkg.exe install curl:x64-windows | |
C:/vcpkg/vcpkg.exe install expat:x64-windows | |
C:/vcpkg/vcpkg.exe install spdlog:x64-windows | |
C:/vcpkg/vcpkg.exe install libmosquitto:x64-windows | |
C:/vcpkg/vcpkg.exe install mosquitto:x64-windows | |
C:/vcpkg/vcpkg.exe install pthread:x64-windows | |
C:/vcpkg/vcpkg.exe install dlfcn-win32:x64-windows | |
C:/vcpkg/vcpkg.exe install openssl:x64-windows | |
C:/vcpkg/vcpkg.exe install paho-mqtt:x64-windows | |
C:/vcpkg/vcpkg.exe install libwebsockets:x64-windows | |
- 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 }}" | |
# msbuild libvscphelper.sln /p:Configuration=Release | |
#cpack . | |