Skip to content

Commit ca011b1

Browse files
Add clang with libc++ build to CI (#302)
1 parent daabf57 commit ca011b1

4 files changed

Lines changed: 156 additions & 55 deletions

File tree

.github/actions/cmake-project-setup/action.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ runs:
1717
- name: Prepare files
1818
run: |
1919
cp .github/files/CMakeUserPresets.json solvers/cpp/
20+
cp .github/files/conan-profile-clang-with-libc++ solvers/cpp/
2021
cp .github/files/conan-profile-gcc-libstd++-for-clang solvers/cpp/
2122
shell: bash

.github/files/CMakeUserPresets.json

Lines changed: 140 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,62 @@
22
"version": 8,
33
"configurePresets": [
44
{
5-
"name": "ci-macos-clang-debug",
6-
"inherits": ["_ci-macos-clang", "_ci-debug", "_ci-clang-tidy"]
5+
"name": "ci-macos-clang-libc++-debug",
6+
"inherits": ["_ci-macos-clang-libc++", "_ci-debug", "_ci-clang-tidy"]
77
},
88
{
9-
"name": "ci-macos-clang-release",
10-
"inherits": ["_ci-macos-clang", "_ci-release", "_ci-clang-tidy"]
9+
"name": "ci-macos-clang-libc++-release",
10+
"inherits": ["_ci-macos-clang-libc++", "_ci-release", "_ci-clang-tidy"]
1111
},
1212
{
13-
"name": "ci-macos-gcc-debug",
13+
"name": "ci-macos-clang-libstdc++-debug",
14+
"inherits": ["_ci-macos-clang-libstdc++", "_ci-debug", "_ci-clang-tidy"]
15+
},
16+
{
17+
"name": "ci-macos-clang-libstdc++-release",
18+
"inherits": ["_ci-macos-clang-libstdc++", "_ci-release", "_ci-clang-tidy"]
19+
},
20+
{
21+
"name": "ci-macos-gcc-libstdc++-debug",
1422
"inherits": ["_ci-macos-gcc", "_ci-debug"]
1523
},
1624
{
17-
"name": "ci-macos-gcc-release",
25+
"name": "ci-macos-gcc-libstdc++-release",
1826
"inherits": ["_ci-macos-gcc", "_ci-release"]
1927
},
2028
{
21-
"name": "ci-ubuntu-clang-release",
22-
"inherits": ["_ci-ubuntu-clang", "_ci-release", "_ci-clang-tidy"]
29+
"name": "ci-ubuntu-clang-libstdc++-release",
30+
"inherits": [
31+
"_ci-ubuntu-clang-libstdc++",
32+
"_ci-release",
33+
"_ci-clang-tidy"
34+
]
2335
},
2436
{
25-
"name": "_ci-macos-clang",
37+
"name": "_ci-macos-clang-libc++",
38+
"hidden": true,
39+
"inherits": ["_ci-macos-clang-common", "_ci-clang-libc++"],
40+
"cacheVariables": {
41+
"CMAKE_CXX_FLAGS": "$env{PRESET_CXX_FLAGS_GCC_CLANG} $env{PRESET_CXX_FLAGS_LIBCPP_FOR_CLANG}"
42+
}
43+
},
44+
{
45+
"name": "_ci-macos-clang-libstdc++",
2646
"hidden": true,
2747
"inherits": [
28-
"gcc-clang-flags",
29-
"_ci-common",
30-
"_ci-clang",
48+
"_ci-macos-clang-common",
3149
"_ci-gcc-libstdc++-for-clang-common",
3250
"_ci-gcc-libstdc++-for-clang-macos"
3351
],
3452
"cacheVariables": {
3553
"CMAKE_CXX_FLAGS": "$env{PRESET_CXX_FLAGS_GCC_CLANG} $env{PRESET_CXX_FLAGS_LIBSTDCPP_FOR_CLANG_COMMON} $env{PRESET_CXX_FLAGS_LIBSTDCPP_FOR_CLANG_MACOS}"
3654
}
3755
},
56+
{
57+
"name": "_ci-macos-clang-common",
58+
"hidden": true,
59+
"inherits": ["gcc-clang-flags", "_ci-common", "_ci-clang"]
60+
},
3861
{
3962
"name": "_ci-macos-gcc",
4063
"hidden": true,
@@ -44,7 +67,7 @@
4467
}
4568
},
4669
{
47-
"name": "_ci-ubuntu-clang",
70+
"name": "_ci-ubuntu-clang-libstdc++",
4871
"hidden": true,
4972
"inherits": [
5073
"gcc-clang-flags",
@@ -100,6 +123,18 @@
100123
"CMAKE_CXX_CLANG_TIDY": "$penv{HOMEBREW_PREFIX}/opt/llvm/bin/clang-tidy"
101124
}
102125
},
126+
{
127+
"name": "_ci-clang-libc++",
128+
"hidden": true,
129+
"environment": {
130+
"PRESET_CXX_FLAGS_LIBCPP_FOR_CLANG": "-stdlib++-isystem$penv{HOMEBREW_PREFIX}/opt/llvm/include/c++/v1"
131+
},
132+
"cacheVariables": {
133+
"CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++ -L$penv{HOMEBREW_PREFIX}/opt/llvm/lib/c++ -L$penv{HOMEBREW_PREFIX}/opt/llvm/lib/unwind -lunwind",
134+
"CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libc++ -L$penv{HOMEBREW_PREFIX}/opt/llvm/lib/c++ -L$penv{HOMEBREW_PREFIX}/opt/llvm/lib/unwind -lunwind",
135+
"CONAN_HOST_PROFILE": "${sourceDir}/conan-profile-clang-with-libc++;auto-cmake"
136+
}
137+
},
103138
{
104139
"name": "_ci-gcc-libstdc++-for-clang-common",
105140
"hidden": true,
@@ -129,136 +164,188 @@
129164
],
130165
"buildPresets": [
131166
{
132-
"name": "ci-macos-clang-debug",
133-
"configurePreset": "ci-macos-clang-debug"
167+
"name": "ci-macos-clang-libc++-debug",
168+
"configurePreset": "ci-macos-clang-libc++-debug"
169+
},
170+
{
171+
"name": "ci-macos-clang-libc++-release",
172+
"configurePreset": "ci-macos-clang-libc++-release"
134173
},
135174
{
136-
"name": "ci-macos-clang-release",
137-
"configurePreset": "ci-macos-clang-release"
175+
"name": "ci-macos-clang-libstdc++-debug",
176+
"configurePreset": "ci-macos-clang-libstdc++-debug"
138177
},
139178
{
140-
"name": "ci-macos-gcc-debug",
141-
"configurePreset": "ci-macos-gcc-debug"
179+
"name": "ci-macos-clang-libstdc++-release",
180+
"configurePreset": "ci-macos-clang-libstdc++-release"
142181
},
143182
{
144-
"name": "ci-macos-gcc-release",
145-
"configurePreset": "ci-macos-gcc-release"
183+
"name": "ci-macos-gcc-libstdc++-debug",
184+
"configurePreset": "ci-macos-gcc-libstdc++-debug"
146185
},
147186
{
148-
"name": "ci-ubuntu-clang-release",
149-
"configurePreset": "ci-ubuntu-clang-release"
187+
"name": "ci-macos-gcc-libstdc++-release",
188+
"configurePreset": "ci-macos-gcc-libstdc++-release"
189+
},
190+
{
191+
"name": "ci-ubuntu-clang-libstdc++-release",
192+
"configurePreset": "ci-ubuntu-clang-libstdc++-release"
150193
}
151194
],
152195
"testPresets": [
153196
{
154-
"name": "ci-macos-clang-debug",
155-
"configurePreset": "ci-macos-clang-debug",
197+
"name": "ci-macos-clang-libc++-debug",
198+
"configurePreset": "ci-macos-clang-libc++-debug",
199+
"inherits": ["output-on-failure"]
200+
},
201+
{
202+
"name": "ci-macos-clang-libc++-release",
203+
"configurePreset": "ci-macos-clang-libc++-release",
204+
"inherits": ["output-on-failure"]
205+
},
206+
{
207+
"name": "ci-macos-clang-libstdc++-debug",
208+
"configurePreset": "ci-macos-clang-libstdc++-debug",
156209
"inherits": ["output-on-failure"]
157210
},
158211
{
159-
"name": "ci-macos-clang-release",
160-
"configurePreset": "ci-macos-clang-release",
212+
"name": "ci-macos-clang-libstdc++-release",
213+
"configurePreset": "ci-macos-clang-libstdc++-release",
161214
"inherits": ["output-on-failure"]
162215
},
163216
{
164-
"name": "ci-macos-gcc-debug",
165-
"configurePreset": "ci-macos-gcc-debug",
217+
"name": "ci-macos-gcc-libstdc++-debug",
218+
"configurePreset": "ci-macos-gcc-libstdc++-debug",
166219
"inherits": ["output-on-failure"]
167220
},
168221
{
169-
"name": "ci-macos-gcc-release",
170-
"configurePreset": "ci-macos-gcc-release",
222+
"name": "ci-macos-gcc-libstdc++-release",
223+
"configurePreset": "ci-macos-gcc-libstdc++-release",
171224
"inherits": ["output-on-failure"]
172225
},
173226
{
174-
"name": "ci-ubuntu-clang-release",
175-
"configurePreset": "ci-ubuntu-clang-release",
227+
"name": "ci-ubuntu-clang-libstdc++-release",
228+
"configurePreset": "ci-ubuntu-clang-libstdc++-release",
176229
"inherits": ["output-on-failure"]
177230
}
178231
],
179232
"workflowPresets": [
180233
{
181-
"name": "ci-macos-clang-debug",
234+
"name": "ci-macos-clang-libc++-debug",
235+
"steps": [
236+
{
237+
"type": "configure",
238+
"name": "ci-macos-clang-libc++-debug"
239+
},
240+
{
241+
"type": "build",
242+
"name": "ci-macos-clang-libc++-debug"
243+
},
244+
{
245+
"type": "test",
246+
"name": "ci-macos-clang-libc++-debug"
247+
}
248+
]
249+
},
250+
{
251+
"name": "ci-macos-clang-libc++-release",
252+
"steps": [
253+
{
254+
"type": "configure",
255+
"name": "ci-macos-clang-libc++-release"
256+
},
257+
{
258+
"type": "build",
259+
"name": "ci-macos-clang-libc++-release"
260+
},
261+
{
262+
"type": "test",
263+
"name": "ci-macos-clang-libc++-release"
264+
}
265+
]
266+
},
267+
{
268+
"name": "ci-macos-clang-libstdc++-debug",
182269
"steps": [
183270
{
184271
"type": "configure",
185-
"name": "ci-macos-clang-debug"
272+
"name": "ci-macos-clang-libstdc++-debug"
186273
},
187274
{
188275
"type": "build",
189-
"name": "ci-macos-clang-debug"
276+
"name": "ci-macos-clang-libstdc++-debug"
190277
},
191278
{
192279
"type": "test",
193-
"name": "ci-macos-clang-debug"
280+
"name": "ci-macos-clang-libstdc++-debug"
194281
}
195282
]
196283
},
197284
{
198-
"name": "ci-macos-clang-release",
285+
"name": "ci-macos-clang-libstdc++-release",
199286
"steps": [
200287
{
201288
"type": "configure",
202-
"name": "ci-macos-clang-release"
289+
"name": "ci-macos-clang-libstdc++-release"
203290
},
204291
{
205292
"type": "build",
206-
"name": "ci-macos-clang-release"
293+
"name": "ci-macos-clang-libstdc++-release"
207294
},
208295
{
209296
"type": "test",
210-
"name": "ci-macos-clang-release"
297+
"name": "ci-macos-clang-libstdc++-release"
211298
}
212299
]
213300
},
214301
{
215-
"name": "ci-macos-gcc-debug",
302+
"name": "ci-macos-gcc-libstdc++-debug",
216303
"steps": [
217304
{
218305
"type": "configure",
219-
"name": "ci-macos-gcc-debug"
306+
"name": "ci-macos-gcc-libstdc++-debug"
220307
},
221308
{
222309
"type": "build",
223-
"name": "ci-macos-gcc-debug"
310+
"name": "ci-macos-gcc-libstdc++-debug"
224311
},
225312
{
226313
"type": "test",
227-
"name": "ci-macos-gcc-debug"
314+
"name": "ci-macos-gcc-libstdc++-debug"
228315
}
229316
]
230317
},
231318
{
232-
"name": "ci-macos-gcc-release",
319+
"name": "ci-macos-gcc-libstdc++-release",
233320
"steps": [
234321
{
235322
"type": "configure",
236-
"name": "ci-macos-gcc-release"
323+
"name": "ci-macos-gcc-libstdc++-release"
237324
},
238325
{
239326
"type": "build",
240-
"name": "ci-macos-gcc-release"
327+
"name": "ci-macos-gcc-libstdc++-release"
241328
},
242329
{
243330
"type": "test",
244-
"name": "ci-macos-gcc-release"
331+
"name": "ci-macos-gcc-libstdc++-release"
245332
}
246333
]
247334
},
248335
{
249-
"name": "ci-ubuntu-clang-release",
336+
"name": "ci-ubuntu-clang-libstdc++-release",
250337
"steps": [
251338
{
252339
"type": "configure",
253-
"name": "ci-ubuntu-clang-release"
340+
"name": "ci-ubuntu-clang-libstdc++-release"
254341
},
255342
{
256343
"type": "build",
257-
"name": "ci-ubuntu-clang-release"
344+
"name": "ci-ubuntu-clang-libstdc++-release"
258345
},
259346
{
260347
"type": "test",
261-
"name": "ci-ubuntu-clang-release"
348+
"name": "ci-ubuntu-clang-libstdc++-release"
262349
}
263350
]
264351
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% set prefix = os.environ["HOMEBREW_PREFIX"] %}
2+
3+
[conf]
4+
tools.build:cxxflags=["-stdlib++-isystem{{ prefix }}/opt/llvm/include/c++/v1"]
5+
tools.build:exelinkflags=["-stdlib=libc++", "-L{{ prefix }}/opt/llvm/lib/c++"]
6+
tools.build:sharedlinkflags=["-stdlib=libc++", "-L{{ prefix }}/opt/llvm/lib/c++"]

.github/workflows/cpp-build-test-run.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ jobs:
2424
compiler:
2525
- clang
2626
- gcc
27+
cxxLib:
28+
- libc++
29+
- libstdc++
2730
buildType:
2831
- debug
2932
- release
33+
exclude:
34+
- compiler: gcc
35+
cxxLib: libc++
3036
include:
3137
- os: macos
3238
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-macos }}
@@ -35,19 +41,20 @@ jobs:
3541
- os: ubuntu
3642

3743
compiler: clang
44+
cxxLib: libstdc++
3845
buildType: release
3946
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-ubuntu }}
4047
runsOn: ubuntu-24.04
4148

42-
name: ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.buildType }} - Build + test + run
49+
name: ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.cxxLib }} ${{ matrix.buildType }} - Build + test + run
4350
runs-on: ${{ matrix.runsOn }}
4451
timeout-minutes: 30
4552

4653
steps:
4754
- name: Define workflow preset name
4855
id: preset-name
4956
run: |
50-
name="ci-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.buildType }}"
57+
name="ci-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.cxxLib }}-${{ matrix.buildType }}"
5158
echo "name=${name}" | tee -a "${GITHUB_OUTPUT}"
5259
shell: bash
5360

0 commit comments

Comments
 (0)