summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Pikuła <m.pikula@partner.samsung.com>2024-08-27 15:55:30 +0200
committerMarek Pikuła <m.pikula@partner.samsung.com>2024-09-03 18:21:01 +0200
commit51dcfb8027f131fc4f11ab2b295d182c830ff59d (patch)
tree12443275779a04bc9aefa68bada33b2d9e128aae
parentc0ee08aab0b0b38384d89eb5fb1ccc0d9b31a146 (diff)
ci: Add support for LLVM for Windows targets
It uses LLVM MinGW project to get the precompiled LLVM toolchain for cross-compilation. Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
-rw-r--r--.gitlab-ci.d/01-docker/Dockerfile9
-rw-r--r--.gitlab-ci.d/02-build.yml3
-rw-r--r--.gitlab-ci.d/03-test.yml3
-rw-r--r--.gitlab-ci.d/meson-cross/windows-686-llvm.meson18
-rw-r--r--.gitlab-ci.d/meson-cross/windows-amd64-llvm.meson20
5 files changed, 47 insertions, 6 deletions
diff --git a/.gitlab-ci.d/01-docker/Dockerfile b/.gitlab-ci.d/01-docker/Dockerfile
index ef57661..ac01b89 100644
--- a/.gitlab-ci.d/01-docker/Dockerfile
+++ b/.gitlab-ci.d/01-docker/Dockerfile
@@ -96,6 +96,8 @@ RUN ${APT_UPDATE} \
# should use the same cache layers, so in the end it makes the collective image
# size smaller.
FROM base AS windows-base
+ARG LLVM_MINGW_RELEASE=20240619
+ARG LLVM_MINGW_VARIANT=llvm-mingw-${LLVM_MINGW_RELEASE}-msvcrt-ubuntu-20.04-x86_64
RUN dpkg --add-architecture i386 \
&& ${APT_UPDATE} \
&& ${APT_INSTALL} \
@@ -106,7 +108,13 @@ RUN dpkg --add-architecture i386 \
wine \
wine32 \
wine64 \
+ wget \
&& ${APT_CLEANUP} \
+ # Install llvm-mingw.
+ && cd /opt \
+ && wget https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_RELEASE}/${LLVM_MINGW_VARIANT}.tar.xz \
+ && tar -xf ${LLVM_MINGW_VARIANT}.tar.xz \
+ && rm -f ${LLVM_MINGW_VARIANT}.tar.xz \
# Inspired by https://code.videolan.org/videolan/docker-images
&& wine wineboot --init \
&& while pgrep wineserver > /dev/null; do \
@@ -114,6 +122,7 @@ RUN dpkg --add-architecture i386 \
sleep 1; \
done \
&& rm -rf /tmp/wine-*
+ENV PATH=${PATH}:/opt/${LLVM_MINGW_VARIANT}/bin
FROM windows-base AS windows-686
FROM windows-base AS windows-amd64
diff --git a/.gitlab-ci.d/02-build.yml b/.gitlab-ci.d/02-build.yml
index 86f1e09..c6fb235 100644
--- a/.gitlab-ci.d/02-build.yml
+++ b/.gitlab-ci.d/02-build.yml
@@ -85,14 +85,11 @@ include:
inputs:
target: linux-riscv64
qemu_cpu: rv64,v=true,vext_spec=v1.0,vlen=256,elen=64
- # Windows targets don't directly support LLVM at this moment.
- local: .gitlab-ci.d/templates/build.yml
inputs:
target: windows-686
- toolchain: [gnu]
enable_gnu_coverage: false
- local: .gitlab-ci.d/templates/build.yml
inputs:
target: windows-amd64
- toolchain: [gnu]
enable_gnu_coverage: false
diff --git a/.gitlab-ci.d/03-test.yml b/.gitlab-ci.d/03-test.yml
index 1b352af..ee144d8 100644
--- a/.gitlab-ci.d/03-test.yml
+++ b/.gitlab-ci.d/03-test.yml
@@ -154,11 +154,9 @@ include:
- rv64,v=true,vext_spec=v1.0,vlen=256,elen=64
- rv64,v=true,vext_spec=v1.0,vlen=512,elen=64
- rv64,v=true,vext_spec=v1.0,vlen=1024,elen=64
- # For now, only GNU toolchain is supported for Windows.
- local: .gitlab-ci.d/templates/test.yml
inputs:
target: windows-686
- toolchain: [gnu]
pixman_disable:
# The same as for linux-386.
- "sse2 ssse3"
@@ -167,7 +165,6 @@ include:
- local: .gitlab-ci.d/templates/test.yml
inputs:
target: windows-amd64
- toolchain: [gnu]
pixman_disable:
# The same as for linux-amd64.
- ""
diff --git a/.gitlab-ci.d/meson-cross/windows-686-llvm.meson b/.gitlab-ci.d/meson-cross/windows-686-llvm.meson
new file mode 100644
index 0000000..5c81322
--- /dev/null
+++ b/.gitlab-ci.d/meson-cross/windows-686-llvm.meson
@@ -0,0 +1,18 @@
+[binaries]
+c = 'i686-w64-mingw32-clang'
+ar = 'i686-w64-mingw32-llvm-ar'
+strip = 'i686-w64-mingw32-strip'
+windres = 'i686-w64-mingw32-windres'
+exe_wrapper = 'wine'
+
+[built-in options]
+c_link_args = ['-static']
+
+[project options]
+openmp = 'disabled'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
diff --git a/.gitlab-ci.d/meson-cross/windows-amd64-llvm.meson b/.gitlab-ci.d/meson-cross/windows-amd64-llvm.meson
new file mode 100644
index 0000000..8f353fc
--- /dev/null
+++ b/.gitlab-ci.d/meson-cross/windows-amd64-llvm.meson
@@ -0,0 +1,20 @@
+[binaries]
+c = 'x86_64-w64-mingw32-clang'
+ar = 'x86_64-w64-mingw32-llvm-ar'
+strip = 'x86_64-w64-mingw32-strip'
+windres = 'x86_64-w64-mingw32-windres'
+exe_wrapper = 'wine'
+
+[built-in options]
+# Static linking is a workaround around `libwinpthread-1` not being discovered correctly.
+c_link_args = ['-static']
+
+[project options]
+# OpenMP is disabled as it is not being discovered correctly during tests.
+openmp = 'disabled'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'