-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
) | ||
|
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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() | ||
|
||
|
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete this whole file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// include/beman/execution/detail/config/config.hpp -*-C++-*- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
||
|
@@ -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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
|
||
|
@@ -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 | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete this |
||
# cmake-format: on | ||
|
||
install( | ||
|
There was a problem hiding this comment.
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.