Skip to content

Commit 73c7631

Browse files
committed
started to update the poject to the Beman standard
1 parent d2ac62b commit 73c7631

File tree

9 files changed

+42
-122
lines changed

9 files changed

+42
-122
lines changed

CMakeLists.txt

Lines changed: 24 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
# cmake-format: off
2-
# /CMakeLists.txt -*-makefile-*-
2+
# CMakeLists.txt -*-makefile-*-
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
# cmake-format: on
55

66
cmake_minimum_required(VERSION 3.25...3.31)
77

8-
project(beman_execution VERSION 0.0.1 LANGUAGES CXX)
8+
project(
9+
beman.execution
10+
DESCRIPTION "Beman implementation of asynchronous components"
11+
LANGUAGES CXX
12+
VERSION 0.0.1
13+
)
914

10-
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
11-
message(FATAL_ERROR "In-source builds are not allowed!")
12-
endif()
15+
option(
16+
BEMAN_EXECUTION_BUILD_TESTS
17+
"Enable building tests and test infrastructure. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
18+
${PROJECT_IS_TOP_LEVEL}
19+
)
20+
option(
21+
BEMAN_EXECUTION_BUILD_EXAMPLES
22+
"Enable building examples. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
23+
${PROJECT_IS_TOP_LEVEL}
24+
)
25+
option(
26+
BEMAN_EXECUTION_INSTALL_CONFIG_FILE_PACKAGE
27+
"Enable creating and installing a CMake config-file package. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
28+
${PROJECT_IS_TOP_LEVEL}
29+
)
1330

1431
set(TARGET_NAME execution)
1532
set(TARGET_NAMESPACE beman)
@@ -19,112 +36,14 @@ set(TARGET_ALIAS ${TARGET_NAMESPACE}::${TARGET_NAME})
1936
set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
2037
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
2138

