Skip to content

Commit 334794b

Browse files
committed
test: Do a minimal test to try to build the libcxx std c++ module
1 parent 74e4571 commit 334794b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
# llvm-mingw).
8686
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
8787
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
88+
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
8889
RUN_I686=false RUN_X86_64=false ./run-tests.sh $(pwd)/install/llvm-mingw
8990
cd install
9091
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
@@ -129,6 +130,7 @@ jobs:
129130
- name: Test using the cross-built assembled toolchain
130131
run: |
131132
sudo apt-get update && sudo apt-get install qemu-user-static libc6-arm64-cross libstdc++6-arm64-cross
133+
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
132134
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu RUN_I686=false RUN_X86_64=false ./run-tests.sh $(pwd)/install/llvm-mingw
133135
- name: Package the toolchain
134136
env:
@@ -206,6 +208,7 @@ jobs:
206208
# other (arm64) architecture form.
207209
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
208210
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
211+
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
209212
RUN_I686=false RUN_X86_64=false ./run-tests.sh $(pwd)/install/llvm-mingw
210213
cd install
211214
NAME=llvm-mingw-$TAG-ucrt-macos-universal
@@ -263,6 +266,7 @@ jobs:
263266
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ARGS
264267
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
265268
./copy-msys-dependencies.sh $(pwd)/install/llvm-mingw ${{matrix.sys}}
269+
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
266270
./run-tests.sh $(pwd)/install/llvm-mingw
267271
cd install
268272
NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}}
@@ -358,6 +362,7 @@ jobs:
358362
- uses: actions/checkout@v4
359363
- name: Run tests
360364
run: |
365+
./test-libcxx-module.sh /llvm-mingw
361366
./run-tests.sh /llvm-mingw
362367
./run-lldb-tests.sh /llvm-mingw
363368

test-libcxx-module.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2024 Martin Storsjo
4+
#
5+
# Permission to use, copy, modify, and/or distribute this software for any
6+
# purpose with or without fee is hereby granted, provided that the above
7+
# copyright notice and this permission notice appear in all copies.
8+
#
9+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
17+
set -ex
18+
19+
if [ $# -lt 1 ]; then
20+
echo $0 prefix
21+
exit 1
22+
fi
23+
PREFIX="$1"
24+
PREFIX="$(cd "$PREFIX" && pwd)"
25+
export PATH=$PREFIX/bin:$PATH
26+
27+
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
28+
29+
for arch in $ARCHS; do
30+
# TODO: This should ideally use "$CXX -print-file-name=libc++.modules.json", then parse the json to find the relevant cppm file and include directory.
31+
$arch-w64-mingw32-clang++ -I$PREFIX/share/libc++/v1 -std=gnu++23 -Wno-reserved-module-identifier -x c++-module -fmodule-output=std.pcm -o std.cppm.obj -c $PREFIX/share/libc++/v1/std.cppm
32+
$arch-w64-mingw32-clang++ -I$PREFIX/share/libc++/v1 -std=gnu++23 -Wno-reserved-module-identifier -x c++-module -fmodule-output=std.compat.pcm -fmodule-file=std=std.pcm -o std.compat.cppm.obj -c $PREFIX/share/libc++/v1/std.compat.cppm
33+
done

0 commit comments

Comments
 (0)