-
Notifications
You must be signed in to change notification settings - Fork 4
210 lines (190 loc) · 8.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Build
on:
push:
pull_request:
release:
tags:
- "v*"
jobs:
build:
name: "[${{ matrix.build_type }}] ${{ matrix.config.name }}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
config:
- name: "Windows Latest MSVC"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_msvc_x64.7z"
cc: "cl"
cxx: "cl"
archiver: "7z a"
generator: "Visual Studio 17 2022"
target_triplet: x64-windows
- name: "Windows Latest MinGW"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_mingw_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-windows
- name: "Ubuntu_Latest_GCC"
os: ubuntu-latest
artifact: "amplitude_audio_sdk_linux_gcc_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-linux
- name: "Ubuntu_GCC_9"
os: ubuntu-latest
artifact: "amplitude_audio_sdk_linux_gcc9_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-linux
- name: "macOS Latest Clang"
os: macos-latest
artifact: "amplitude_audio_sdk_macos_gcc_x64.7z"
cc: "clang"
cxx: "clang++"
archiver: "7za a"
generator: "Ninja"
target_triplet: x64-osx
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Setup vcpkg
uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: 1c5a340f6e10985e2d92af174a68dbd15c1fa4e1
- name: Find flatc version
if: startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')
id: flatc_version
uses: tdemin/find-latest-tag@v1
with:
repo: https://github.com/google/flatbuffers.git
- name: Install dependencies on Windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake curl
choco upgrade mingw
ninja --version
cmake --version
$FLATC_VERSION = "$(curl "https://api.github.com/repos/google/flatbuffers/releases/latest" --ssl-no-revoke --silent | Select-String -Pattern '"tag_name":\s*"(.+)"')" -replace '.*"v(.+)".*','$1'
echo "flatc download latest v$FLATC_VERSION version"
iwr -Uri https://github.com/google/flatbuffers/releases/download/v$FLATC_VERSION/Windows.flatc.binary.zip -OutFile flatc.zip
mkdir bin
Expand-Archive -Force flatc.zip .\bin\
.\bin\flatc --version
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake
ninja --version
cmake --version
gcc --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Linux.flatc.binary.g++-10.zip
mkdir bin
sudo unzip Linux.flatc.binary.g++-10.zip -d bin
./bin/flatc --version
- name: Install dependencies on Ubuntu (GCC9)
if: startsWith(matrix.config.name, 'Ubuntu_GCC_9')
run: |
echo Update gcc-9 =======================================================================
echo gcc version before
gcc --version
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install ninja-build cmake gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
echo gcc version after
gcc --version
echo Update ninja =======================================================================
echo ninja version before
ninja --version
# wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
wget https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
echo ninja version after
ninja --version
echo Update cmake =======================================================================
echo cmake version before
cmake --version
# curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2
# wget https://github.com/Kitware/CMake/releases/latest/download/cmake-3.16.5-Linux-x86_64.sh
cmake_version=$(curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 | cut -c 2-)
echo cmake download latest v$cmake_version version
wget https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-Linux-x86_64.sh
chmod +x cmake-$cmake_version-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo ./cmake-$cmake_version-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force
echo cmake version after
cmake --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Linux.flatc.binary.g++-10.zip
mkdir bin
sudo unzip Linux.flatc.binary.g++-10.zip -d bin
./bin/flatc --version
- name: Install dependencies on MacOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install p7zip cmake ninja
ninja --version
cmake --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Mac.flatc.binary.zip
mkdir bin
sudo unzip Mac.flatc.binary.zip -d bin
./bin/flatc --version
- name: Configure
shell: bash
run: |
mkdir build
mkdir lib
cmake \
-S . \
-B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.config.generator }}" \
-DCMAKE_INSTALL_PREFIX:PATH=lib \
-DCMAKE_TOOLCHAIN_FILE:STRING="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET:STRING="${{ matrix.config.target_triplet }}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
- name: Build
shell: bash
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install Strip
shell: bash
working-directory: build
run: cmake --install . --strip --config ${{ matrix.build_type }}
- name: Pack
shell: bash
run: ${{ matrix.config.archiver }} ./${{ matrix.build_type }}_${{ matrix.config.artifact }} LICENSE sdk
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.build_type }}_${{ matrix.config.artifact }}
name: ${{ matrix.build_type }}_${{ matrix.config.artifact }}
- name: Upload release asset
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ matrix.build_type }}_${{ matrix.config.artifact }}
asset_name: ${{ matrix.build_type }}_${{ matrix.config.artifact }}.zip
asset_content_type: application/zip