-
Notifications
You must be signed in to change notification settings - Fork 12
169 lines (140 loc) · 7.92 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
name: CMake
on: [push]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# 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
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --recursive
- name: add SWIG to windows
# this is separate from the SWIG download itself, because it needs to be added to the path also when SWIG is cached
if: matrix.os == 'windows-latest'
shell: bash
run: |
choco install -y swig
- name: add linux dependencies
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get install swig
- name: Install MacOS dependencies
# MacOS already has libxml2 by default
if: matrix.os == 'macos-latest'
shell: bash
run: |
brew install swig
- name: Create Build Environment for dependencies
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
cmake -E make_directory ${{runner.workspace}}/build_libsbml_dependencies
cmake -E make_directory ${{runner.workspace}}/build_libsbml
cmake -E make_directory ${{runner.workspace}}/build_libnuml
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
# W I N D O W S
- name: Configure and build libsbml dependencies (win)
# build dependencies
if: matrix.os == 'windows-latest'
working-directory: ${{runner.workspace}}/build_libsbml_dependencies
shell: cmd
run: |
cmake -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install_dependencies -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DWITH_BZIP2=ON -DWITH_CHECK=OFF -DWITH_EXPAT=ON -DWITH_XERCES=OFF -DWITH_ICONV=OFF -DWITH_LIBXML=OFF %GITHUB_WORKSPACE%\submodules\libSBML-dependencies
cmake --build . --config %BUILD_TYPE% --target install
- name: Configure and build libsbml (win)
# build libsbml
if: matrix.os == 'windows-latest'
working-directory: ${{runner.workspace}}/build_libsbml
shell: cmd
run: |
cmake -DLIBSBML_DEPENDENCY_DIR=%GITHUB_WORKSPACE%\install_dependencies -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install_dependencies -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DLIBEXPAT_INCLUDE_DIR=%GITHUB_WORKSPACE%\install_dependencies\include -DWITH_ZLIB=OFF -DWITH_BZIP2=OFF -DWITH_EXPAT=ON -DWITH_LIBXML=OFF -DLIBSBML_SKIP_SHARED_LIBRARY=ON %GITHUB_WORKSPACE%\submodules\libSBML
cmake --build . --config %BUILD_TYPE% --target install
- name: Configure and build libnuml (win)
# build libsbml
if: matrix.os == 'windows-latest'
working-directory: ${{runner.workspace}}/build_libnuml
shell: cmd
run: |
cmake -DLIBNUML_DEPENDENCY_DIR=%GITHUB_WORKSPACE%\install_dependencies -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install_dependencies -DLIBNUML_SKIP_SHARED_LIBRARY=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% %GITHUB_WORKSPACE%\submodules\NuML\libnuml
cmake --build . --config %BUILD_TYPE% --target install
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
if: matrix.os == 'windows-latest'
shell: cmd
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DLIBSEDML_DEPENDENCY_DIR=%GITHUB_WORKSPACE%/install_dependencies -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\build\instdir -DWITH_JAVA=ON %GITHUB_WORKSPACE%
# N O T WINDOWS
- name: Configure and build libsbml dependencies (mac / linux)
# build dependencies
if: matrix.os != 'windows-latest'
working-directory: ${{runner.workspace}}/build_libsbml_dependencies
shell: bash
run: |
cmake -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install_dependencies -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_BZIP2=ON -DWITH_CHECK=OFF -DWITH_EXPAT=ON -DWITH_XERCES=OFF -DWITH_ICONV=OFF -DWITH_LIBXML=OFF $GITHUB_WORKSPACE/submodules/libSBML-dependencies
cmake --build . --config $BUILD_TYPE --target install
- name: Configure and build libsbml for (mac / linux)
# build libsbml
if: matrix.os != 'windows-latest'
working-directory: ${{runner.workspace}}/build_libsbml
shell: bash
run: |
cmake -DLIBSBML_DEPENDENCY_DIR=${{runner.workspace}}/install_dependencies -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install_dependencies -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBEXPAT_INCLUDE_DIR=${{runner.workspace}}/install_dependencies/include -DWITH_ZLIB=OFF -DWITH_BZIP2=OFF -DWITH_EXPAT=ON -DWITH_LIBXML=OFF -DLIBSBML_SKIP_SHARED_LIBRARY=ON $GITHUB_WORKSPACE/submodules/libSBML
cmake --build . --config $BUILD_TYPE --target install
- name: Configure and build libnuml (mac / linux)
# build libsbml
if: matrix.os != 'windows-latest'
working-directory: ${{runner.workspace}}/build_libnuml
shell: bash
run: |
cmake -DLIBNUML_DEPENDENCY_DIR=${{runner.workspace}}/install_dependencies -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install_dependencies -DLIBNUML_SKIP_SHARED_LIBRARY=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE $GITHUB_WORKSPACE/submodules/NuML/libnuml
cmake --build . --config $BUILD_TYPE --target install
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
if: matrix.os != 'windows-latest'
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBSEDML_DEPENDENCY_DIR=${{runner.workspace}}/install_dependencies -DWITH_CPP_NAMESPACE=ON -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/build/instdir -DWITH_JAVA=ON $GITHUB_WORKSPACE
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE
- name: Install Strip
working-directory: ${{runner.workspace}}/build
run: cmake --install . --prefix instdir --strip
- name: Pack
working-directory: ${{runner.workspace}}/build/instdir
run: cmake -E tar cvzf ../binaries_${{ matrix.os }}.tar.gz .
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ${{runner.workspace}}/build/binaries_${{ matrix.os }}.tar.gz
name: binaries_${{ matrix.os }}.tar.gz