-
Notifications
You must be signed in to change notification settings - Fork 14
99 lines (83 loc) · 3.32 KB
/
cmake.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
name: CMake
on: [push, pull_request]
jobs:
build:
runs-on: ${{matrix.os}}
env:
VCPKG_ROOT: 'C:\vcpkg'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
include:
- os: windows-2019
arch: x64
build_type: Release
triplet: x64-windows
- os: windows-2019
arch: x64
build_type: Debug
triplet: x64-windows
- os: windows-2019
arch: Win32
build_type: Release
triplet: x86-windows
- os: windows-2019
arch: Win32
build_type: Debug
triplet: x86-windows
steps:
- uses: actions/checkout@v3
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake check gperf libftdi1-dev libzip-dev
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: |
brew install check libftdi libusb libzip pkg-config
- name: Restore vcpkg cache
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: |
${{env.VCPKG_ROOT}}
!${{env.VCPKG_ROOT}}/buildtrees
!${{env.VCPKG_ROOT}}/packages
!${{env.VCPKG_ROOT}}/downloads
!${{env.VCPKG_ROOT}}/installed
key: |
${{matrix.os}}-${{matrix.triplet}}
- name: Install dependencies on Windows
if: runner.os == 'Windows'
run: |
git --git-dir="${{env.VCPKG_ROOT}}" fetch origin
git --git-dir="${{env.VCPKG_ROOT}}" checkout 73d50c1b8290af45cb5922d721b74946c058481c
vcpkg install --triplet ${{matrix.triplet}} check gperf libftdi1 libusb libzip[core] getopt-win32
- name: Configure CMake
if: runner.os != 'Windows'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS:BOOL=on -DCMAKE_VERBOSE_MAKEFILE:BOOL=on
- name: Configure CMake on Windows
if: runner.os == 'Windows'
# "C:/does/not/exists/pkg-config.exe" is a workaround for cmake 3.23
run: cmake -A ${{matrix.arch}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS:BOOL=on -DCMAKE_VERBOSE_MAKEFILE:BOOL=on -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{matrix.triplet}} -DPKG_CONFIG_EXECUTABLE="C:/does/not/exists/pkg-config.exe"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
- name: Build package on Windows
if: runner.os == 'Windows'
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --target package
- name: Store the package
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: ${{matrix.build_type}} package for Windows ${{matrix.arch}}
path: build/libopenvizsla-*.zip
- name: Release the package
if: runner.os == 'Windows' && matrix.build_type == 'Release' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: build/libopenvizsla-*.zip
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure