-
Notifications
You must be signed in to change notification settings - Fork 17
Feat: Prepare CXX_MODULES tests #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
eee6798
8589b36
42a521e
48dcb8a
0e6bb8b
c70e096
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,38 +31,39 @@ endif | |
| LDFLAGS ?= | ||
| SAN_FLAGS ?= | ||
| CXX_FLAGS ?= -g | ||
| # TODO: SANITIZER := release | ||
| SANITIZER ?= default | ||
| # Note: disabled while working on CXX_MODULES! CK | ||
| # XXX: NO! SANITIZER := release | ||
| SANITIZER ?= RelWithDebInfo | ||
| SOURCEDIR = $(CURDIR) | ||
| BUILDROOT = build | ||
| export hostSystemName:=$(shell uname -s) | ||
| # TODO BUILD := $(BUILDROOT)/$(SANITIZER) | ||
| BUILD := $(BUILDROOT)/$(SANITIZER) | ||
| BUILD ?= $(BUILDROOT)/$(hostSystemName)/$(SANITIZER) | ||
| EXAMPLE = beman.execution.examples.stop_token | ||
|
|
||
| ################################################ | ||
| ifeq (${hostSystemName},Darwin) | ||
| export LLVM_PREFIX:=$(shell brew --prefix llvm) | ||
| export LLVM_PREFIX:=$(shell brew --prefix llvm) | ||
| export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) | ||
| export PATH:=${LLVM_DIR}/bin:${PATH} | ||
|
|
||
| # export CMAKE_CXX_STDLIB_MODULES_JSON=${LLVM_DIR}/lib/c++/libc++.modules.json | ||
| # export CXX=clang++ | ||
| # export LDFLAGS=-L$(LLVM_DIR)/lib/c++ -lc++abi -lc++ # -lc++experimental | ||
| # export GCOV="llvm-cov gcov" | ||
| export CMAKE_CXX_STDLIB_MODULES_JSON=${LLVM_DIR}/lib/c++/libc++.modules.json | ||
| export CXX=clang++ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would prefer if the compiler were not defaulted like this in the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
as long the you my try it in cmake code like here: https://github.com/ClausKlein/cmake-init-modules/blob/develop/cmake/prelude.cmake |
||
| export LDFLAGS=-L$(LLVM_DIR)/lib/c++ -lc++abi # NO! -lc++ -lc++experimental | ||
| export GCOV="llvm-cov gcov" | ||
|
|
||
| ### TODO: to test g++-15: | ||
| export GCC_PREFIX:=$(shell brew --prefix gcc) | ||
| export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) | ||
|
|
||
| export CMAKE_CXX_STDLIB_MODULES_JSON=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json | ||
| export CXX:=g++-15 | ||
| export CXXFLAGS:=-stdlib=libstdc++ | ||
| export GCOV="gcov" | ||
| # export CMAKE_CXX_STDLIB_MODULES_JSON=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json | ||
| # export CXX:=g++-15 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least, I prefer
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an option you may change like you want, also the version may be changed a you need. |
||
| # export CXXFLAGS:=-stdlib=libstdc++ | ||
| # export GCOV="gcov" | ||
| else ifeq (${hostSystemName},Linux) | ||
| export LLVM_DIR=/usr/lib/llvm-20 | ||
| export LLVM_DIR=/usr/lib/llvm-22 | ||
| export PATH:=${LLVM_DIR}/bin:${PATH} | ||
| export CXX=clang++-20 | ||
| export CXX=clang++-22 | ||
| else | ||
| export CXX=$(COMPILER) | ||
| endif | ||
|
|
@@ -94,33 +95,50 @@ ifeq ($(SANITIZER),lsan) | |
| LDFLAGS = $(SAN_FLAGS) | ||
| endif | ||
|
|
||
| # TODO: beman.execution.examples.modules | ||
| # FIXME: beman.execution.execution-module.test beman.execution.stop-token-module.test | ||
| .PHONY: help FIXME TODO | ||
| help: | ||
| @echo "Use one of the folling targets:" | ||
| @echo "" | ||
| @echo "build -> use CXX_MODULES if possible" | ||
| @echo "test -> build and test " | ||
| @echo "debug -> preset with 'import std;'" | ||
| @echo "release -> preset with 'import std;'" | ||
| @echo "doc" | ||
| @echo "clean" | ||
| @echo "format" | ||
| @echo "distclean" | ||
|
|
||
| default: test | ||
| # TODO: beman.execution.examples.modules | ||
| FIXME: beman.execution.execution-module.test beman.execution.stop-token-module.test | ||
|
|
||
| all: $(SANITIZERS) | ||
| # Note: disabled while working on CXX_MODULES! CK | ||
| # XXX: NO! $(SANITIZER): test | ||
| # XXX all: $(SANITIZERS) | ||
|
|
||
| run: test | ||
| ./$(BUILD)/examples/$(EXAMPLE) | ||
|
|
||
| doc: | ||
| doxygen docs/Doxyfile | ||
|
|
||
| # Note: disabled while working on CXX_MODULES! CK | ||
| # $(SANITIZERS): | ||
| # $(MAKE) SANITIZER=$@ | ||
|
|
||
| build: | ||
| cmake --fresh -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ | ||
| cmake -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ | ||
| -D CMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -D CMAKE_SKIP_INSTALL_RULES=ON \ | ||
| -D CMAKE_CXX_STANDARD=23 \ | ||
| -D CMAKE_CXX_EXTENSIONS=ON \ | ||
| -D CMAKE_CXX_STANDARD_REQUIRED=ON \ | ||
| -D CMAKE_CXX_COMPILER=$(CXX) # XXX -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)" | ||
| -D CMAKE_CXX_SCAN_FOR_MODULES=ON \ | ||
| -D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=OFF \ | ||
| -D CMAKE_BUILD_TYPE=$(SANITIZER) \ | ||
| -D CMAKE_CXX_COMPILER=$(CXX) # XXX --fresh -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)" | ||
| cmake --build $(BUILD) | ||
|
|
||
| # NOTE: without install, see CMAKE_SKIP_INSTALL_RULES! CK | ||
| # NOTE: may w/o enabled install, see CMAKE_SKIP_INSTALL_RULES! CK | ||
| test: build | ||
| ctest --test-dir $(BUILD) --rerun-failed --output-on-failure | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "version": 6, | ||
| "version": 9, | ||
| "configurePresets": [ | ||
| { | ||
| "name": "root-config", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "version": 6, | ||
| "version": 9, | ||
| "include": [ | ||
| "CMakeGenericPresets.json" | ||
| ], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should/could this section be conditional on whether modules are available/enabled? It looks as if this is unconditionally set up. I believe
beman::executionis currently build with multiple C++ standards.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need a target to set
target_compile_features()