@@ -23,75 +23,93 @@ jobs:
23
23
matrix :
24
24
include :
25
25
26
- - job_name : macOS x86_64_1
27
- os : macos-13
28
- arch : x86_64
29
- # https://github.com/ldc-developers/ldc/issues/4462:
30
- # When using LTO, we need to explicitly export ~all symbols for plugin support via `ld64 -exported_symbol '__*'`.
31
- # Additionally `-w` to suppress resulting linker warnings.
32
- extra_cmake_flags : >-
33
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
34
- -DEXTRA_CXXFLAGS=-flto=full
35
- with_pgo : true
36
- - job_name : macOS x86_64_2
37
- os : macos-13
26
+ - job_name : Linux x86_64 multilib
27
+ os : ubuntu-22.04
38
28
arch : x86_64
29
+ # To improve portability of the generated binaries, link the C++ standard library statically.
39
30
extra_cmake_flags : >-
40
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
31
+ -DMULTILIB=ON
32
+ -DCMAKE_C_COMPILER=clang
33
+ -DCMAKE_CXX_COMPILER=clang++
34
+ -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
35
+ -DJITRT_EXTRA_LDFLAGS=-static-libstdc++
36
+ -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
41
37
-DEXTRA_CXXFLAGS=-flto=full
42
38
with_pgo : true
43
- - job_name : macOS x86_64_3
44
- os : macos-13
45
- arch : x86_64
39
+
40
+ - job_name : Linux aarch64
41
+ os : ubuntu-22.04-arm
42
+ arch : aarch64
46
43
extra_cmake_flags : >-
47
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
44
+ -DCMAKE_C_COMPILER=clang
45
+ -DCMAKE_CXX_COMPILER=clang++
46
+ -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
47
+ -DJITRT_EXTRA_LDFLAGS=-static-libstdc++
48
+ -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
48
49
-DEXTRA_CXXFLAGS=-flto=full
49
50
with_pgo : true
50
- - job_name : macOS x86_64_4
51
- os : macos-13
51
+
52
+ - job_name : Alpine musl x86_64
53
+ os : ubuntu-latest
54
+ container_image : alpine:3.21
52
55
arch : x86_64
56
+ base_cmake_flags : >-
57
+ -DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=x86_64
58
+ -DLLVM_IS_SHARED=OFF
59
+ -DLDC_ENABLE_PLUGINS=OFF
60
+ -DLDC_DYNAMIC_COMPILE=OFF
61
+ # TSan and XRay do not work.
53
62
extra_cmake_flags : >-
54
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
63
+ -DTEST_COMPILER_RT_LIBRARIES="profile;lsan;asan;msan;fuzzer"
64
+ -DLDC_INSTALL_LTOPLUGIN=OFF
65
+ -DLDC_FULLY_STATIC=ON
66
+ -DCMAKE_C_COMPILER=clang
67
+ -DCMAKE_CXX_COMPILER=clang++
68
+ -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
69
+ -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
55
70
-DEXTRA_CXXFLAGS=-flto=full
56
71
with_pgo : true
57
- - job_name : macOS x86_64_5
72
+
73
+ - job_name : macOS x86_64
58
74
os : macos-13
59
75
arch : x86_64
76
+ # https://github.com/ldc-developers/ldc/issues/4462:
77
+ # When using LTO, we need to explicitly export ~all symbols for plugin support via `ld64 -exported_symbol '__*'`.
78
+ # Additionally `-w` to suppress resulting linker warnings.
60
79
extra_cmake_flags : >-
61
80
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
62
81
-DEXTRA_CXXFLAGS=-flto=full
63
82
with_pgo : true
64
83
65
- - job_name : macOS arm64_1
84
+ - job_name : macOS arm64
66
85
os : macos-14
67
86
arch : arm64
68
87
extra_cmake_flags : >-
69
88
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
70
89
# -DEXTRA_CXXFLAGS=-flto=full
71
90
with_pgo : true
72
- - job_name : macOS arm64_2
73
- os : macos-14
74
- arch : arm64
75
- extra_cmake_flags : >-
76
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
77
- with_pgo : true
78
- - job_name : macOS arm64_3
79
- os : macos-14
80
- arch : arm64
81
- extra_cmake_flags : >-
82
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
83
- with_pgo : true
84
- - job_name : macOS arm64_4
85
- os : macos-14
86
- arch : arm64
91
+
92
+ - job_name : Windows x64
93
+ os : windows-2025
94
+ arch : x64
95
+ base_cmake_flags : >-
96
+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
87
97
extra_cmake_flags : >-
88
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
98
+ "-DD_COMPILER_FLAGS=-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
99
+ -DEXTRA_CXXFLAGS=-flto=full
89
100
with_pgo : true
90
- - job_name : macOS arm64_5
91
- os : macos-14
92
- arch : arm64
101
+
102
+ - job_name : Windows x86
103
+ os : windows-2025
104
+ arch : x86
105
+ base_cmake_flags : >-
106
+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
107
+ # `RT_CFLAGS=-m32` needed to make 64-bit clang-cl output 32-bit code for druntime integration tests
93
108
extra_cmake_flags : >-
94
- -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
109
+ -DRT_CFLAGS=-m32
110
+ # Undefined symbol errors with FullLTO; ThinLTO used to work, but apparently miscompiles a lexer.d:138 assertion since v1.33.
111
+ # "-DD_COMPILER_FLAGS=-O -flto=thin -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
112
+ # -DEXTRA_CXXFLAGS=-flto=thin
95
113
with_pgo : true
96
114
97
115
name : ${{ matrix.job_name }}
@@ -207,3 +225,112 @@ jobs:
207
225
with :
208
226
arch : ${{ matrix.arch }}
209
227
os : ${{ startsWith(matrix.container_image, 'alpine') && 'alpine' || '' }}
228
+
229
+
230
+ # Cross-compilation jobs for non-native targets.
231
+ # druntime/Phobos/LDC unittests aren't built; all test stages are skipped.
232
+ build-cross :
233
+ strategy :
234
+ fail-fast : false
235
+ matrix :
236
+ include :
237
+
238
+ - job_name : Android armv7a
239
+ host_os : ubuntu-22.04
240
+ os : android
241
+ arch : armv7a
242
+ android_x86_arch : i686
243
+
244
+ - job_name : Android aarch64
245
+ host_os : ubuntu-22.04
246
+ os : android
247
+ arch : aarch64
248
+ android_x86_arch : x86_64
249
+ extra_cmake_flags : >-
250
+ -DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64-android
251
+
252
+ name : ${{ matrix.job_name }}
253
+ runs-on : ${{ matrix.host_os }}
254
+ timeout-minutes : 60
255
+ steps :
256
+ - uses : actions/checkout@v4
257
+ with :
258
+ submodules : true
259
+ fetch-depth : 50
260
+ - name : Install prerequisites
261
+ uses : ./.github/actions/1-setup
262
+ with :
263
+ llvm_version : ${{ env.LLVM_VERSION }}
264
+ arch : x86_64
265
+ - name : Build bootstrap LDC
266
+ uses : ./.github/actions/2-build-bootstrap
267
+ - name : Build LDC with PGO instrumentation & gather profile from compiling default libs
268
+ if : matrix.with_pgo
269
+ uses : ./.github/actions/2a-build-pgo
270
+ - name : Cross-compile LDC to ${{ matrix.os }}-${{ matrix.arch }}
271
+ uses : ./.github/actions/3-build-cross
272
+ with :
273
+ arch : ${{ matrix.arch }}
274
+ os : ${{ matrix.os }}
275
+ llvm_version : ${{ env.LLVM_VERSION }}
276
+ cmake_flags : ${{ matrix.extra_cmake_flags }}
277
+ with_pgo : ${{ matrix.with_pgo }}
278
+
279
+ - name : Install LDC & make portable
280
+ uses : ./.github/actions/5-install
281
+ with :
282
+ cross_compiling : true
283
+ - name : ' Android: Cross-compile ${{ matrix.android_x86_arch }} libraries & copy to install dir'
284
+ if : matrix.os == 'android'
285
+ uses : ./.github/actions/5a-android-x86
286
+ with :
287
+ arch : ${{ matrix.android_x86_arch }}
288
+
289
+ - name : Create package & upload artifact(s)
290
+ uses : ./.github/actions/7-package
291
+ with :
292
+ arch : ${{ matrix.arch }}
293
+ os : ${{ matrix.os }}
294
+ cross_target_triple : ${{ env.CROSS_TRIPLE }}
295
+
296
+
297
+ merge-macos :
298
+ name : macOS universal
299
+ runs-on : macos-latest
300
+ timeout-minutes : 30
301
+ needs : build-native
302
+ steps :
303
+ - uses : actions/checkout@v4
304
+ - name : Merge x86_64 & arm64 packages to universal one
305
+ uses : ./.github/actions/merge-macos
306
+
307
+ merge-windows :
308
+ name : Windows multilib
309
+ runs-on : windows-2025
310
+ timeout-minutes : 30
311
+ needs : build-native
312
+ steps :
313
+ - uses : actions/checkout@v4
314
+ with :
315
+ submodules : true
316
+ fetch-depth : 50
317
+ - name : Merge x64 & x86 packages to multilib one & build installer
318
+ uses : ./.github/actions/merge-windows
319
+
320
+
321
+ upload-to-github :
322
+ name : Upload to GitHub
323
+ if : startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
324
+ runs-on : ubuntu-latest
325
+ timeout-minutes : 30
326
+ needs :
327
+ - build-native
328
+ - build-cross
329
+ - merge-macos
330
+ - merge-windows
331
+ permissions :
332
+ contents : write
333
+ steps :
334
+ - uses : actions/checkout@v4
335
+ - name : Upload all artifacts to GitHub release
336
+ uses : ./.github/actions/upload-to-github
0 commit comments