-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (92 loc) · 4.38 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
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CMake
on:
push: # Keep empty to run on each branch when push the code. Otherwise use branches: [ master ]
branches: [ main ]
pull_request: # Set to master to run only when merge with master branch
branches: [ main ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CYGWIN: winsymlinks:native
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Linux.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
jobs:
build-tests:
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config: # Create matrix with combinations
# compile AREG engine as a shared with CYGWIN g++ / gcc on Windows, enable AREG extensions and logs
- { name: win-cygwin-g++-shared,
os: windows-latest,
lib: shared,
family: cygwin,
cxx: g++,
comp: ON,
before: ON
}
steps:
- name: Config Git
run: git config --global core.autocrlf input
- name: Checkout AREG SDK Demo project sources and dependencies
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Java JDK to run code generator
uses: actions/[email protected]
with:
java-version: 17
java-package: jre
distribution: temurin
- name: Update compilers on Linux
if: matrix.config.os == 'ubuntu-latest'
# Update compilers, set C/C++ compilers
run: sudo apt-get update
- name: Set Windows PATH environment variable for cygwin
if: matrix.config.family == 'cygwin'
run: |
echo "PATH=C:\cygwin;C:\cygwin\bin;C:\cygwin\lib;%SYSTEMROOT%\system32;%PATH%" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install cygwin on Windows
if: matrix.config.family == 'cygwin'
uses: cygwin/cygwin-install-action@master
with:
packages: autoconf, cmake, dos2unix, flexdll, gcc-g++, git, ncurses, libncurses-devel, make, pkgconf
- name: Update Cygwin
if: matrix.config.family == 'cygwin'
shell: powershell
run: |
# (https://github.com/cygwin/cygwin-install-action/blob/master/action.yml)
Invoke-WebRequest https://cygwin.com/setup-x86_64.exe -OutFile C:\setup.exe
# because setup is a Windows GUI app, make it part of a pipeline to make
# PowerShell wait for it to exit
& C:\setup.exe -qgnO -t | Out-Default
- name: Update the Cygwin path
shell: C:\cygwin\bin\bash.exe --noprofile --norc -o igncr -eo pipefail '{0}'
run: |
set -e
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
export NO_PAM=1 NO_UNWIND=1 NO_WOLFSSL=1
export SHELL=/bin/dash
- name: Set cmake cache destination for Linux
if: matrix.config.os == 'ubuntu-latest'
run: echo "CACHE_DEST=./product/cache/${{matrix.config.name}}" >> "$GITHUB_ENV"
- name: Set cmake cache destination for Windows
if: matrix.config.os == 'windows-latest'
run: echo "CACHE_DEST=./product/cache/${{matrix.config.name}}" >> $env:GITHUB_ENV
- name: Configure CMake and pass compiler option
if: matrix.config.comp == 'ON'
working-directory: ${{github.workspace}}
run: |
cmake -B ${{env.CACHE_DEST}} -DAREG_COMPILER=${{matrix.config.cxx}} -DAREG_BUILD_TYPE=${{env.BUILD_TYPE}} -DAREG_BINARY=${{matrix.config.lib}} -DINTEGRATE_AREG_BEFORE_PROJECT:BOOL=${{matrix.config.before}}
- name: Configure CMake and pass compiler family option
if: matrix.config.comp == 'OFF'
working-directory: ${{github.workspace}}
run: |
cmake -B ${{env.CACHE_DEST}} -DAREG_COMPILER_FAMILY=${{matrix.config.family}} -DAREG_BUILD_TYPE=${{env.BUILD_TYPE}} -DAREG_BINARY=${{matrix.config.lib}} -DINTEGRATE_AREG_BEFORE_PROJECT:BOOL=${{matrix.config.before}}
- name: Build with CMake
working-directory: ${{github.workspace}}
# Build your program with the given configuration
run: cmake --build ${{env.CACHE_DEST}} -j 20