diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5222c87d..d3b294e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d99fc5c9..ce33b554 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -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 ; diff --git a/test/module/config/clang.sh b/test/module/config/clang.sh new file mode 100644 index 00000000..d7e43dcc --- /dev/null +++ b/test/module/config/clang.sh @@ -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 diff --git a/test/module/test.sh b/test/module/test.sh new file mode 100644 index 00000000..65e51aee --- /dev/null +++ b/test/module/test.sh @@ -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