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
+36
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
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