Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a071aa1
normalized headers and started to create a script to create a module …
dietmarkuehl Jan 27, 2026
2f941f6
added macroized export declaration
dietmarkuehl Jan 27, 2026
5e5ff2f
a first version apparently importing modules
dietmarkuehl Jan 27, 2026
72901b8
replace config.hpp by common.hpp
dietmarkuehl Jan 27, 2026
42e10d3
chnaged the tests to prefer module use
dietmarkuehl Jan 28, 2026
f588bdd
actually use the module definitions
dietmarkuehl Jan 28, 2026
3fe7e19
Add nothrow_callable include to associate.hpp
dietmarkuehl Jan 28, 2026
f9d198c
Quickfix to make it work with g++-15 on OSX (#204)
ClausKlein Jan 28, 2026
6a7ce69
meddled a bit with Makefile to be able to compile (hopefully without …
dietmarkuehl Jan 28, 2026
1087581
fixed a bunch of issues when using import std;
dietmarkuehl Jan 28, 2026
66eb032
fix some CI feedback
dietmarkuehl Jan 29, 2026
e2f114b
added a banner to mk-module.py
dietmarkuehl Jan 29, 2026
29e4886
added a banner to mk-module.py
dietmarkuehl Jan 29, 2026
3822de4
Install header only library and cxx_module lib (#205)
ClausKlein Jan 29, 2026
03b2cf1
moved changes from the generated file into suitable locations
dietmarkuehl Jan 29, 2026
f59fbc6
addressed various issues discovered by CI
dietmarkuehl Jan 30, 2026
75125a0
fixed more compilation issues detected by CI
dietmarkuehl Jan 30, 2026
0056389
fixed more CI errors
dietmarkuehl Jan 30, 2026
6b58928
fixed another compilation error
dietmarkuehl Jan 30, 2026
69e8036
Cleanup and use BEMAN_HAS_MODULES in code (#206)
ClausKlein Jan 30, 2026
b33d446
enhanced mk-module.py to track source locations properly
dietmarkuehl Jan 30, 2026
964deb0
fixed a few formatting issues and moved "module" to the top
dietmarkuehl Jan 31, 2026
a243486
some formatting issues
dietmarkuehl Jan 31, 2026
55b34ea
fixing another python formatting error
dietmarkuehl Jan 31, 2026
22e2f9b
Feature/fix build without modules (#208)
ClausKlein Jan 31, 2026
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
25 changes: 13 additions & 12 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:

jobs:
beman-submodule-check:
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.1.0
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.2.1

preset-test:
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.1.0
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.2.1
with:
matrix_config: >
[
Expand All @@ -29,7 +29,7 @@ jobs:
]

build-and-test:
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.1.0
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.2.1
with:
matrix_config: >
{
Expand All @@ -40,7 +40,8 @@ jobs:
"tests": [
{ "stdlibs": ["libstdc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Default", "Release.Default",
"Release.MaxSan", "Debug.Werror",
"Debug.Dynamic", "Debug.Coverage"
]
}
Expand All @@ -51,7 +52,7 @@ jobs:
}
]
},
{ "versions": ["14", "13"],
{ "versions": ["14"],
"tests": [
{ "cxxversions": ["c++26", "c++23"],
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
Expand All @@ -60,11 +61,11 @@ jobs:
}
],
"clang": [
{ "versions": ["20"],
{ "versions": ["21"],
"tests": [
{"cxxversions": ["c++26"],
"tests": [
{ "stdlibs": ["libstdc++", "libc++"],
{ "stdlibs": ["libc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Dynamic"
Expand All @@ -74,16 +75,16 @@ jobs:
},
{ "cxxversions": ["c++23"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
{"stdlibs": ["libc++"], "tests": ["Release.Default"]}
]
}
]
},
{ "versions": ["19"],
{ "versions": ["20", "19"],
"tests": [
{ "cxxversions": ["c++26", "c++23"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
{"stdlibs": ["libc++"], "tests": ["Release.Default"]}
]
}
]
Expand All @@ -95,7 +96,7 @@ jobs:
{ "cxxversions": ["c++23"],
"tests": [
{ "stdlibs": ["stl"],
"tests": ["Debug.Default", "Release.Default"]
"tests": ["Debug.Default", "Release.Default", "Release.MaxSan"]
}
]
}
Expand All @@ -107,4 +108,4 @@ jobs:
create-issue-when-fault:
needs: [preset-test, build-and-test]
if: failure() && github.event_name == 'schedule'
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.1.0
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.2.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ docs/html
docs/latex
docs/code/*.cpp
docs/tutorial.md
gcm.cache
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.4
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
133 changes: 42 additions & 91 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,56 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# gersemi: on

cmake_minimum_required(VERSION 3.25...4.2)
cmake_minimum_required(VERSION 3.30...4.2)

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

if(CMAKE_CXX_STDLIB_MODULES_JSON)
message(
STATUS
"CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}"
)
endif()
endif()
# gersemi: on
#===============================================================================
include(./cmake/prelude.cmake)

#===================================================
project(beman_execution VERSION 0.0.1 LANGUAGES CXX)
project(beman.execution VERSION 0.2.0 LANGUAGES CXX)
#===================================================

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()
# Modules opt in only on compilers that support it: msvc, g++-15 and clang-20+
include(./cmake/cxx-modules-rules.cmake)

set(TARGET_NAME execution)
set(TARGET_NAMESPACE beman)
set(TARGET_PREFIX ${TARGET_NAMESPACE}.${TARGET_NAME})
set(TARGET_LIBRARY ${PROJECT_NAME})
set(TARGET_ALIAS ${TARGET_NAMESPACE}::${TARGET_NAME})
set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-config-targets)

#========================== post project settings ==============================
# Tell CMake that we explicitly want `import std`.
# This will initialize the property on all targets declared after this to 1
message(STATUS "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}")
if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD)
set(CMAKE_CXX_MODULE_STD ON)
message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}")
endif()
set(TARGET_NAME beman.execution_headers) # used in src, and docs
set(TARGET_NAMESPACE beman) # TODO(CK): still used in docs, is this really needed?
set(TARGET_PREFIX ${PROJECT_NAME}) # NOTE: used in src, and docs?
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets) # NOTE: must be set, is important for installation! CK

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()
#===============================================================================
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(beman.execution STATIC)
add_library(beman::execution ALIAS beman.execution)
target_compile_features(
beman.execution
PUBLIC cxx_std_${CMAKE_CXX_STANDARD}
)

# gersemi: off
if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
message(
STATUS
"CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}"
include(GenerateExportHeader)

generate_export_header(
beman.execution
BASE_NAME beman.execution
EXPORT_FILE_NAME beman/execution/modules_export.hpp
)
target_sources(
beman.execution
PUBLIC
FILE_SET HEADERS
BASE_DIRS include ${CMAKE_CURRENT_BINARY_DIR}
FILES
${CMAKE_CURRENT_BINARY_DIR}/beman/execution/modules_export.hpp
)
# FIXME: target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_MODULES)
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 AND CMAKE_CXX_MODULE_STD)
target_compile_definitions(${TARGET_NAME} PUBLIC BEMAN_HAS_IMPORT_STD)
target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_IMPORT_STD)
else()
message(WARNING "Missing support for CMAKE_CXX_MODULE_STD!")
endif()
Expand All @@ -86,17 +70,12 @@ option(
${PROJECT_IS_TOP_LEVEL}
)

option(
BEMAN_EXECUTION_ENABLE_INSTALL
"Install the project components. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)

include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

add_subdirectory(src/beman/execution)

# NOTE: this must be done before tests! CK
include(./cmake/beman-install-library-config.cmake)
beman_install_library(${TARGET_PREFIX} headers)

if(BEMAN_EXECUTION_ENABLE_TESTING)
enable_testing()

Expand All @@ -107,31 +86,3 @@ if(BEMAN_EXECUTION_BUILD_EXAMPLES)
add_subdirectory(examples)
add_subdirectory(docs/code)
endif()

if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
return()
endif()

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
VERSION ${CMAKE_PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
"cmake/Config.cmake.in"
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
DESTINATION ${INSTALL_CONFIGDIR}
)

set(CPACK_GENERATOR TGZ)
include(CPack)
8 changes: 5 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"cacheVariables": {
"CMAKE_CXX_STANDARD": "23",
"CMAKE_CXX_EXTENSIONS": true,
"CMAKE_CXX_SCAN_FOR_MODULES": false,
"CMAKE_CXX_SCAN_FOR_MODULES": true,
"CMAKE_CXX_STANDARD_REQUIRED": true,
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_SKIP_TEST_ALL_DEPENDENCY": false,
Expand Down 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 All @@ -83,6 +83,7 @@
"_debug-base"
],
"cacheVariables": {
"CMAKE_CXX_SCAN_FOR_MODULES": false,
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake"
}
},
Expand All @@ -94,6 +95,7 @@
"_release-base"
],
"cacheVariables": {
"CMAKE_CXX_SCAN_FOR_MODULES": false,
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake"
}
},
Expand Down
Loading