-
Notifications
You must be signed in to change notification settings - Fork 14
/
build-bindings-job.yml
executable file
·177 lines (153 loc) · 5.99 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
parameters:
name: 'Generate bindings'
vmImage: 'ubuntu-latest'
py_maj: '3'
py_min: '6'
config_file: 'ocp.toml'
conda_bld: '3.16.3'
conda_env_file: 'env.yml'
CXX: g++
jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: 360
pool:
vmImage: ${{ parameters.vmImage }}
variables:
n_cores: 2
steps:
- ${{ 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 g++ and gl headers'
- ${{ 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'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
conda env create -f ${{ parameters.conda_env_file }}
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 && \
pip install . && \
pywrap -n $(n_cores) parse ${{ parameters.config_file }} out.pkl && \
pywrap -n $(n_cores) transform ${{ parameters.config_file }} out.pkl out_f.pkl && \
pywrap -n $(n_cores) generate ${{ parameters.config_file }} out_f.pkl
displayName: 'Generate'
- task: CopyFiles@2
inputs:
contents: 'out*.pkl'
targetFolder: $(conf.OUTPUT)
displayName: 'Copy pkl outputs'
- publish: $(conf.OUTPUT)
artifact: OCP_src_${{ parameters.vmImage }}
- job: ${{ parameters.name }}_${{ parameters.py_maj }}_${{ parameters.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 g++8 and gl headers'
- ${{ 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'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
conda env create -f ${{ parameters.conda_env_file }}
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=Debug && \
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
cmake --build build -j $(n_cores) -- -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'