forked from firemodels/smv
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (124 loc) · 4.28 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
name: CMake Build
on: [push, pull_request]
env:
BUILD_TYPE: Release
jobs:
build_unix_gcc:
# Set the name of this build, variable depending on the OS and whether it
# includes the lua engine
name: build ${{ matrix.os }} - lua=${{ matrix.lua }} - gcc
strategy:
fail-fast: false
# The matrix sets all the different combinations of builds, e.g. platforms
# and build configurations
matrix:
os:
- ubuntu-24.04
- macos-latest
lua:
- on
- off
# Set the platform to build on
runs-on: ${{ matrix.os }}
steps:
# Check out the smv repo
- name: Checkout code
uses: actions/checkout@v4
# If we are currently building on Linux (ubuntu) install all the native
# pre-requisites
- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install build-essential freeglut3-dev libx11-dev libxmu-dev libxi-dev libglew-dev libgd-dev liblua5.4-dev libjson-c-dev
# If we are building on macos configure the environment to use gcc-14 as
# the compiler
- name: set macos gcc
if: runner.os == 'macOS'
shell: bash
run: |
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
brew install glew lua gd zlib json-c
# If we are building on linux configure the environment to use gcc as the
# compiler
- name: set linux gcc
if: runner.os == 'Linux'
shell: bash
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
# Run cmake to build smokeview
- name: Build
shell: bash
run: |
cmake -B ${{github.workspace}}/cbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLUA=${{ matrix.lua }}
cmake --build ${{github.workspace}}/cbuild -j4
cp ${{github.workspace}}/cbuild/smokeview smokeview
# Run the CMake-based tests on MacOS
- name: Test
if: runner.os == 'macOS'
shell: bash
run: |
ctest --test-dir cbuild -j10 --output-on-failure -V
# Run the CMake-based tests on Linux
- name: Test
if: runner.os == 'Linux'
shell: bash
run: |
xvfb-run ctest --test-dir cbuild -j10 --output-on-failure -V
# Set a suffix based on whether lua is included
- name: Set exec suffix
if: matrix.lua == 'on'
run: echo "exec_suffix=-lua" >> $GITHUB_ENV
# Archive the smokeview executable
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: smokeview-${{ runner.os }}${{ env.exec_suffix }}
path: smokeview
build_windows_msvc:
name: build ${{ matrix.os }} - lua=${{ matrix.lua }} - msvc
strategy:
fail-fast: false
matrix:
os:
- windows-2022
lua:
- on
- off
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pin vcpkg version
run: |
cd C:\vcpkg
git fetch
git checkout 2024.03.25
.\\bootstrap-vcpkg.bat
- name: build smokeview
shell: cmd
run: |
cmake --version
cmake -B ${{github.workspace}}\cbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLUA_UTIL_LIBS=ON -DLUA=${{ matrix.lua }} -DLUA_BUILD_BINARY=${{ matrix.lua }} -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake -DLUA_BUILD_BINARY=ON
cmake --build ${{github.workspace}}\cbuild -j4 --config ${{env.BUILD_TYPE}}
copy ${{github.workspace}}\cbuild\Release\smokeview.exe smokeview.exe
- name: Test
shell: bash
working-directory: ${{github.workspace}}/cbuild
env:
LUA: ${{ matrix.lua }}
run: |
ctest -j10 -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Set exec suffix
if: matrix.lua == 'on'
run: echo "exec_suffix=-lua" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: smokeview-windows-msvc-${{ env.exec_suffix }}
path: smokeview.exe