-
-
Notifications
You must be signed in to change notification settings - Fork 47
111 lines (96 loc) · 5.11 KB
/
cmake-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: CMake for windows platform
on:
push:
tags:
- '*' # any tag
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
build_type: [Release]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-version=${{ github.ref_name == 'master' && '0.0.0' || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "qt-dir=${{ github.workspace }}/qt/6.7.2/mingw_64" >> "$GITHUB_OUTPUT"
echo "ninja-dir=${{ github.workspace }}/tools/ninja" >> "$GITHUB_OUTPUT"
echo "cmake-dir=${{ github.workspace }}/tools/cmake_64" >> "$GITHUB_OUTPUT"
echo "mingw-dir=${{ github.workspace }}/tools/mingw1310_64" >> "$GITHUB_OUTPUT"
echo "installer-dir=${{ github.workspace }}/tools/QtInstallerFramework/4.7" >> "$GITHUB_OUTPUT"
echo "package-dir=${{ github.workspace }}/build/installer/package" >> "$GITHUB_OUTPUT"
echo "package-data-dir=${{ github.workspace }}/build/installer/package/org.josevcm.nfc-spy/data" >> "$GITHUB_OUTPUT"
echo "package-meta-dir=${{ github.workspace }}/build/installer/package/org.josevcm.nfc-spy/meta" >> "$GITHUB_OUTPUT"
echo "cpu-count=4" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
key: ${{ runner.os }}-qt-dependencies
path: |
${{ github.workspace }}/qt
${{ github.workspace }}/tools
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
choco install aqt -y --no-progress -r
aqt install-qt windows desktop 6.7.2 win64_mingw --outputdir ${{ github.workspace }}/qt
aqt install-tool windows desktop tools_mingw1310 qt.tools.win64_mingw1310 --outputdir ${{ github.workspace }}
aqt install-tool windows desktop tools_cmake qt.tools.cmake --outputdir ${{ github.workspace }}
aqt install-tool windows desktop tools_ninja qt.tools.ninja --outputdir ${{ github.workspace }}
aqt install-tool windows desktop tools_ifw qt.tools.ifw.47 --outputdir ${{ github.workspace }}
- name: Configure project
run: |
${{ steps.strings.outputs.cmake-dir }}/bin/cmake `
-S ${{ github.workspace }} `
-B ${{ steps.strings.outputs.build-dir }} `
-G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_PREFIX_PATH=${{ steps.strings.outputs.qt-dir }} `
-DCMAKE_C_COMPILER=${{ steps.strings.outputs.mingw-dir }}/bin/gcc.exe `
-DCMAKE_CXX_COMPILER=${{ steps.strings.outputs.mingw-dir }}/bin/g++.exe `
-DCMAKE_MAKE_PROGRAM=${{ steps.strings.outputs.ninja-dir }}/ninja.exe `
-DBUILD_PROJECT_VERSION="${{ steps.strings.outputs.build-version }}"
- name: Build project
run: |
${{ steps.strings.outputs.cmake-dir }}/bin/cmake `
--build ${{ steps.strings.outputs.build-dir }} `
--target nfc-spy --parallel ${{ steps.strings.outputs.cpu-count }}
- name: Create installer
run: |
# create installer folders
New-Item -Force -ItemType "directory" -Path ${{ steps.strings.outputs.package-data-dir }}
New-Item -Force -ItemType "directory" -Path ${{ steps.strings.outputs.package-meta-dir }}
# copy executable and libraries
Copy-Item -Force ${{ steps.strings.outputs.build-dir }}/src/nfc-app/app-qt/nfc-spy.exe ${{ steps.strings.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/usb-1.0.26/x86_64/bin/*.dll ${{ steps.strings.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/openssl-1.1.1/x86_64/bin/*.dll ${{ steps.strings.outputs.package-data-dir }}
# copy drivers and firmware
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/config ${{ steps.strings.outputs.package-data-dir }}
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/drivers ${{ steps.strings.outputs.package-data-dir }}
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/firmware ${{ steps.strings.outputs.package-data-dir }}
# copy installer resources
Copy-Item -Force ${{ steps.strings.outputs.build-dir }}/installer/config/*.* ${{ steps.strings.outputs.package-meta-dir }}
# create deployment
${{ steps.strings.outputs.qt-dir }}/bin/windeployqt `
--verbose 1 `
--compiler-runtime `
--no-translations `
--no-system-d3d-compiler `
--no-opengl-sw `
${{ steps.strings.outputs.package-data-dir }}/nfc-spy.exe
# create installer
${{ steps.strings.outputs.installer-dir }}/bin/binarycreator `
--verbose `
-c ${{ steps.strings.outputs.build-dir }}/installer/config/config.xml `
-p ${{ steps.strings.outputs.package-dir }} `
${{ steps.strings.outputs.build-dir }}/nfc-spy-${{ github.ref_name }}-installer-x86_64.exe