Skip to content

Update repository to conform to Beman project standards #133

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
65 changes: 49 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,75 @@

cmake_minimum_required(VERSION 3.25...3.31)

project(beman_execution VERSION 0.0.1 LANGUAGES CXX)
project(beman.execution VERSION 0.0.1 LANGUAGES CXX)

# Setup C++ feature tests
include(CheckCXXSourceCompiles)

# Check for __cpp_explicit_this_parameter
check_cxx_source_compiles("
struct S {
void f(this S& self) {}
};
int main() { S s; s.f(); }
" BEMAN_EXECUTION_HAS_EXPLICIT_THIS_PARAMETER)

# Check for __cpp_lib_unreachable
check_cxx_source_compiles("
#include <utility>
int main() { std::unreachable(); }
" BEMAN_EXECUTION_HAS_LIB_UNREACHABLE)

# Check for __cpp_lib_forward_like
check_cxx_source_compiles("
#include <utility>
int main() {
int x = 42;
auto&& r = std::forward_like<int&>(x);
return 0;
}
" BEMAN_EXECUTION_HAS_LIB_FORWARD_LIKE)

# Configure the config.hpp file
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/execution/detail/config/config.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/beman/execution/detail/config/config.hpp"
@ONLY
)
Copy link
Author

Choose a reason for hiding this comment

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

@bretbrownjr doesn't like this whole section. Remove everything except the first line (the beman.execution change is good.


if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()

set(TARGET_NAME execution)
set(TARGET_NAME beman.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}-targets)
set(TARGET_SHORT_NAME execution)
set(TARGET_ALIAS ${TARGET_NAMESPACE}::${TARGET_SHORT_NAME})
set(TARGET_PACKAGE_NAME ${TARGET_NAME}Config)
Copy link
Author

Choose a reason for hiding this comment

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

I like the -config version better -@bretbrownjr

set(TARGETS_EXPORT_NAME ${TARGET_NAME}-targets)

option(
BEMAN_EXECUTION_ENABLE_TESTING
"Enable building tests and test infrastructure. Values: { ON, OFF }."
BEMAN_execution_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ON. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)

option(
BEMAN_EXECUTION_BUILD_EXAMPLES
"Enable building examples. Values: { ON, OFF }."
BEMAN_execution_BUILD_EXAMPLES
"Enable building examples. Default: ON. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)

option(
BEMAN_EXECUTION_ENABLE_INSTALL
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})

if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
if(NOT BEMAN_execution_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
include(FetchContent)

# Add project_options from https://github.com/aminya/project_options
Expand Down Expand Up @@ -91,17 +124,17 @@ endif()

add_subdirectory(src/beman/execution)

if(BEMAN_EXECUTION_ENABLE_TESTING)
if(BEMAN_execution_BUILD_TESTS)
enable_testing()

add_subdirectory(tests/beman/execution)
endif()

if(BEMAN_EXECUTION_BUILD_EXAMPLES)
if(BEMAN_execution_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

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

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
beman.execution
Copyright (c) 2025 The Beman Authors

This product includes software developed by The Beman Authors
(https://github.com/bemanproject/beman).

This product is governed by the Apache License 2.0 WITH LLVM-exception.
Copy link
Author

Choose a reason for hiding this comment

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

Delete this whole file

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-->
# beman.execution: Building Block For Asynchronous Programs

<img src="https://github.com/bemanproject/beman/blob/main/images/logos/beman_logo-beman_library_under_development.png" style="width:5%; height:auto;">
![Library Status](https://raw.githubusercontent.com/bemanproject/beman/refs/heads/main/images/badges/beman_badge-beman_library_under_development.svg) ![Linux build status](https://github.com/bemanproject/execution/actions/workflows/linux.yml/badge.svg) ![MacOS build status](https://github.com/bemanproject/execution/actions/workflows/macos.yml/badge.svg) ![Window build status](https://github.com/bemanproject/execution/actions/workflows/windows.yml/badge.svg)

`beman.execution` provides the basic vocabulary for asynchronous
programming as well as important algorithms implemented in terms
Expand Down Expand Up @@ -48,10 +48,6 @@ contains some links for general information about the sender/receivers and `std:

## Build

| Library | Linux | MacOS | Windows |
| ------- | ----- | ----- | ------- |
| build | ![Linux build status](https://github.com/bemanproject/execution/actions/workflows/linux.yml/badge.svg) | ![MacOS build status](https://github.com/bemanproject/execution/actions/workflows/macos.yml/badge.svg) | ![Window build status](https://github.com/bemanproject/execution/actions/workflows/windows.yml/badge.svg) |

The following instructions build the library and the examples:

cmake --workflow --list-presets
Expand Down
16 changes: 16 additions & 0 deletions include/beman/execution/detail/config/config.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// include/beman/execution/detail/config/config.hpp -*-C++-*-
Copy link
Author

Choose a reason for hiding this comment

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

I don't like config.hpp files. Remove this and everything related to it

// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONFIG_CONFIG
#define INCLUDED_BEMAN_EXECUTION_DETAIL_CONFIG_CONFIG

// This file is generated at CMake configuration time

// Feature test macros
#cmakedefine01 BEMAN_EXECUTION_HAS_EXPLICIT_THIS_PARAMETER
#cmakedefine01 BEMAN_EXECUTION_HAS_LIB_UNREACHABLE
#cmakedefine01 BEMAN_EXECUTION_HAS_LIB_FORWARD_LIKE

// ----------------------------------------------------------------------------

#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONFIG_CONFIG
34 changes: 28 additions & 6 deletions src/beman/execution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
add_library(${TARGET_NAME} STATIC)
add_library(${TARGET_ALIAS} ALIAS ${TARGET_NAME})

if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
if(NOT BEMAN_execution_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
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()

# Add the binary directory to include paths so config.hpp can be found
Copy link
Author

Choose a reason for hiding this comment

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

can be removed

target_include_directories(${TARGET_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)

include(CMakePrintHelpers)
cmake_print_variables(TARGET_ALIAS TARGET_NAME TARGET_PREFIX PROJECT_SOURCE_DIR)

Expand Down Expand Up @@ -193,12 +201,20 @@ source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES})

set_target_properties(${TARGET_NAME} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)

target_compile_features(${TARGET_NAME} PUBLIC
"$<$<COMPILE_FEATURES:cxx_std_26>:cxx_std_26>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_26>>:cxx_std_23>"
)
# Check for C++26 support at configuration time instead of using target_compile_features
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++26" COMPILER_SUPPORTS_CXX26)
check_cxx_compiler_flag("-std=c++23" COMPILER_SUPPORTS_CXX23)

if(COMPILER_SUPPORTS_CXX26)
message(STATUS "Using C++26 for ${TARGET_NAME}")
elseif(COMPILER_SUPPORTS_CXX23)
message(STATUS "Using C++23 for ${TARGET_NAME}")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not support C++23 or later. Please use a different compiler.")
endif()
Copy link
Author

Choose a reason for hiding this comment

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

Delete this (but deleting what was there was a good change; we just didn't need to add anything)


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

Expand All @@ -209,6 +225,12 @@ install(
FILE_SET ${TARGET_NAME}_public_headers
FILE_SET ${TARGET_NAME}_detail_headers
)

# Install the generated config.hpp file
install(
FILES ${PROJECT_BINARY_DIR}/include/beman/execution/detail/config/config.hpp
DESTINATION include/beman/execution/detail/config
)
Copy link
Author

Choose a reason for hiding this comment

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

Delete this

# cmake-format: on

install(
Expand Down
Loading