Remove modules Jamfile: it doesn't work.

Add shell script for testing modules with clang.
This commit is contained in:
jzmaddock
2024-04-06 13:57:40 +01:00
parent 15acbd5117
commit ba61613eff
4 changed files with 82 additions and 1 deletions

View File

@ -134,6 +134,41 @@ jobs:
- name: Test
run: ../../../b2 toolset=$TOOLSET define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/regex/test
ubuntu-jammy-clang-18-modules:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter-separator: ';'
fail-fast: true
- name: Add repository
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Install packages
run: sudo apt install clang-18
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: cp -r $GITHUB_WORKSPACE/* libs/regex
working-directory: ../boost-root
- name: Install deps
run: python tools/boostdep/depinst/depinst.py -I example -g "--jobs 3" regex
working-directory: ../boost-root
- name: Bootstrap
run: ./bootstrap.sh
working-directory: ../boost-root
- name: Generate headers
run: ./b2 headers
working-directory: ../boost-root
- name: Test
run: ./test.sh ./config/clang.sh
working-directory: ../boost-root/libs/regex/test/module
macos:
runs-on: macos-latest
strategy:

View File

@ -110,7 +110,6 @@ run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh ../build//icu_options : :
compile test_consolidated.cpp ;
build-project ../example ;
build-project ./module ;
# `quick` target (for CI)
run quick.cpp ../build//boost_regex ;

View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# Arguments are:
#
# 1) A space spearated list of source files.
# 2) A space separated list of module source files.
# 3) The name of the executable to build.
#
# Environment variables used are:
#
# CXX - the name of the clang compiler, defaults to clang++.
# CXXFLAGS - flags to pass to the build, defaults to "-std=c++20 -g".
# LINKFLAGS - flags to pass to the link stage, defaults to "".
# LIBRARIES - Additional libraries to add to the end of the link command line, defaults to "".
#
: ${CXX:="clang++"}
: ${CXXFLAGS:="-std=c++20 -g"}
module_usage=""
for module_file in $2; do
module_base="${module_file%.*}"
$CXX $CXXFLAGS -x c++-module $module_file --precompile -o $module_base.pcm || exit 1
# grab the name of the exported module from the source:
cxx_module_name=$(grep -E "export[ ]+module[ ]+([^; ]+)" $module_file | sed -r "s/export[ ]+module[ ]+([^; ]+)[ ]*;/\1/")
# Build the command line for module usage:
module_usage="$module_usage -fmodule-file=$cxx_module_name=$module_base.pcm $module_base.pcm"
done
# Build the actual executable:
$CXX $CXXFLAGS $1 $module_usage -o $3 || exit 1

11
test/module/test.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Builds all of the tests in this folder using the supplied compiler-specific script in $1
#
for file in *.cpp; do
CXXFLAGS="-std=c++20 -g -I ../../../.." $1 $file ../../module/regex.cxx "${file%.*}.exe" || exit 1
done