Skip to content

Commit

Permalink
Change exported install name to beman::execution26 (#109)
Browse files Browse the repository at this point in the history
* Change exported install name to beman::execution26

* adjust the header update script and add missing headers

---------

Co-authored-by: Dietmar Kühl <[email protected]>
  • Loading branch information
maikel and dietmarkuehl authored Dec 23, 2024
1 parent 5d0de33 commit 752882e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
endif()

set(TARGET_NAME execution26)
set(TARGET_NAMESPACE beman) # FIXME: not used in install(EXPORT ...) CK?
set(TARGET_NAMESPACE beman)
set(TARGET_PREFIX ${TARGET_NAMESPACE}.${TARGET_NAME})
set(TARGET_LIBRARY ${PROJECT_NAME})
set(TARGET_ALIAS ${TARGET_LIBRARY}::${TARGET_LIBRARY})
set(TARGET_ALIAS ${TARGET_NAMESPACE}::${TARGET_NAME})
set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)

Expand All @@ -40,7 +40,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
# uncomment to enable the options. Some of them accept one or more inputs:
project_options(
PREFIX
${PROJECT_NAME}
${TARGET_NAME}
ENABLE_CACHE
# NO! # ENABLE_CLANG_TIDY
# NO! ENABLE_VS_ANALYSIS
Expand Down
2 changes: 1 addition & 1 deletion bin/update-cmake-headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_headers(dir):
}

file_set_re = re.compile(" *FILE_SET.*")
section_re = re.compile(" *\${TARGET_LIBRARY}_(?P<section>.*)_headers$")
section_re = re.compile(" *\${TARGET_NAME}_(?P<section>.*)_headers$")
header_re = re.compile(" *\${PROJECT_SOURCE_DIR}/include/beman/.*/.*\.hpp")

if len(sys.argv) != 2:
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ foreach(EXAMPLE ${EXAMPLES})
set(EXAMPLE_TARGET ${TARGET_PREFIX}.examples.${EXAMPLE})
add_executable(${EXAMPLE_TARGET})
target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp)
target_link_libraries(${EXAMPLE_TARGET} PRIVATE ${TARGET_LIBRARY})
target_link_libraries(${EXAMPLE_TARGET} PRIVATE ${TARGET_NAMESPACE}::${TARGET_NAME})
endforeach()
39 changes: 24 additions & 15 deletions src/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

add_library(${TARGET_LIBRARY} STATIC)
add_library(${TARGET_ALIAS} ALIAS ${TARGET_LIBRARY})
add_library(${TARGET_NAME} STATIC)
add_library(${TARGET_ALIAS} ALIAS ${TARGET_NAME})

if(CMAKE_BUILD_TYPE STREQUAL Debug)
target_link_libraries(${TARGET_LIBRARY} PUBLIC $<BUILD_INTERFACE:${TARGET_LIBRARY}_project_options>)
target_link_libraries(${TARGET_LIBRARY} PUBLIC $<BUILD_INTERFACE:${TARGET_LIBRARY}_project_warnings>)
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_options>)
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_warnings>)
endif()

include(CMakePrintHelpers)
cmake_print_variables(TARGET_ALIAS TARGET_LIBRARY TARGET_PREFIX PROJECT_SOURCE_DIR)
cmake_print_variables(TARGET_ALIAS TARGET_NAME TARGET_PREFIX PROJECT_SOURCE_DIR)

target_sources(
${TARGET_LIBRARY}
${TARGET_NAME}
PRIVATE execution.cpp
PUBLIC FILE_SET
${TARGET_LIBRARY}_public_headers
${TARGET_NAME}_public_headers
TYPE
HEADERS
BASE_DIRS
Expand All @@ -28,7 +28,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/functional.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/stop_token.hpp
PUBLIC FILE_SET
${TARGET_LIBRARY}_detail_headers
${TARGET_NAME}_detail_headers
TYPE
HEADERS
BASE_DIRS
Expand All @@ -39,8 +39,10 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/apply_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/as_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/as_except_ptr.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/atomic_intrusive_stack.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/await_result_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/await_suspend_result.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/awaitable_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_operation.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_receiver.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_sender.hpp
Expand All @@ -49,6 +51,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/callable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/check_type_alias_exist.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/child_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/class_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/common.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_domain.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_signature.hpp
Expand All @@ -64,6 +67,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/continues_on.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_same_as.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_tuple.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_type_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_typeof.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decays_to.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/default_domain.hpp
Expand Down Expand Up @@ -97,6 +101,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/indirect_meta_apply.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/inplace_stop_source.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/into_variant.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/intrusive_stack.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/is_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/is_awaiter.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/join_env.hpp
Expand Down Expand Up @@ -138,6 +143,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_adaptor.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_adaptor_closure.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_decompose.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_for.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_in.hpp
Expand All @@ -149,6 +155,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/simple_counting_scope.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/single_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/single_sender_value_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/split.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/start.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/starts_on.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/state_type.hpp
Expand All @@ -165,6 +172,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/then.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/transform_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/type_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/unspecified_promise.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/unstoppable_token.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/valid_completion_for.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/valid_completion_signatures.hpp
Expand All @@ -174,32 +182,33 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/when_all.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/when_all_with_variant.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/with_await_transform.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/with_awaitable_senders.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/write_env.hpp
)

# cmake-format: off
get_property(DETAIL_HEADER_FILES TARGET ${TARGET_LIBRARY} PROPERTY HEADER_SET_${TARGET_LIBRARY}_detail_headers)
get_property(DETAIL_HEADER_FILES TARGET ${TARGET_NAME} PROPERTY HEADER_SET_${TARGET_NAME}_detail_headers)
source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES})

set_target_properties(${TARGET_LIBRARY} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)
set_target_properties(${TARGET_NAME} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)

target_compile_features(${TARGET_LIBRARY} PUBLIC
target_compile_features(${TARGET_NAME} PUBLIC
"$<$<COMPILE_FEATURES:cxx_std_26>:cxx_std_26>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_26>>:cxx_std_23>"
)

install(
TARGETS ${TARGET_LIBRARY}
TARGETS ${TARGET_NAME}
EXPORT ${TARGETS_EXPORT_NAME}1
ARCHIVE DESTINATION lib/$<CONFIG>
FILE_SET ${TARGET_LIBRARY}_public_headers
FILE_SET ${TARGET_LIBRARY}_detail_headers
FILE_SET ${TARGET_NAME}_public_headers
FILE_SET ${TARGET_NAME}_detail_headers
)
# cmake-format: on

install(
EXPORT ${TARGETS_EXPORT_NAME}1
FILE ${TARGETS_EXPORT_NAME}.cmake
DESTINATION "${INSTALL_CONFIGDIR}"
NAMESPACE ${TARGET_LIBRARY}::
NAMESPACE ${TARGET_NAMESPACE}::
)
2 changes: 1 addition & 1 deletion tests/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ remove_definitions(-DNDEBUG) # NOTE: we want ASSERT statements in Release too! C
foreach(test ${execution_tests})
set(TEST_EXE ${TARGET_PREFIX}.${test})
add_executable(${TEST_EXE} ${test}.cpp)
target_link_libraries(${TEST_EXE} PRIVATE beman_execution26::beman_execution26)
target_link_libraries(${TEST_EXE} PRIVATE beman::execution26)
add_test(NAME ${TEST_EXE} COMMAND $<TARGET_FILE:${TEST_EXE}>)
endforeach()

Expand Down

0 comments on commit 752882e

Please sign in to comment.