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
12 changes: 7 additions & 5 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
"tests": [
{ "stdlibs": ["libstdc++"],
"tests": [
"Debug.Default", "Release.Default",
"Release.MaxSan", "Debug.Werror",
"Debug.Dynamic", "Debug.Coverage"
"Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Coverage", "Debug.Werror",
"Debug.Dynamic", "Release.Dynamic"
]
}
]
Expand All @@ -68,7 +68,7 @@ jobs:
{ "stdlibs": ["libc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Dynamic"
"Debug.Dynamic", "Release.Dynamic"
]
}
]
Expand Down Expand Up @@ -96,7 +96,9 @@ jobs:
{ "cxxversions": ["c++23"],
"tests": [
{ "stdlibs": ["stl"],
"tests": ["Debug.Default", "Release.Default", "Release.MaxSan"]
"tests": ["Debug.Default", "Release.Default", "Release.MaxSan",
"Debug.Dynamic", "Release.Dynamic"
]
}
]
}
Expand Down
35 changes: 26 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets) # NOTE: must be set, is importa

#===============================================================================
if(BEMAN_USE_MODULES)
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)

set(CMAKE_CXX_SCAN_FOR_MODULES ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 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_PREFIX} STATIC)
add_library(${TARGET_PREFIX} STATIC) # FIXME: only static yet! CK
add_library(beman::execution ALIAS ${TARGET_PREFIX})
target_compile_features(
${TARGET_PREFIX}
PUBLIC cxx_std_${CMAKE_CXX_STANDARD}
)

# TODO(CK): the export header should be used!
include(GenerateExportHeader)
generate_export_header(
${TARGET_PREFIX}
Expand All @@ -48,17 +51,32 @@ if(BEMAN_USE_MODULES)
FILES
${CMAKE_CURRENT_BINARY_DIR}/beman/execution/modules_export.hpp
)
# NOTE: only partly supported for examples!
# FIXME: target_compile_definitions(${TARGET_PREFIX} PUBLIC BEMAN_HAS_MODULES)
target_compile_definitions(${TARGET_PREFIX} PUBLIC BEMAN_HAS_MODULES)
set_target_properties(
${TARGET_PREFIX}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
DLL_NAME_WITH_SOVERSION TRUE
)

# FIXME: Quickfix only to prevent linker problems on windows dll? CK
if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(
${TARGET_PREFIX}
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON
)
endif()

# XXX find_package(Threads REQUIRED)
# XXX target_link_libraries(${TARGET_PREFIX} PUBLIC Threads::Threads)
find_package(Threads REQUIRED)
target_link_libraries(${TARGET_PREFIX} PUBLIC Threads::Threads)
else()
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
endif()

if(BEMAN_USE_MODULES AND CMAKE_CXX_MODULE_STD)
if(BEMAN_USE_MODULES AND BEMAN_HAS_IMPORT_STD)
target_compile_definitions(${TARGET_PREFIX} PUBLIC BEMAN_HAS_IMPORT_STD)
set_target_properties(${TARGET_PREFIX} PROPERTIES CXX_MODULE_STD ON)
elseif(BEMAN_USE_MODULES)
message(WARNING "Missing or disabled support for CMAKE_CXX_MODULE_STD!")
endif()
Expand All @@ -82,9 +100,8 @@ add_subdirectory(src/beman/execution)
# NOTE: this must be done before tests! CK
include(./cmake/beman-install-library.cmake)
beman_install_library(${TARGET_PREFIX} TARGETS ${TARGET_NAME} ${TARGET_PREFIX}
# FIXME: DEPENDENCIES [===[beman.inplace_vector 1.0.0]===] [===[beman.scope 0.0.1 EXACT]===] fmt
# TODO(CK): XXX OR XXX DEPENDENCIES "beman.inplace_vector 1.0.0;beman.scope 0.0.1 EXACT"
# XXX DEPENDENCIES Threads
# TODO: DEPENDENCIES [===[beman.inplace_vector 1.0.0]===] [===[beman.scope 0.0.1 EXACT]===] fmt
DEPENDENCIES Threads
)
#===============================================================================