22-
option(
23-
BEMAN_EXECUTION_ENABLE_TESTING
24-
"Enable building tests and test infrastructure. Values: { ON, OFF }."
25-
${PROJECT_IS_TOP_LEVEL}
26-
)
27-
28-
option(
29-
BEMAN_EXECUTION_BUILD_EXAMPLES
30-
"Enable building examples. Values: { ON, OFF }."
31-
${PROJECT_IS_TOP_LEVEL}
32-
)
33-
34-
option(
35-
BEMAN_EXECUTION_ENABLE_INSTALL
36-
"Install the project components. Values: { ON, OFF }."
37-
${PROJECT_IS_TOP_LEVEL}
38-
)
39-
40-
include(GNUInstallDirs)
41-
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
42-
43-
if(PROJECT_IS_TOP_LEVEL AND NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
44-
set(CMAKE_SKIP_INSTALL_RULES ON)
45-
46-
include(FetchContent)
47-
48-
# Add project_options from https://github.com/aminya/project_options
49-
# Change the version in the following URL to update the package
50-
# (watch the releases of the repository for future updates)
51-
set(PROJECT_OPTIONS_VERSION "v0.41.0")
52-
FetchContent_Declare(
53-
_project_options URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip
54-
)
55-
FetchContent_MakeAvailable(_project_options)
56-
include(${_project_options_SOURCE_DIR}/Index.cmake)
57-
58-
# Initialize project_options variable related to this project
59-
# This overwrites `project_options` and sets `project_warnings`
60-
# uncomment to enable the options. Some of them accept one or more inputs:
61-
project_options(
62-
PREFIX
63-
${TARGET_NAME}
64-
ENABLE_CACHE
65-
# NO! # ENABLE_CLANG_TIDY
66-
# NO! ENABLE_VS_ANALYSIS
67-
# ENABLE_INTERPROCEDURAL_OPTIMIZATION
68-
# ENABLE_NATIVE_OPTIMIZATION
69-
# ENABLE_DOXYGEN
70-
# ENABLE_COVERAGE
71-
ENABLE_SANITIZER_ADDRESS
72-
ENABLE_SANITIZER_UNDEFINED
73-
# TODO: ENABLE_SANITIZER_THREAD
74-
# FIXME: on Linux only with clang++? ENABLE_SANITIZER_MEMORY
75-
ENABLE_SANITIZER_POINTER_COMPARE
76-
ENABLE_SANITIZER_POINTER_SUBTRACT
77-
ENABLE_CONTROL_FLOW_PROTECTION
78-
ENABLE_STACK_PROTECTION
79-
ENABLE_OVERFLOW_PROTECTION
80-
# ENABLE_ELF_PROTECTION
81-
# ENABLE_RUNTIME_SYMBOLS_RESOLUTION
82-
# ENABLE_COMPILE_COMMANDS_SYMLINK
83-
# ENABLE_PCH
84-
# PCH_HEADERS
85-
# WARNINGS_AS_ERRORS
86-
# ENABLE_INCLUDE_WHAT_YOU_USE
87-
# ENABLE_GCC_ANALYZER
88-
# ENABLE_BUILD_WITH_TIME_TRACE
89-
# TODO: buggy! ENABLE_UNITY
90-
# LINKER "lld"
91-
)
92-
endif()
93-
9439
add_subdirectory(src/beman/execution)
9540

96-
if(BEMAN_EXECUTION_ENABLE_TESTING)
41+
if(BEMAN_EXECUTION_BUILD_TESTS)
9742
enable_testing()
98-
9943
add_subdirectory(tests/beman/execution)
10044
endif()
10145

10246
if(BEMAN_EXECUTION_BUILD_EXAMPLES)
47+
enable_testing()
10348
add_subdirectory(examples)
10449
endif()
105-
106-
if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
107-
return()
108-
endif()
109-
110-
include(CMakePackageConfigHelpers)
111-
112-
write_basic_package_version_file(
113-
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
114-
VERSION ${CMAKE_PROJECT_VERSION}
115-
COMPATIBILITY AnyNewerVersion
116-
)
117-
118-
configure_package_config_file(
119-
"cmake/Config.cmake.in" ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
120-
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
121-
)
122-
123-
install(
124-
FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
125-
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
126-
DESTINATION ${INSTALL_CONFIGDIR}
127-
)
128-
129-
set(CPACK_GENERATOR TGZ)
130-
include(CPack)
File renamed without changes.

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
<!--
22
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
-->
4-
# beman.execution: Building Block For Asynchronous Programs
4+
# beman.execution: Asynchronous Programming Foundation
55

6-
<img src="https://github.com/bemanproject/beman/blob/main/images/logos/beman_logo-beman_library_under_development.png" style="width:5%; height:auto;">
6+
![Library Status](https://raw.githubusercontent.com/bemanproject/beman/refs/heads/main/images/badges/beman_badge-beman_library_under_development.svg) ![Continuous Integration Tests](https://github.com/bemanproject/execution/actions/workflows/ci_tests.yml/badge.svg) ![Lint Check (pre-commit)](https://github.com/bemanproject/execution/actions/workflows/pre-commit.yml/badge.svg)
7+
[![Compiler Explorer Example](https://img.shields.io/badge/Try%20it%20on%20Compiler%20Explorer-grey?logo=compilerexplorer&logoColor=67c52a)](https://godbolt.org/z/1narY8cra)
8+
9+
`beman.execution` provides vocabulary and algorithms for asynchronous programs.
10+
11+
**Implements:** [`std::execution` (P2300R10)](http://wg21.link/P2300R10).
12+
13+
**Status**: [Under development and not yet ready for production use.](https://github.com/bemanproject/beman/blob/main/docs/BEMAN_LIBRARY_MATURITY_MODEL.md#under-development-and-not-yet-ready-for-production-use)
14+
15+
## Description
716

817
`beman.execution` provides the basic vocabulary for asynchronous
918
programming as well as important algorithms implemented in terms
@@ -35,10 +44,6 @@ e.g.:
3544
completed.
3645
- `bulk(...)` to executed execute work, potentially concurrently.
3746

38-
**Implements:** [`std::execution` (P2300R10)](http://wg21.link/P2300R10).
39-
40-
**Status**: [Under development and not yet ready for production use.](https://github.com/bemanproject/beman/blob/main/docs/BEMAN_LIBRARY_MATURITY_MODEL.md#under-development-and-not-yet-ready-for-production-use)
41-
4247
## Help Welcome!
4348

4449
There are plenty of things which need to be done. See the

docs/intro-examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This page provides a series of examples showing how to use the
66
`std::execution` components.
77

88
<details>
9-
<summary>`"Hello, world"` - synchronous using asynchronous components</summary>
9+
<summary><code>"Hello, world"</code> - synchronous using asynchronous components</summary>
1010

1111
Code: [`examples/intro-1-hello-world.cpp`]()
1212
@include examples/intro-1-hello-world.cpp
@@ -124,7 +124,7 @@ The components used in this example do all of that synchronously:
124124
</details>
125125

126126
<details>
127-
<summary>`"Hello, async"` - a simple asynchronous example</summary>
127+
<summary><code>"Hello, async"</code> - a simple asynchronous example</summary>
128128

129129
Code: [`examples/intro-2-hello-async.cpp`]()
130130
@include examples/intro-2-hello-async.cpp

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ foreach(EXAMPLE ${EXAMPLES})
2525
add_executable(${EXAMPLE_TARGET})
2626
target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp)
2727
target_link_libraries(${EXAMPLE_TARGET} PRIVATE ${TARGET_NAMESPACE}::${TARGET_NAME})
28+
add_test(NAME ${EXAMPLE_TARGET} COMMAND $<TARGET_FILE:${EXAMPLE_TARGET}>)
2829
endforeach()

examples/intro-1-hello-world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ex = ::beman::execution;
1010
using namespace std::string_literals;
1111

1212
// ----------------------------------------------------------------------------
13-
// Please see the explanation in docs/intro-examples.md for an explanation.
13+
// Explanation: https://github.com/bemanproject/execution/blob/main/docs/intro-examples.md
1414

1515
int main() {
1616
// clang-format off

examples/stopping.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ int main() {
8484
inject_cancel_sender{token, ex::read_env(ex::get_stop_token) | ex::then([](ex::inplace_stop_token tok) {
8585
while (not tok.stop_requested()) {
8686
std::cout << "sleeping\n";
87-
std::this_thread::sleep_for(1s);
87+
std::this_thread::sleep_for(100ms);
8888
}
8989
})});
9090
});
9191

92-
std::cin.get();
92+
// std::cin.get();
93+
std::this_thread::sleep_for(300ms);
9394
std::cout << "requesting stop\n";
9495
source.request_stop();
9596

src/beman/execution/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
add_library(${TARGET_NAME} STATIC)
77
add_library(${TARGET_ALIAS} ALIAS ${TARGET_NAME})
88

9-
if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
10-
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_options>)
11-
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_warnings>)
12-
endif()
13-
149
include(CMakePrintHelpers)
1510
cmake_print_variables(TARGET_ALIAS TARGET_NAME TARGET_PREFIX PROJECT_SOURCE_DIR)
1611

tests/beman/execution/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ if(NOT DEFINED CMAKE_PREFIX_PATH)
110110
endif()
111111

112112
if(PROJECT_IS_TOP_LEVEL)
113-
enable_testing()
114113
find_package(beman_execution 0.0.1 EXACT QUIET)
115114
if(beman_execution_FOUND)
116115
set(execution_tests exec-awaitable.test) # only one sample to save time! CK

0 commit comments

Comments
 (0)