-
Notifications
You must be signed in to change notification settings - Fork 44
399 lines (314 loc) · 14.3 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
name: CMake
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
USER_CONFIG: ${{github.workspace}}/.github/config/boost/user-config.jam
jobs:
build-boost:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ${{github.workspace}}/lib
steps: # Note: Using a matrix strategy will end in building Boost 4 times.
- uses: actions/checkout@v3
- name: Cache Boost
id: cache-boost
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib/boost
${{github.workspace}}/.github/config/boost
key: ${{ runner.os }}-boost.1.76-new
- name: Set Up Python 3.6
uses: actions/setup-python@v4
with:
python-version: '3.6'
- name: Write Python 3.6 to user-config.jam
run: |
echo -e "using python\n\t: 3.6\n\t: $pythonLocation/bin/python\n\t: $pythonLocation/include/python3.6m\n\t: $pythonLocation/lib\n;\n" >> $USER_CONFIG
- name: Set Up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Write Python 3.7 to user-config.jam
run: |
echo -e "using python\n\t: 3.7\n\t: $pythonLocation/bin/python\n\t: $pythonLocation/include/python3.7m\n\t: $pythonLocation/lib\n;\n" >> $USER_CONFIG
- name: Set Up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Write Python 3.8 to user-config.jam
run: |
echo -e "using python\n\t: 3.8\n\t: $pythonLocation/bin/python\n\t: $pythonLocation/include/python3.8\n\t: $pythonLocation/lib\n;\n" >> $USER_CONFIG
- name: Set Up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Write Python 3.9 to user-config.jam
run: |
echo -e "using python\n\t: 3.9\n\t: $pythonLocation/bin/python\n\t: $pythonLocation/include/python3.9\n\t: $pythonLocation/lib\n;\n" >> $USER_CONFIG
- name: Set Up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Write Python 3.10 to user-config.jam
run: |
echo -e "using python\n\t: 3.10\n\t: $pythonLocation/bin/python\n\t: $pythonLocation/include/python3.10\n\t: $pythonLocation/lib\n;\n" >> $USER_CONFIG
- name: Build Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz && tar -xzvf boost_1_76_0.tar.gz && mv boost_1_76_0 boost && cd boost
./bootstrap.sh
./b2 --user-config=$USER_CONFIG cxxflags=-fPIC python=3.6,3.7,3.8,3.9,3.10
cd .. && rm boost_1_76_0.tar.gz
build-libs:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ${{github.workspace}}/lib
steps:
- uses: actions/checkout@v3
- name: Update package lists
run: sudo apt update
- name: Cache Armadillo, GDAL and LASTools
id: cache-lastools-armadillo-gdal
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib
key: ${{ runner.os }}-gdal-lastools-armadillo-latest
##### ARMADILLO #####
- name: Build Armadillo
if: steps.cache-lastools-armadillo-gdal.outputs.cache-hit != 'true'
run: |
wget -O armadillo.tar.xz http://sourceforge.net/projects/arma/files/armadillo-10.6.2.tar.xz && tar xf armadillo.tar.xz && mv armadillo-10.6.2 armadillo
cd armadillo && ./configure -DCMAKE_INSTALL_PREFIX=. && make && make install
cd .. && rm armadillo.tar.xz
##### GDAL #####
- name: Build GDAL
if: steps.cache-lastools-armadillo-gdal.outputs.cache-hit != 'true'
run: |
sudo apt install -y pkg-config libsqlite3-dev sqlite3 libtiff5-dev libcurl4-openssl-dev
wget http://download.osgeo.org/proj/proj-8.0.0.tar.gz https://github.com/OSGeo/gdal/releases/download/v3.3.0/gdal-3.3.0.tar.gz --no-check-certificate
tar -xzvf proj-8.0.0.tar.gz && tar -xzvf gdal-3.3.0.tar.gz
mv gdal-3.3.0 ${{github.workspace}}/lib/gdal && mv proj-8.0.0 ${{github.workspace}}/lib/proj
cd ${{github.workspace}}/lib/proj && ./configure --prefix=${{github.workspace}}/lib/gdal/projlib && make && make install
cd ${{github.workspace}}/lib/gdal && ./configure --prefix=${{github.workspace}}/lib/gdal --with-proj=${{github.workspace}}/lib/gdal/projlib && make && make install
cd .. && rm proj-8.0.0.tar.gz gdal-3.3.0.tar.gz
##### LasTools #####
- name: Build LASTools
if: steps.cache-lastools-armadillo-gdal.outputs.cache-hit != 'true'
run: |
wget -O LAStools.zip http://lastools.github.io/download/LAStools.zip
unzip LAStools.zip -d ${{github.workspace}}/lib
cd LAStools && cmake . && make
cd .. && rm LAStools.zip
build-helios:
needs: [build-libs, build-boost]
runs-on: ubuntu-20.04
name: 'Helios-PyBinds (Python${{ matrix.python-version}})'
defaults:
run:
working-directory: ${{github.workspace}}
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update package lists
run: sudo apt update
- name: Install required packages
run: sudo apt-get install -y cmake libglm-dev zip unzip xz-utils
- name: Load LasTools, Armadillo and GDAL from cache
id: cache-lastools-armadillo-gdal
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib
key: ${{ runner.os }}-gdal-lastools-armadillo-latest
- name: Load Boost from Cache
id: cache-boost
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib/boost
${{github.workspace}}/.github/config/boost
key: ${{ runner.os }}-boost.1.76-new
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPYTHON_BINDING=1 -DPYTHON_VERSION=${{ matrix.python-version }} -DPYTHON_PATH=$pythonLocation -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: ls
run: ls -al .
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{github.workspace}}/run/helios --test
- name: Save compiled executable
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os}}-helios-pybinds-${{ matrix.python-version }}
path: |
${{github.workspace}}/run/helios
${{github.workspace}}/run/libhelios.so
${{github.workspace}}/run/_pyhelios.so
build-helios-pybinds-dynamic:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. 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
needs: [ build-libs, build-boost]
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v3
- name: Update package lists
run: sudo apt update
- name: Install required packages
run: sudo apt-get install -y cmake libglm-dev zip unzip xz-utils
- name: Python Libraries
run: sudo apt-get install -y libpython3-dev
- name: Load LasTools, Armadillo and GDAL from cache
id: cache-lastools-armadillo-gdal
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib
key: ${{ runner.os }}-gdal-lastools-armadillo-latest
- name: Load Boost from Cache
id: cache-boost
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib/boost
${{github.workspace}}/.github/config/boost
key: ${{ runner.os }}-boost.1.76-new
- name: Install Boost in the system
run: |
cd lib/boost && sudo ./b2 --user-config=$USER_CONFIG python=3.8 install
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPYTHON_BINDING=1 -DPYTHON_VERSION=38 -DBOOST_DYNAMIC_LIBS=1 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run
- name: Build
# Build your program with the given configuration
run:
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Save compiled executable
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os}}-helios-dynamic-linking
path: |
${{github.workspace}}/run/helios
${{github.workspace}}/run/libhelios.so
${{github.workspace}}/run/_pyhelios.so
- name: ls
run: ls -al .
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{github.workspace}}/run/helios --test
build-helios-38:
needs: [ build-libs, build-boost ]
runs-on: ubuntu-20.04
name: 'Helios-PyBinds (Python3.8) - separate'
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Update package lists
run: sudo apt update
- name: Install required packages
run: sudo apt-get install -y cmake libglm-dev zip unzip xz-utils
- name: Cache Helios++
id: cache-helios
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/run
key: ${{ runner.os }}-helios-build-latest-${{ github.sha }}
- name: Load LasTools, Armadillo and GDAL from cache
id: cache-lastools-armadillo-gdal
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib
key: ${{ runner.os }}-gdal-lastools-armadillo-latest
- name: Load Boost from Cache
id: cache-boost
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib/boost
${{github.workspace}}/.github/config/boost
key: ${{ runner.os }}-boost.1.76-new
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPYTHON_BINDING=1 -DPYTHON_VERSION=3.8 -DPYTHON_PATH=$pythonLocation -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:STRING=${{github.workspace}}/run
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: ls
run: ls -al . && ls -al run && ls -al build
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{github.workspace}}/run/helios --test
run-testcases:
needs: build-helios-38
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Load LasTools, Armadillo and GDAL from cache
id: cache-lastools-armadillo-gdal
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/lib
key: ${{ runner.os }}-gdal-lastools-armadillo-latest
- name: Load helios++ from cache
id: cache-helios
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/run
key: ${{ runner.os }}-helios-build-latest-${{ github.sha }}
- name: Add libaries to LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=${{github.workspace}}/lib/armadillo:${{github.workspace}}/lib/LAStools:${{github.workspace}}/lib/gdal" >> $GITHUB_ENV
- name: Install test dependencies
run: python -m pip install pytest numpy xmlschema laspy[laszip]
- name: Run pytest
run: python -m pytest -v ${{github.workspace}}/pytests
- name: Save output files
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os}}-helios-pytests-output
path: ${{github.workspace}}/output/*