Expand Down
3 changes: 3 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BEMAN_USE_MODULES": true,
"BEMAN_USE_STD_MODULE": true,
"CMAKE_CXX_STANDARD": "23",
"CMAKE_CXX_EXTENSIONS": true,
"CMAKE_CXX_STANDARD_REQUIRED": true,
Expand Down Expand Up @@ -72,6 +73,7 @@
"_debug-base"
],
"cacheVariables": {
"BEMAN_USE_STD_MODULE": false,
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
},
"environment": {
Expand All @@ -87,6 +89,7 @@
"_release-base"
],
"cacheVariables": {
"BEMAN_USE_STD_MODULE": false,
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
},
"environment": {
Expand Down
3 changes: 2 additions & 1 deletion cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ endif()
BEMAN_USE_STD_MODULE:BOOL=ON
# -> "Check if 'import std;' is possible with the toolchain?"

if(BEMAN_USE_MODULES AND CMAKE_CXX_MODULE_STD)
if(BEMAN_USE_MODULES AND BEMAN_HAS_IMPORT_STD)
target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_IMPORT_STD)
set_target_properties(beman.execution PROPERTIES CXX_MODULE_STD ON)
endif()
```

Expand Down
75 changes: 54 additions & 21 deletions cmake/beman-install-library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include(GNUInstallDirs)
# [NAMESPACE <namespace>]
# [EXPORT_NAME <export-name>]
# [DESTINATION <install-prefix>]
# [VERSION_SUFFIX]
# )
#
# Arguments:
Expand Down Expand Up @@ -51,6 +52,9 @@ include(GNUInstallDirs)
# The install destination for CXX_MODULES.
# Defaults to ${CMAKE_INSTALL_LIBDIR}/cmake/${name}/modules.
#
# VERSION_SUFFIX (optional)
# option to enable the versioning of install destinations
#
# Brief
# -----
#
Expand Down Expand Up @@ -84,7 +88,7 @@ function(beman_install_library name)
# ----------------------------
# Argument parsing
# ----------------------------
set(options)
set(options VERSION_SUFFIX)
set(oneValueArgs NAMESPACE EXPORT_NAME DESTINATION)
set(multiValueArgs TARGETS DEPENDENCIES)

Expand All @@ -111,9 +115,20 @@ function(beman_install_library name)
return()
endif()

set(_config_install_dir
"${CMAKE_INSTALL_LIBDIR}/cmake/${name}-${PROJECT_VERSION}"
)
# gersemi: off
set(_version_suffix)
set(_include_install_dir)
set(_lib_install_dir)
set(_bin_install_dir)
# NOTE: If one of this variables is not set, the default DESTINATION is used! CK
if(BEMAN_VERSION_SUFFIX)
set(_version_suffix "-${PROJECT_VERSION}")
set(_include_install_dir DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/beman${_version_suffix})
# set(_lib_install_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/beman${_version_suffix})
# set(_bin_install_dir DESTINATION ${CMAKE_INSTALL_BINDIR}/beman${_version_suffix})
endif()
set(_config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${name}${_version_suffix}")
# gersemi: on

# ----------------------------
# Defaults
Expand All @@ -131,6 +146,10 @@ function(beman_install_library name)
endif()

string(REPLACE "beman." "" install_component_name "${name}")
message(
VERBOSE
"beman-install-library(${name}): COMPONENT '${install_component_name}'"
)

# --------------------------------------------------
# Install each target with all of its file sets
Expand Down Expand Up @@ -161,7 +180,7 @@ function(beman_install_library name)
)
message(
VERBOSE
"beman_install_library(${name}): COMPONENT ${component_name} for TARGET '${_tgt}'"
"beman_install_library(${name}): EXPORT_NAME ${component_name} for TARGET '${_tgt}'"
)

# Get the list of interface header sets, exact one expected!
Expand All @@ -181,9 +200,9 @@ function(beman_install_library name)
APPEND _install_header_set_args
FILE_SET
"${_install_header_set}"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/beman-${PROJECT_VERSION}"
# TODO(CK) COMPONENT "${_install_headers_component}"
${_include_install_dir}
COMPONENT
"${install_component_name}_Development"
)
endforeach()
else()
Expand All @@ -199,27 +218,41 @@ function(beman_install_library name)
)
install(
TARGETS "${_tgt}"
COMPONENT "${install_component_name}"
EXPORT ${BEMAN_EXPORT_NAME}
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/beman-${PROJECT_VERSION}
LIBRARY # DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME # DESTINATION ${CMAKE_INSTALL_BINDIR}
${_install_header_set_args} # DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILE_SET ${_module_sets} DESTINATION "${BEMAN_DESTINATION}"
${_lib_install_dir}
COMPONENT "${install_component_name}_Development"
LIBRARY
${_lib_install_dir}
COMPONENT "${install_component_name}_Runtime"
NAMELINK_COMPONENT "${install_component_name}_Development"
RUNTIME
${_bin_install_dir}
COMPONENT "${install_component_name}_Runtime"
${_install_header_set_args}
FILE_SET ${_module_sets}
DESTINATION "${BEMAN_DESTINATION}"
COMPONENT "${install_component_name}_Development"
# NOTE: There's currently no convention for this location! CK
CXX_MODULES_BMI
# TODO(CK): DESTINATION ${_config_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$<CONFIG>
COMPONENT "${install_component_name}_Development"
)
else()
install(
TARGETS "${_tgt}"
COMPONENT "${install_component_name}"
EXPORT ${BEMAN_EXPORT_NAME}
ARCHIVE # DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY # DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME # DESTINATION ${CMAKE_INSTALL_BINDIR}
${_install_header_set_args} # DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE
${_lib_install_dir}
COMPONENT "${install_component_name}_Development"
LIBRARY
${_lib_install_dir}
COMPONENT "${install_component_name}_Runtime"
NAMELINK_COMPONENT "${install_component_name}_Development"
RUNTIME
${_bin_install_dir}
COMPONENT "${install_component_name}_Runtime"
${_install_header_set_args}
)
endif()
endforeach()
Expand All @@ -233,7 +266,7 @@ function(beman_install_library name)
NAMESPACE ${BEMAN_NAMESPACE}
CXX_MODULES_DIRECTORY cxx-modules
DESTINATION ${_config_install_dir}
COMPONENT "${install_component_name}"
COMPONENT "${install_component_name}_Development"
)
# gersemi: on

Expand Down Expand Up @@ -304,7 +337,7 @@ function(beman_install_library name)
"${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${name}-config-version.cmake"
DESTINATION ${_config_install_dir}
COMPONENT "${install_component_name}"
COMPONENT "${install_component_name}_Development"
)
else()
message(
Expand Down
1 change: 1 addition & 0 deletions cmake/presets/CMakeGenericPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"value": "${sourceDir}/stagedir"
},
"BEMAN_USE_MODULES": true,
"BEMAN_USE_STD_MODULE": true,
"CMAKE_CXX_STANDARD": "23",
"CMAKE_CXX_EXTENSIONS": true,
"CMAKE_CXX_STANDARD_REQUIRED": true,
Expand Down
2 changes: 1 addition & 1 deletion src/beman/execution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ if(BEMAN_USE_MODULES)
with_awaitable_senders.cppm
write_env.cppm
)
target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_MODULES)
target_compile_definitions(${TARGET_PREFIX} PUBLIC BEMAN_HAS_MODULES)
target_link_libraries(${TARGET_PREFIX} PUBLIC ${TARGET_NAME})
endif()

Expand Down