Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
"tests": [
{"cxxversions": ["c++26"],
"tests": [
{ "stdlibs": ["libstdc++", "libc++"],
{ "stdlibs": ["libc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Dynamic"
Expand All @@ -74,7 +74,7 @@ jobs:
},
{ "cxxversions": ["c++23"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
{"stdlibs": ["libc++"], "tests": ["Release.Default"]}
]
}
]
Expand All @@ -83,7 +83,7 @@ jobs:
"tests": [
{ "cxxversions": ["c++26", "c++23"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
{"stdlibs": ["libc++"], "tests": ["Release.Default"]}
]
}
]
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ repos:
# See also: https://github.com/ssciwr/clang-format-wheel
# Config file: .clang-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.7
rev: v21.1.8
hooks:
- id: clang-format
types_or: [c++, c, json]
exclude: docs/TODO.json

# CMake linting and formatting
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.23.2
rev: 0.25.3
hooks:
- id: gersemi
name: CMake linting
Expand All @@ -55,7 +55,7 @@ repos:
# Config file: pyproject.toml
# second Python code formatting
- repo: https://github.com/psf/black
rev: 25.11.0
rev: 26.1.0
hooks:
- id: black

Expand Down
33 changes: 27 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.25...4.2)

#========================== pre project settings ===============================
# gersemi: off
if(CMAKE_VERSION VERSION_EQUAL 4.2)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")

if(CMAKE_CXX_STDLIB_MODULES_JSON)
Expand Down Expand Up @@ -45,14 +45,14 @@ if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD)
message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}")
endif()

# gersemi: off
if(CMAKE_CXX_SCAN_FOR_MODULES AND ${CMAKE_GENERATOR} STREQUAL Ninja)
set(BEMAN_USE_MODULES ON)
message(STATUS "BEMAN_USE_MODULES=${BEMAN_USE_MODULES}")
else()
message(WARNING "Missing support for CMAKE_CXX_SCAN_FOR_MODULES!")
endif()

# gersemi: off
if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
message(
Expand All @@ -62,10 +62,31 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS)
endif()
# gersemi: on

# CMake requires the language standard to be specified as compile feature
# when a target provides C++23 modules and the target will be installed
add_library(${TARGET_NAME} STATIC)
target_compile_features(${TARGET_NAME} PUBLIC cxx_std_23)
if(BEMAN_USE_MODULES)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)

# CMake requires the language standard to be specified as compile feature
# when a target provides C++23 modules and the target will be installed
add_library(${TARGET_NAME} STATIC)
target_compile_features(${TARGET_NAME} PUBLIC cxx_std_${CMAKE_CXX_STANDARD})

include(GenerateExportHeader)

generate_export_header(
${TARGET_NAME}
BASE_NAME beman.execution
EXPORT_FILE_NAME beman/execution/modules_export.hpp
)
target_sources(
${TARGET_NAME}
PUBLIC
FILE_SET HEADERS
BASE_DIRS include ${CMAKE_CURRENT_BINARY_DIR}
FILES
${CMAKE_CURRENT_BINARY_DIR}/beman/execution/modules_export.hpp
)
endif()

if(BEMAN_USE_MODULES AND CMAKE_CXX_MODULE_STD)
target_compile_definitions(${TARGET_NAME} PUBLIC BEMAN_HAS_IMPORT_STD)
Expand Down
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"_debug-base"
],
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake"
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
}
},
{
Expand All @@ -72,7 +72,7 @@
"_release-base"
],
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake"
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
}
},
{
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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}

Expand All @@ -55,9 +55,9 @@ ifeq (${hostSystemName},Darwin)
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++
# XXX export CMAKE_CXX_STDLIB_MODULES_JSON=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json
export CXX=g++-15
export CXXFLAGS=-stdlib=libstdc++
Comment on lines +58 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to find an arrangement for these: I don't have g++ on my OSX systems because they are ARM based. I believe these two lines set the compiler and flags in a way which I also can't override, e.g., using environment variables.

