forked from CadQuery/OCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-bindings-job.yml
executable file
·210 lines (183 loc) · 7.4 KB
/
build-bindings-job.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
parameters:
name: 'Generate bindings'
vmImage: 'ubuntu-latest'
py_maj: '3'
py_min: '9'
py_min_build:
- 8
- 9
- 10
- 11
config_file: 'ocp.toml'
conda_bld: '3.16.3'
conda_env_file: 'env.yml'
CXX: g++-8
jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: 360
pool:
vmImage: ${{ parameters.vmImage }}
variables:
n_cores: 2
steps:
- checkout: self
submodules: true
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: sudo apt-get update && sudo apt-get install ${{ parameters.CXX }} mesa-common-dev libegl1-mesa-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
displayName: 'Install gl headers and the requested compiler'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Find GL headers'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
conda env create -f ${{ parameters.conda_env_file }} && \
conda install -n cpp-py-bindgen -y python=${{ parameters.py_maj }}.${{ parameters.py_min }}
displayName: 'Prepare conda environment'
- bash: |
source activate cpp-py-bindgen && \
conda info -a && \
conda list && \
which python && \
env
displayName: 'Conda env sanity checks'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
- bash: |
source activate cpp-py-bindgen && \
OUTPUT=`python -c'import toml; print(toml.load("${{ parameters.config_file }}")["output_folder"])'` && \
echo $OUTPUT && \
echo "##vso[task.setvariable variable=OUTPUT;isOutput=true]$OUTPUT"
displayName: 'Read output dir from the config file'
name: 'conf'
- bash: |
source activate cpp-py-bindgen && \
echo "find_package(Python3 COMPONENTS Development REQUIRED)" >> test.cmake && \
cmake --debug-find -DPython3_FIND_VIRTUALENV=only -P test.cmake && \
cmake -DPython3_ROOT_DIR=$CONDA_PREFIX -B new -S . -G Ninja
displayName: 'CMake based pywrap call'
name: 'Generate'
- task: CopyFiles@2
inputs:
contents: '*.pkl'
targetFolder: $(conf.OUTPUT)
displayName: 'Copy pkl outputs'
- publish: $(conf.OUTPUT)
artifact: OCP_src_${{ parameters.vmImage }}
- ${{ each py_min in parameters.py_min_build }}:
- job: ${{ parameters.name }}_${{ parameters.py_maj }}_${{ py_min }}
timeoutInMinutes: 360
dependsOn: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
variables:
n_cores: 2
OCP_src: OCP_src_${{ parameters.vmImage }}
steps:
- download: current
artifact: OCP_src_${{ parameters.vmImage }}
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: sudo apt-get update && sudo apt-get install ${{ parameters.CXX }} mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
displayName: 'Install gl headers and the requested compiler'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
sudo find /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ && \
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Search for GL'
- ${{ if contains(parameters.vmImage, 'win') }}:
- bash: ls "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build"
displayName: 'Find vcvars64'
- ${{ if contains(parameters.vmImage, 'win') }}:
- script: |
choco install --accept-license -y Ninja llvm
displayName: 'Install clang'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
sed -e s/python=.../python=${{ parameters.py_maj }}.${{ py_min }}/ ${{ parameters.conda_env_file }} > _env.yml && \
conda env create -f _env.yml
displayName: 'Prepare conda environment'
- bash: |
source activate cpp-py-bindgen && \
conda info -a && \
conda list && \
which python && \
env
displayName: 'Conda env sanity checks'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: |
source activate cpp-py-bindgen && \
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release && \
cmake --build build -j $(n_cores) -- -k 0 && \
rm -rf build/CMakeFiles
displayName: 'Compile'
env:
CXX: ${{ parameters.CXX }}
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
cp -rf opencascade $CONDA_PREFIX/include && \
cat $CONDA_PREFIX/include/opencascade/OpenGl_HaltonSampler.hxx &&\
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release && \
cmake --build build -j $(n_cores) -- -k 0 && \
rm -rf build/CMakeFiles
displayName: 'Compile'
env:
CXX: "clang++"
- ${{ if contains(parameters.vmImage, 'win') }}:
- script: |
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
call activate cpp-py-bindgen
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release -DPython3_FIND_STRATEGY=LOCATION -DPython3_ROOT_DIR=%CONDA_PREFIX% -DCMAKE_LINKER=lld-link.exe
cmake --build build -j $(n_cores) -- -v -k 0
rmdir /S /Q build\CMakeFiles
displayName: 'Compile'
env:
CXX: "cl.exe"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build'
artifactName: OCP_${{ parameters.vmImage }}
displayName: 'Publish compilation result'
- bash: |
source activate cpp-py-bindgen && \
cd build && \
LD_DEBUG=libs python -c"import OCP"
displayName: 'Test'
- bash: |
conda create -n build -y python=3.6 conda-build=${{ parameters.conda_bld }} anaconda-client && \
source activate build && \
conda build --token $TOKEN --user cadquery -c conda-forge -c conda-forge/label/occt_rc conda
displayName: 'Build conda package'
condition: ne(variables['Build.Reason'], 'PullRequest')
env:
BUILD_STRING: "1"
PYTHON_VERSION: ${{ parameters.py_maj }}.${{ py_min }}
TOKEN: $(anaconda.TOKEN)
- bash: |
conda create -n build -y python=3.6 conda-build=${{ parameters.conda_bld }} anaconda-client && \
source activate build && \
conda build -c conda-forge -c conda-forge/label/occt_rc conda
displayName: 'Build conda package'
condition: eq(variables['Build.Reason'], 'PullRequest')
env:
BUILD_STRING: "1"
PYTHON_VERSION: ${{ parameters.py_maj }}.${{ py_min }}
TOKEN: $(anaconda.TOKEN)