export GCOV="gcov"
else ifeq (${hostSystemName},Linux)
export LLVM_DIR=/usr/lib/llvm-20
Expand Down Expand Up @@ -112,14 +112,15 @@ doc:
# $(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_SKIP_INSTALL_RULES=OFF \
-D CMAKE_CXX_STANDARD=23 \
-D CMAKE_CXX_EXTENSIONS=ON \
-D CMAKE_CXX_STANDARD_REQUIRED=ON \
-D CMAKE_CXX_SCAN_FOR_MODULES=ON \
-D CMAKE_CXX_COMPILER=$(CXX) # XXX -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)"
-D CMAKE_BUILD_TYPE=Release \
-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
Expand Down Expand Up @@ -167,6 +168,7 @@ codespell:
pre-commit run $@

format:
pre-commit autoupdate
pre-commit run --all

cmake-format:
Expand Down
18 changes: 13 additions & 5 deletions bin/mk-module.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ def clean_name(file):
headers = {}
beman_re = re.compile('#include ["<](?P<name>[bB]eman/.*)\.hpp[">]')
other_re = re.compile('#include ["<](?P<name>.*)[">]')
included_re = re.compile('.*INCLUDED_BEMAN.*')
file_re = re.compile('// include/beman\S*\s*-.-C..-.-')
spdx_re = re.compile('.*SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.*')

included_re = re.compile(".*INCLUDED_BEMAN.*")
file_re = re.compile("// include/beman\S*\s*-.-C..-.-")
spdx_re = re.compile(".*SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.*")


def include_this_line(line):
return not beman_re.match(line) and not other_re.match(line) and not included_re.match(line) and not file_re.match(line) and not spdx_re.match(line)
return (
not beman_re.match(line)
and not other_re.match(line)
and not included_re.match(line)
and not file_re.match(line)
and not spdx_re.match(line)
)


def get_dependencies(component):
Expand Down Expand Up @@ -78,6 +83,8 @@ def write_header(to, header):


deps = {}


def build_header(file, to, header):
todo = dependencies[header].copy()
while 0 < len(todo):
Expand All @@ -87,6 +94,7 @@ def build_header(file, to, header):
todo.append(new)
todo = todo[1:]


with open(module_file, "w") as to:
to.write("// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n\n")
to.write("module;\n\n")
Expand Down
4 changes: 4 additions & 0 deletions examples/modules.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// examples/modules.cpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// FIXME: does not compile with g++-15 on OSX! CK
#if defined(__APPLE__) && defined(__GNUC__)
#undef BEMAN_HAS_IMPORT_STD
#endif
Comment on lines +4 to +7
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dietmarkuehl Note this!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. This is a limitation we can hopefully fix in the future.

#ifdef BEMAN_HAS_IMPORT_STD
import std;
#else
Expand Down
7 changes: 3 additions & 4 deletions include/beman/execution/detail/transform_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ BEMAN_EXECUTION_EXPORT template <typename Domain, ::beman::execution::sender Sen
::std::same_as<::std::remove_cvref_t<Sender>,
::std::remove_cvref_t<decltype(::beman::execution::default_domain{}.transform_sender(
::std::declval<Sender>(), ::std::declval<Env>()...))>>
constexpr auto transform_sender(Domain,
Sender&& sender,
const Env&...) noexcept(noexcept(::std::forward<Sender>(sender)))
-> ::beman::execution::sender decltype(auto) {
constexpr auto
transform_sender(Domain, Sender&& sender, const Env&...) noexcept(noexcept(::std::forward<Sender>(sender)))
-> ::beman::execution::sender decltype(auto) {
return ::std::forward<Sender>(sender);
}

Expand Down
1 change: 1 addition & 0 deletions src/beman/execution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ install(
TARGETS ${TARGET_NAME}
EXPORT ${TARGETS_EXPORT_NAME}1
ARCHIVE DESTINATION lib/$<CONFIG>
FILE_SET HEADERS
FILE_SET ${TARGET_NAME}_public_headers
FILE_SET ${TARGET_NAME}_detail_headers
FILE_SET CXX_MODULES DESTINATION ${INSTALL_CONFIGDIR}/module
Expand Down
Loading
Loading