From 57b78ecf5a74804f35ec0c64fe550a3b03bbe846 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Sun, 26 Jul 2026 01:46:20 +0000 Subject: [PATCH] use `cmake-format` to format all CMake consistently --- CMakeLists.txt | 620 ++++++++++++++------------ cmake/Modules/CompilerHelpers.cmake | 56 ++- cmake/Modules/ConfigureASIO.cmake | 106 +++-- cmake/Modules/ConfigureTBB.cmake | 80 ++-- cmake/Modules/ConfigureTaskflow.cmake | 47 +- cmake/Modules/FindSphinx.cmake | 32 +- cmake/Modules/Findnuma.cmake | 56 ++- cmake/RAPIDS.cmake | 27 +- cmake/clangd_compile_info.cmake | 39 +- cmake/cmake_utilities.cmake | 61 +-- cmake/import_standalone_asio.cmake | 123 ++--- docs/CMakeLists.txt | 111 +++-- examples/CMakeLists.txt | 164 +++---- examples/nvexec/CMakeLists.txt | 194 ++++---- test/CMakeLists.txt | 170 +++---- test/exec/CMakeLists.txt | 80 ++-- test/exec/asio/CMakeLists.txt | 37 +- test/exec/taskflow/CMakeLists.txt | 34 +- test/exec/tbb/CMakeLists.txt | 34 +- test/nvexec/CMakeLists.txt | 61 +-- test/rrd/CMakeLists.txt | 43 +- 21 files changed, 1135 insertions(+), 1040 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c03add6fb..9622cfa23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if(POLICY CMP0167) set(CMAKE_POLICY_DEFAULT_CMP0167 NEW) endif() -############################################################################## +# ############################################################################## # Initialize rapids-cmake include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/RAPIDS.cmake) # utilities for generating export set package metadata @@ -34,18 +34,22 @@ include(rapids-find) include(rapids-cmake) # utilities for using CPM include(rapids-cpm) -# - Project definition ------------------------------------------------------- +# * Project definition ------------------------------------------------------- -# Determine if STDEXEC is built as a subproject (using add_subdirectory) or if it is the main project. -if (NOT DEFINED STDEXEC_MAIN_PROJECT) +# Determine if STDEXEC is built as a subproject (using add_subdirectory) or if +# it is the main project. +if(NOT DEFINED STDEXEC_MAIN_PROJECT) set(STDEXEC_MAIN_PROJECT OFF) # Checking project name is more reliable than checking source directories. - if (NOT DEFINED PROJECT_NAME) + if(NOT DEFINED PROJECT_NAME) set(STDEXEC_MAIN_PROJECT ON) - endif () -endif () + endif() +endif() -project(STDEXEC VERSION "0.11.0" LANGUAGES CXX) +project( + STDEXEC + VERSION "0.11.0" + LANGUAGES CXX) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/CompilerHelpers.cmake) @@ -74,12 +78,12 @@ rapids_cmake_build_type(Release) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") -# Disable the tests by default unless it is the top level project or build testing was -# specified. -if (STDEXEC_MAIN_PROJECT OR BUILD_TESTING) - set(STDEXEC_BUILD_TESTS_DEFAULT ON) +# Disable the tests by default unless it is the top level project or build +# testing was specified. +if(STDEXEC_MAIN_PROJECT OR BUILD_TESTING) + set(STDEXEC_BUILD_TESTS_DEFAULT ON) else() - set(STDEXEC_BUILD_TESTS_DEFAULT OFF) + set(STDEXEC_BUILD_TESTS_DEFAULT OFF) endif() option(STDEXEC_BUILD_TESTS "Build stdexec tests" ${STDEXEC_BUILD_TESTS_DEFAULT}) @@ -89,56 +93,70 @@ option(STDEXEC_INSTALL "Generate the install target." ${STDEXEC_MAIN_PROJECT}) # which is CMake's preferred option for enabling testing when using CTest. set(BUILD_TESTING ${STDEXEC_BUILD_TESTS}) -if (STDEXEC_BUILD_TESTS) +if(STDEXEC_BUILD_TESTS) # CTest automatically calls enable_testing() if BUILD_TESTING is ON # https://cmake.org/cmake/help/latest/module/CTest.html#module:CTest list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure") include(CTest) endif() -############################################################################## -# - Dependencies ------------------------------------------------------------- +# ############################################################################## +# * Dependencies ------------------------------------------------------------- # Initialize CPM rapids_cpm_init(OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/versions.json) -if (STDEXEC_BUILD_TESTS) - # Add Catch2 - set(Catch2_VERSION 3.14.0) - # Always download it, don't attempt to do `find_package(Catch2)` first - set(CPM_DOWNLOAD_Catch2 TRUE) - rapids_cpm_find(Catch2 ${Catch2_VERSION} - GLOBAL_TARGETS Catch2::Catch2WithMain - BUILD_EXPORT_SET stdexec-exports - CPM_ARGS - URL https://github.com/catchorg/Catch2/archive/refs/tags/v${Catch2_VERSION}.zip - OPTIONS - "CMAKE_CXX_STANDARD 20" - "CATCH_CONFIG_NO_POSIX_SIGNALS ON" - ) +if(STDEXEC_BUILD_TESTS) + # Add Catch2 + set(Catch2_VERSION 3.14.0) + # Always download it, don't attempt to do `find_package(Catch2)` first + set(CPM_DOWNLOAD_Catch2 TRUE) + rapids_cpm_find( + Catch2 + ${Catch2_VERSION} + GLOBAL_TARGETS + Catch2::Catch2WithMain + BUILD_EXPORT_SET + stdexec-exports + CPM_ARGS + URL + https://github.com/catchorg/Catch2/archive/refs/tags/v${Catch2_VERSION}.zip + OPTIONS + "CMAKE_CXX_STANDARD 20" + "CATCH_CONFIG_NO_POSIX_SIGNALS ON") endif() # Add ICM set(icm_VERSION 1.5.0) # Always download it, don't attempt to do `find_package(ICM)` first set(CPM_DOWNLOAD_icm TRUE) -rapids_cpm_find(icm ${icm_VERSION} +rapids_cpm_find( + icm + ${icm_VERSION} CPM_ARGS - GITHUB_REPOSITORY iboB/icm - GIT_TAG v${icm_VERSION} - VERSION ${icm_VERSION} - PATCH_COMMAND git restore -- . && git apply ${CMAKE_CURRENT_LIST_DIR}/cmake/cpm/patches/icm/regex-build-error.diff -) + GITHUB_REPOSITORY + iboB/icm + GIT_TAG + v${icm_VERSION} + VERSION + ${icm_VERSION} + PATCH_COMMAND + git + restore + -- + . + && + git + apply + ${CMAKE_CURRENT_LIST_DIR}/cmake/cpm/patches/icm/regex-build-error.diff) # Ensure that we link with the threading library set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -rapids_find_package(Threads REQUIRED - BUILD_EXPORT_SET stdexec-exports - INSTALL_EXPORT_SET stdexec-exports -) +rapids_find_package(Threads REQUIRED BUILD_EXPORT_SET stdexec-exports + INSTALL_EXPORT_SET stdexec-exports) -############################################################################## -# - Main library targets ----------------------------------------------------- +# ############################################################################## +# * Main library targets ----------------------------------------------------- # Detect the compiler frontend (GNU, Clang, MSVC, etc.) if(DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT) @@ -148,26 +166,25 @@ else() endif() # Build relacy tests by default only for GNU compiler and if tests are enabled -# It will take work to get other platforms to work in the future. -# Additionally, do not build the Relacy tests when a sanitizer is active. TSAN -# doesn't do anything since Relacy simulates threads with fibers anyway. Relacy -# has primtive (compared to ASAN) use-after-free detection which doesn't compose -# with ASAN. -# Additionally, we require GCC-12 or newer for Relacy, at __atomic.hpp has fallback -# when std::atomic> is not provided, and GCC-12 is the first -# libstdc++ that provides it. -# Additionally, realacy is not ready for -fno-exceptions. -if( - ${STDEXEC_BUILD_TESTS} AND - CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND - CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND - NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize" AND - NOT CMAKE_CXX_FLAGS MATCHES "-fno-exceptions") +# It will take work to get other platforms to work in the future. Additionally, +# do not build the Relacy tests when a sanitizer is active. TSAN doesn't do +# anything since Relacy simulates threads with fibers anyway. Relacy has +# primtive (compared to ASAN) use-after-free detection which doesn't compose +# with ASAN. Additionally, we require GCC-12 or newer for Relacy, at +# __atomic.hpp has fallback when std::atomic> is not provided, +# and GCC-12 is the first libstdc++ that provides it. Additionally, realacy is +# not ready for -fno-exceptions. +if(${STDEXEC_BUILD_TESTS} + AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 + AND NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize" + AND NOT CMAKE_CXX_FLAGS MATCHES "-fno-exceptions") set(STDEXEC_BUILD_RELACY_TESTS_DEFAULT ON) else() set(STDEXEC_BUILD_RELACY_TESTS_DEFAULT OFF) endif() -option(STDEXEC_BUILD_RELACY_TESTS "Build stdexec relacy tests" ${STDEXEC_BUILD_RELACY_TESTS_DEFAULT}) +option(STDEXEC_BUILD_RELACY_TESTS "Build stdexec relacy tests" + ${STDEXEC_BUILD_RELACY_TESTS_DEFAULT}) set(stdexec_export_targets) @@ -176,39 +193,43 @@ add_library(stdexec INTERFACE) file(GLOB_RECURSE exec_headers CONFIGURE_DEPENDS include/exec/*.hpp) file(GLOB_RECURSE stdexec_headers CONFIGURE_DEPENDS include/stdexec/*.hpp) -target_sources(stdexec -PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS include - FILES - ${exec_headers} - ${stdexec_headers} - # stdexec_version_config.hpp is generated by rapids' script - FILE_SET version_config - TYPE HEADERS - BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include - FILES - ${CMAKE_CURRENT_BINARY_DIR}/include/stdexec_version_config.hpp -) -# Mark include directories as SYSTEM so consumers don't get warnings from stdexec internals -target_include_directories(stdexec SYSTEM INTERFACE - $ - $ - $ -) +target_sources( + stdexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + include + FILES + ${exec_headers} + ${stdexec_headers} + # stdexec_version_config.hpp is generated by rapids' script + FILE_SET + version_config + TYPE + HEADERS + BASE_DIRS + ${CMAKE_CURRENT_BINARY_DIR}/include + FILES + ${CMAKE_CURRENT_BINARY_DIR}/include/stdexec_version_config.hpp) +# Mark include directories as SYSTEM so consumers don't get warnings from +# stdexec internals +target_include_directories( + stdexec SYSTEM + INTERFACE $ + $ + $) list(APPEND stdexec_export_targets stdexec) # Set library version -set_target_properties(stdexec PROPERTIES - VERSION "${STDEXEC_VERSION}" - SOVERSION "${STDEXEC_VERSION_MAJOR}") +set_target_properties(stdexec PROPERTIES VERSION "${STDEXEC_VERSION}" + SOVERSION "${STDEXEC_VERSION_MAJOR}") -if (STDEXEC_BUILD_TESTS) +if(STDEXEC_BUILD_TESTS) # Test that headers are self-contained - set_target_properties(stdexec PROPERTIES - VERIFY_INTERFACE_HEADER_SETS TRUE) + set_target_properties(stdexec PROPERTIES VERIFY_INTERFACE_HEADER_SETS TRUE) endif() # Declare the public include directories @@ -221,35 +242,36 @@ target_compile_features(stdexec INTERFACE cxx_std_20) # # Enable GPU compilation when using NVHPC compiler # target_compile_options(stdexec INTERFACE -# $<$:-stdpar=gpu> -# ) -# target_link_options(stdexec INTERFACE -# $<$:-stdpar=gpu> -# ) +# $<$:-stdpar=gpu> ) target_link_options(stdexec +# INTERFACE $<$:-stdpar=gpu> ) # Enable coroutines for GCC -target_compile_options(stdexec INTERFACE - $<$:-fcoroutines> - ) +target_compile_options(stdexec + INTERFACE $<$:-fcoroutines>) # Increase the concepts diagnostics depth for GCC -target_compile_options(stdexec INTERFACE - $<$:-fconcepts-diagnostics-depth=10> - ) +target_compile_options( + stdexec + INTERFACE $<$:-fconcepts-diagnostics-depth=10>) # Do you want a preprocessor that works? Picky, picky. -target_compile_options(stdexec INTERFACE - $<$:/Zc:__cplusplus /Zc:preprocessor /Zc:externConstexpr /bigobj> - ) - -set(STDEXEC_NAMESPACE "stdexec" CACHE STRING "The name of the top-level namespace for stdexec") -if (NOT STDEXEC_NAMESPACE STREQUAL "stdexec") - target_compile_definitions(stdexec INTERFACE STDEXEC_NAMESPACE=${STDEXEC_NAMESPACE}) +target_compile_options( + stdexec INTERFACE $<$:/Zc:__cplusplus + /Zc:preprocessor /Zc:externConstexpr /bigobj>) + +set(STDEXEC_NAMESPACE + "stdexec" + CACHE STRING "The name of the top-level namespace for stdexec") +if(NOT STDEXEC_NAMESPACE STREQUAL "stdexec") + target_compile_definitions(stdexec + INTERFACE STDEXEC_NAMESPACE=${STDEXEC_NAMESPACE}) endif() -option(STDEXEC_ENABLE_EXTRA_TYPE_CHECKING "Enable extra type checking that is costly at compile-time" OFF) -if (STDEXEC_ENABLE_EXTRA_TYPE_CHECKING) - target_compile_definitions(stdexec INTERFACE STDEXEC_ENABLE_EXTRA_TYPE_CHECKING) +option(STDEXEC_ENABLE_EXTRA_TYPE_CHECKING + "Enable extra type checking that is costly at compile-time" OFF) +if(STDEXEC_ENABLE_EXTRA_TYPE_CHECKING) + target_compile_definitions(stdexec + INTERFACE STDEXEC_ENABLE_EXTRA_TYPE_CHECKING) endif() add_library(STDEXEC::stdexec ALIAS stdexec) @@ -257,7 +279,8 @@ add_library(STDEXEC::stdexec ALIAS stdexec) # Support target for examples and tests add_library(stdexec_executable_flags INTERFACE) -# suppress Wunused-parameter in cased of fno-exceptions due to Catch2 bug https://github.com/catchorg/Catch2/issues/3114 +# suppress Wunused-parameter in cased of fno-exceptions due to Catch2 bug +# https://github.com/catchorg/Catch2/issues/3114 if(CMAKE_CXX_FLAGS MATCHES "-fno-exceptions") set(SUPPRESS_WUNUSED_PARAMETER 1) else() @@ -265,185 +288,214 @@ else() endif() # Enable warnings -target_compile_options(stdexec_executable_flags INTERFACE - $<$:-Wall;$> - $<$:-Wall> - $<$:/W4>) +target_compile_options( + stdexec_executable_flags + INTERFACE + $<$:-Wall;$> + $<$:-Wall> + $<$:/W4>) # Increase the error limit with NVC++ -target_compile_options(stdexec_executable_flags INTERFACE - $<$:-e1000>) +target_compile_options(stdexec_executable_flags + INTERFACE $<$:-e1000>) # Silence warnings -target_compile_options(stdexec_executable_flags INTERFACE - $<$:-Wno-non-template-friend> - $<$:--diag_suppress177,550,111,497,554> - $<$:/wd4100 /wd4101 /wd4127 /wd4324 /wd4456 /wd4459>) +target_compile_options( + stdexec_executable_flags + INTERFACE $<$:-Wno-non-template-friend> + $<$:--diag_suppress177,550,111,497,554> + $<$:/wd4100 + /wd4101 + /wd4127 + /wd4324 + /wd4456 + /wd4459>) # Template backtrace limit -target_compile_options(stdexec_executable_flags INTERFACE - $<$,$>: - $<$:/clang:>-ferror-limit=0 - $<$:/clang:>-fmacro-backtrace-limit=0 - $<$:/clang:>-ftemplate-backtrace-limit=0> - $<$,$,23.3.0>>: - -ftemplate-backtrace-limit=0>) - -# # Always enable colored output -# target_compile_options(stdexec_executable_flags INTERFACE -# $<$,$>: -# -fcolor-diagnostics> -# $<$:-fdiagnostics-color=always> -# ) +target_compile_options( + stdexec_executable_flags + INTERFACE + $<$,$>: + $<$:/clang:>-ferror-limit=0 + $<$:/clang:>-fmacro-backtrace-limit=0 + $<$:/clang:>-ftemplate-backtrace-limit=0> + $<$,$,23.3.0>>: + -ftemplate-backtrace-limit=0>) + +# # Always enable colored output target_compile_options(stdexec_executable_flags +# INTERFACE +# $<$,$>: +# -fcolor-diagnostics> $<$:-fdiagnostics-color=always> ) # Clang CUDA options -target_compile_options(stdexec_executable_flags INTERFACE - $<$: - -Wno-unknown-cuda-version - -Xclang=-fcuda-allow-variadic-functions - -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 - -include stdexec/__detail/__force_include.hpp> - ) +target_compile_options( + stdexec_executable_flags + INTERFACE $<$: + -Wno-unknown-cuda-version + -Xclang=-fcuda-allow-variadic-functions + -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 + -include + stdexec/__detail/__force_include.hpp>) # Set up nvexec library option(STDEXEC_ENABLE_CUDA "Enable CUDA targets for non-nvc++ compilers" OFF) if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") - set(STDEXEC_ENABLE_CUDA ON) - # Unset these if using nvc++ - disable_compiler(LANG CUDA) + set(STDEXEC_ENABLE_CUDA ON) + # Unset these if using nvc++ + disable_compiler(LANG CUDA) - set(_nvhpc_seperate_memory_flags "-gpu=mem:separate") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 24.5.0) - set(_nvhpc_seperate_memory_flags "-gpu=nomanaged") - endif() + set(_nvhpc_seperate_memory_flags "-gpu=mem:separate") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 24.5.0) + set(_nvhpc_seperate_memory_flags "-gpu=nomanaged") + endif() - # Use nvc++ -stdpar to find the location of the HPC SDK's libcudacxx headers. - nvhpc_find_libcudacxx_include_dir(STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR) + # Use nvc++ -stdpar to find the location of the HPC SDK's libcudacxx headers. + nvhpc_find_libcudacxx_include_dir(STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR) endif() # Support target for examples and tests add_library(nvexec_executable_flags INTERFACE) -target_compile_options(nvexec_executable_flags INTERFACE - $<$,$>:${_nvhpc_seperate_memory_flags}>) -target_link_options(nvexec_executable_flags INTERFACE - $<$,$>:${_nvhpc_seperate_memory_flags}>) +target_compile_options( + nvexec_executable_flags + INTERFACE + $<$,$>:${_nvhpc_seperate_memory_flags}> +) +target_link_options( + nvexec_executable_flags + INTERFACE + $<$,$>:${_nvhpc_seperate_memory_flags}> +) if(STDEXEC_ENABLE_CUDA) - file(GLOB_RECURSE nvexec_headers CONFIGURE_DEPENDS include/nvexec/*.cuh) - add_library(nvexec INTERFACE) - target_sources(nvexec - PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS include - FILES ${nvexec_headers} - ) - list(APPEND stdexec_export_targets nvexec) - add_library(STDEXEC::nvexec ALIAS nvexec) - - target_compile_features(nvexec INTERFACE cuda_std_20) - target_link_libraries(nvexec INTERFACE STDEXEC::stdexec) - - if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - set(CMAKE_CUDA_ARCHITECTURES "native") + file(GLOB_RECURSE nvexec_headers CONFIGURE_DEPENDS include/nvexec/*.cuh) + add_library(nvexec INTERFACE) + target_sources( + nvexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + include + FILES + ${nvexec_headers}) + list(APPEND stdexec_export_targets nvexec) + add_library(STDEXEC::nvexec ALIAS nvexec) + + target_compile_features(nvexec INTERFACE cuda_std_20) + target_link_libraries(nvexec INTERFACE STDEXEC::stdexec) + + if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + set(CMAKE_CUDA_ARCHITECTURES "native") + endif() + + cuda_archs_to_gpu_list("${CMAKE_CUDA_ARCHITECTURES}" _gpus) + + target_compile_options( + nvexec + INTERFACE $<$,$>:-stdpar + -gpu=${_gpus}>) + target_link_options( + nvexec INTERFACE + $<$,$>:-stdpar + -gpu=${_gpus}>) + + install( + TARGETS nvexec + EXPORT stdexec-exports + FILE_SET headers) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") + if(STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR) + # Explicitly add the libcudacxx include directory to the nvexec target so + # that clangd can find the libcudacxx headers. + target_include_directories( + nvexec SYSTEM INTERFACE ${STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR}) endif() + else() + include(rapids-cuda) + # Needs to run before `enable_language(CUDA)` + rapids_cuda_init_architectures(STDEXEC) + enable_language(CUDA) + # Since stdexec only enables CUDA optionally we need to manually include the + # file that rapids_cuda_init_architectures relies on `project` calling + if(CMAKE_PROJECT_STDEXEC_INCLUDE) + include("${CMAKE_PROJECT_STDEXEC_INCLUDE}") + endif() + # Must come after enable_language(CUDA) Use `-isystem ` instead of + # `-isystem=` because the former works with clangd intellisense + set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA "-isystem ") + + set_source_files_properties(${nvexec_headers} PROPERTIES LANGUAGE CUDA) - cuda_archs_to_gpu_list("${CMAKE_CUDA_ARCHITECTURES}" _gpus) - - target_compile_options(nvexec INTERFACE - $<$,$>:-stdpar -gpu=${_gpus}>) - target_link_options(nvexec INTERFACE - $<$,$>:-stdpar -gpu=${_gpus}>) - - install(TARGETS nvexec - EXPORT stdexec-exports - FILE_SET headers) - - if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") - if(STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR) - # Explicitly add the libcudacxx include directory to the nvexec target so that - # clangd can find the libcudacxx headers. - target_include_directories(nvexec SYSTEM INTERFACE ${STDEXEC_NVHPC_LIBCUDACXX_INCLUDE_DIR}) - endif() - else () - include(rapids-cuda) - # Needs to run before `enable_language(CUDA)` - rapids_cuda_init_architectures(STDEXEC) - enable_language(CUDA) - # Since stdexec only enables CUDA optionally we need to manually include - # the file that rapids_cuda_init_architectures relies on `project` calling - if(CMAKE_PROJECT_STDEXEC_INCLUDE) - include("${CMAKE_PROJECT_STDEXEC_INCLUDE}") - endif() - # Must come after enable_language(CUDA) - # Use `-isystem ` instead of `-isystem=` - # because the former works with clangd intellisense - set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA "-isystem ") - - set_source_files_properties(${nvexec_headers} PROPERTIES LANGUAGE CUDA) - - rapids_find_package( - CUDAToolkit REQUIRED - BUILD_EXPORT_SET stdexec-exports - INSTALL_EXPORT_SET stdexec-exports - ) - - target_link_libraries(nvexec INTERFACE CUDA::cudart) - - include(${rapids-cmake-dir}/cpm/cccl.cmake) - rapids_cpm_cccl( - BUILD_EXPORT_SET stdexec-exports - INSTALL_EXPORT_SET stdexec-exports - SYSTEM TRUE) - - target_link_libraries(nvexec INTERFACE CCCL::CCCL) - endif () -endif () + rapids_find_package(CUDAToolkit REQUIRED BUILD_EXPORT_SET stdexec-exports + INSTALL_EXPORT_SET stdexec-exports) + + target_link_libraries(nvexec INTERFACE CUDA::cudart) + + include(${rapids-cmake-dir}/cpm/cccl.cmake) + rapids_cpm_cccl(BUILD_EXPORT_SET stdexec-exports INSTALL_EXPORT_SET + stdexec-exports SYSTEM TRUE) + + target_link_libraries(nvexec INTERFACE CCCL::CCCL) + endif() +endif() include(ConfigureTBB) include(ConfigureTaskflow) include(ConfigureASIO) -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") check_include_file_cxx("dispatch/dispatch.h" STDEXEC_FOUND_LIBDISPATCH) - option(STDEXEC_ENABLE_LIBDISPATCH "Enable use of the Grand Central Dispatch scheduler" ${STDEXEC_FOUND_LIBDISPATCH}) - if (STDEXEC_ENABLE_LIBDISPATCH) + option(STDEXEC_ENABLE_LIBDISPATCH + "Enable use of the Grand Central Dispatch scheduler" + ${STDEXEC_FOUND_LIBDISPATCH}) + if(STDEXEC_ENABLE_LIBDISPATCH) target_compile_definitions(stdexec INTERFACE STDEXEC_ENABLE_LIBDISPATCH) endif() endif() -if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") check_include_file_cxx("windows.h" STDEXEC_FOUND_WINDOWS_HEADER) - option(STDEXEC_ENABLE_WINDOWS_THREAD_POOL "Enable use of the Windows Thread Pool scheduler" ${STDEXEC_FOUND_WINDOWS_HEADER}) - target_compile_definitions(stdexec INTERFACE STDEXEC_ENABLE_WINDOWS_THREAD_POOL) + option(STDEXEC_ENABLE_WINDOWS_THREAD_POOL + "Enable use of the Windows Thread Pool scheduler" + ${STDEXEC_FOUND_WINDOWS_HEADER}) + target_compile_definitions(stdexec + INTERFACE STDEXEC_ENABLE_WINDOWS_THREAD_POOL) endif() -option (STDEXEC_ENABLE_NUMA "Enable NUMA affinity for static_thread_pool" OFF) -if (STDEXEC_ENABLE_NUMA) +option(STDEXEC_ENABLE_NUMA "Enable NUMA affinity for static_thread_pool" OFF) +if(STDEXEC_ENABLE_NUMA) find_package(numa REQUIRED) target_link_libraries(stdexec INTERFACE numa::numa) target_compile_definitions(stdexec INTERFACE STDEXEC_ENABLE_NUMA) endif() -option(STDEXEC_BUILD_PARALLEL_SCHEDULER "Build the parallel_scheduler compiled library" OFF) -if (DEFINED STDEXEC_BUILD_SYSTEM_CONTEXT) - message(DEPRECATION "STDEXEC_BUILD_SYSTEM_CONTEXT is deprecated. Use STDEXEC_BUILD_PARALLEL_SCHEDULER instead.") +option(STDEXEC_BUILD_PARALLEL_SCHEDULER + "Build the parallel_scheduler compiled library" OFF) +if(DEFINED STDEXEC_BUILD_SYSTEM_CONTEXT) + message( + DEPRECATION + "STDEXEC_BUILD_SYSTEM_CONTEXT is deprecated. Use STDEXEC_BUILD_PARALLEL_SCHEDULER instead." + ) set(STDEXEC_BUILD_PARALLEL_SCHEDULER ${STDEXEC_BUILD_SYSTEM_CONTEXT}) endif() if(STDEXEC_BUILD_PARALLEL_SCHEDULER) - set(STDEXEC_PARALLEL_SCHEDULER_SOURCES src/parallel_scheduler/parallel_scheduler.cpp) + set(STDEXEC_PARALLEL_SCHEDULER_SOURCES + src/parallel_scheduler/parallel_scheduler.cpp) add_library(parallel_scheduler ${STDEXEC_PARALLEL_SCHEDULER_SOURCES}) target_compile_features(parallel_scheduler PUBLIC cxx_std_20) - set_target_properties(parallel_scheduler PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF) - target_compile_options(parallel_scheduler PUBLIC - $<$:/Zc:__cplusplus /Zc:preprocessor /Zc:externConstexpr> - ) + set_target_properties( + parallel_scheduler + PROPERTIES CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF) + target_compile_options( + parallel_scheduler PUBLIC $<$:/Zc:__cplusplus + /Zc:preprocessor /Zc:externConstexpr>) target_link_libraries(parallel_scheduler PUBLIC stdexec) add_library(STDEXEC::parallel_scheduler ALIAS parallel_scheduler) @@ -453,14 +505,15 @@ if(STDEXEC_BUILD_PARALLEL_SCHEDULER) set(stdexec_export_targets ${stdexec_export_targets} parallel_scheduler) endif() -option(STDEXEC_ENABLE_IO_URING "Enable the use of the io_uring scheduler on Linux" OFF) +option(STDEXEC_ENABLE_IO_URING + "Enable the use of the io_uring scheduler on Linux" OFF) if(STDEXEC_ENABLE_IO_URING) if(CMAKE_CROSSCOMPILING) check_include_file_cxx("linux/io_uring.h" STDEXEC_ENABLE_IO_URING) else() include(CheckCXXSourceRuns) - CHECK_CXX_SOURCE_RUNS( + check_cxx_source_runs( " #include #include @@ -485,67 +538,76 @@ option(STDEXEC_BUILD_EXAMPLES "Build stdexec examples" ON) # Configure documentation if(STDEXEC_BUILD_DOCS) - add_subdirectory(docs EXCLUDE_FROM_ALL) + add_subdirectory(docs EXCLUDE_FROM_ALL) endif() # Configure test executables if(STDEXEC_BUILD_TESTS) - add_subdirectory(test) + add_subdirectory(test) endif() # Configure example executables if(STDEXEC_BUILD_EXAMPLES) - add_subdirectory(examples) + add_subdirectory(examples) endif() -if (STDEXEC_IS_TOP_LEVEL) +if(STDEXEC_IS_TOP_LEVEL) # Integrate with LLVM/clang tooling include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clangd_compile_info.cmake) add_executable(_clangd_helper_file include/._clangd_helper_file.cpp) - target_link_libraries(_clangd_helper_file PRIVATE - STDEXEC::stdexec - $ - $ - $ - $ - ) + target_link_libraries( + _clangd_helper_file + PRIVATE STDEXEC::stdexec + $ + $ + $ + $) endif() -############################################################################## +# ############################################################################## # Install targets ------------------------------------------------------------ if(STDEXEC_INSTALL) - include(CPack) + include(CPack) set(stdexec_install_targets stdexec) if(STDEXEC_BUILD_PARALLEL_SCHEDULER) list(APPEND stdexec_install_targets parallel_scheduler) endif() - install(TARGETS ${stdexec_install_targets} + install( + TARGETS ${stdexec_install_targets} EXPORT stdexec-exports - FILE_SET headers - FILE_SET version_config) - - ############################################################################## - # Install exports ------------------------------------------------------------ - - set(code_string "") - - # Install side of the export set - rapids_export( - INSTALL ${stdexec_export_targets} - EXPORT_SET stdexec-exports - GLOBAL_TARGETS ${stdexec_export_targets} - NAMESPACE STDEXEC:: - FINAL_CODE_BLOCK code_string - ) - - # Build side of the export set so a user can use the build dir as a CMake package root - rapids_export( - BUILD ${stdexec_export_targets} - EXPORT_SET stdexec-exports - GLOBAL_TARGETS ${stdexec_export_targets} - NAMESPACE STDEXEC:: - FINAL_CODE_BLOCK code_string - ) + FILE_SET headers FILE_SET version_config) + + # ############################################################################ + # Install exports ------------------------------------------------------------ + + set(code_string "") + + # Install side of the export set + rapids_export( + INSTALL + ${stdexec_export_targets} + EXPORT_SET + stdexec-exports + GLOBAL_TARGETS + ${stdexec_export_targets} + NAMESPACE + STDEXEC:: + FINAL_CODE_BLOCK + code_string) + + # Build side of the export set so a user can use the build dir as a CMake + # package root + rapids_export( + BUILD + ${stdexec_export_targets} + EXPORT_SET + stdexec-exports + GLOBAL_TARGETS + ${stdexec_export_targets} + NAMESPACE + STDEXEC:: + FINAL_CODE_BLOCK + code_string) endif() diff --git a/cmake/Modules/CompilerHelpers.cmake b/cmake/Modules/CompilerHelpers.cmake index fc74a211f..876778007 100644 --- a/cmake/Modules/CompilerHelpers.cmake +++ b/cmake/Modules/CompilerHelpers.cmake @@ -1,44 +1,48 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= include_guard(GLOBAL) -# nvhpc_find_libcudacxx_include_dir() -# Invokes nvc++ -stdpar to locate the libcudacxx include root (the directory -# that contains cuda/std/bit) and stores it in . +# nvhpc_find_libcudacxx_include_dir() Invokes nvc++ -stdpar to locate +# the libcudacxx include root (the directory that contains cuda/std/bit) and +# stores it in . function(nvhpc_find_libcudacxx_include_dir out_var) set(_src "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/find_libcudacxx.cu") file(WRITE "${_src}" "#include \n") execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -stdpar -E -M "${_src}" - OUTPUT_VARIABLE _output - ERROR_STRIP_TRAILING_WHITESPACE - ) + COMMAND ${CMAKE_CXX_COMPILER} -stdpar -E -M "${_src}" + OUTPUT_VARIABLE _output + ERROR_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "(/[^\n]*/cuda/std/bit) " _match "${_output}") if(CMAKE_MATCH_1) string(REGEX REPLACE "/cuda/std/bit$" "" _dir "${CMAKE_MATCH_1}") - set(${out_var} "${_dir}" PARENT_SCOPE) + set(${out_var} + "${_dir}" + PARENT_SCOPE) else() - set(${out_var} "" PARENT_SCOPE) + set(${out_var} + "" + PARENT_SCOPE) endif() endfunction() -# cuda_archs_to_gpu_list( ) Converts a list of CUDA architectures (e.g. -# 80, 86, 90) to a comma-separated list of GPU names (e.g. cc80, cc86, cc90) and stores it -# in . This is useful for passing to the -gpu option of nvc++. +# cuda_archs_to_gpu_list( ) Converts a list of CUDA +# architectures (e.g. 80, 86, 90) to a comma-separated list of GPU names (e.g. +# cc80, cc86, cc90) and stores it in . This is useful for passing to +# the -gpu option of nvc++. function(cuda_archs_to_gpu_list archs out_var) set(_gpus) foreach(_arch IN LISTS archs) @@ -47,7 +51,9 @@ function(cuda_archs_to_gpu_list archs out_var) list(APPEND _gpus "${_arch}") endforeach() list(JOIN _gpus "," _gpus) - set(${out_var} "${_gpus}" PARENT_SCOPE) + set(${out_var} + "${_gpus}" + PARENT_SCOPE) endfunction() function(disable_compiler) @@ -66,6 +72,8 @@ function(disable_compiler) endif() if(_VAR) - set(${_VAR} "${_val}" PARENT_SCOPE) + set(${_VAR} + "${_val}" + PARENT_SCOPE) endif() endfunction() diff --git a/cmake/Modules/ConfigureASIO.cmake b/cmake/Modules/ConfigureASIO.cmake index 01a839ec7..f142ba1b2 100644 --- a/cmake/Modules/ConfigureASIO.cmake +++ b/cmake/Modules/ConfigureASIO.cmake @@ -1,6 +1,9 @@ option(STDEXEC_ENABLE_ASIO "Enable ASIO targets" OFF) -set(STDEXEC_ASIO_IMPLEMENTATION "boost" CACHE STRING "boost") -set_property(CACHE STDEXEC_ASIO_IMPLEMENTATION PROPERTY STRINGS boost standalone) +set(STDEXEC_ASIO_IMPLEMENTATION + "boost" + CACHE STRING "boost") +set_property(CACHE STDEXEC_ASIO_IMPLEMENTATION PROPERTY STRINGS boost + standalone) if(STDEXEC_ENABLE_ASIO) set(STDEXEC_ASIO_USES_BOOST FALSE) @@ -11,95 +14,104 @@ if(STDEXEC_ENABLE_ASIO) elseif(${STDEXEC_ASIO_IMPLEMENTATION} STREQUAL "standalone") set(STDEXEC_ASIO_USES_STANDALONE TRUE) else() - message(FATAL_ERROR "Unknown configuration for ASIO implementation: " ${STDEXEC_ASIO_IMPLEMENTATION}) + message(FATAL_ERROR "Unknown configuration for ASIO implementation: " + ${STDEXEC_ASIO_IMPLEMENTATION}) endif() - set(STDEXEC_ASIO_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp) + set(STDEXEC_ASIO_CONFIG_HPP + ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp) - configure_file( - include/exec/asio/asio_config.hpp.in - ${STDEXEC_ASIO_CONFIG_HPP} - ) + configure_file(include/exec/asio/asio_config.hpp.in + ${STDEXEC_ASIO_CONFIG_HPP}) file(GLOB_RECURSE asioexec_sources CONFIGURE_DEPENDS include/exec/asio/*.hpp) if(${STDEXEC_ASIO_USES_BOOST}) set(BOOST_INCLUDE_LIBRARIES asio system) set(BOOST_VERSION 1.86.0) - rapids_cpm_find(Boost ${BOOST_VERSION} + rapids_cpm_find( + Boost + ${BOOST_VERSION} CPM_ARGS - URL https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}-cmake.tar.xz - OPTIONS "BOOST_SKIP_INSTALL_RULES OFF" - ) + URL + https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}-cmake.tar.xz + OPTIONS + "BOOST_SKIP_INSTALL_RULES OFF") add_library(asioexec INTERFACE) list(APPEND stdexec_export_targets asioexec) add_library(STDEXEC::asioexec ALIAS asioexec) - # These aliases are provided for backwards compatibility with the old target names + # These aliases are provided for backwards compatibility with the old target + # names add_library(asioexec_boost ALIAS asioexec) add_library(stdexec_boost_pool ALIAS asioexec) add_library(STDEXEC::asio_pool ALIAS asioexec) add_library(STDEXEC::asioexec_boost ALIAS asioexec) - target_sources(asioexec PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include - FILES ${asioexec_sources} - BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include - FILES ${STDEXEC_ASIO_CONFIG_HPP} - ) + target_sources( + asioexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/include + FILES + ${asioexec_sources} + BASE_DIRS + ${CMAKE_CURRENT_BINARY_DIR}/include + FILES + ${STDEXEC_ASIO_CONFIG_HPP}) target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_BOOST) - target_link_libraries(asioexec INTERFACE - STDEXEC::stdexec - Boost::asio - ) + target_link_libraries(asioexec INTERFACE STDEXEC::stdexec Boost::asio) if(STDEXEC_INSTALL) - install(TARGETS asioexec + install( + TARGETS asioexec EXPORT stdexec-exports - FILE_SET headers - ) + FILE_SET headers) endif() elseif(${STDEXEC_ASIO_USES_STANDALONE}) include(cmake/import_standalone_asio.cmake) - import_standalone_asio( - TAG "asio-1-31-0" - VERSION "1.31.0") + import_standalone_asio(TAG "asio-1-31-0" VERSION "1.31.0") add_library(asioexec INTERFACE) list(APPEND stdexec_export_targets asioexec) add_library(STDEXEC::asioexec ALIAS asioexec) - # These aliases are provided for backwards compatibility with the old target names + # These aliases are provided for backwards compatibility with the old target + # names add_library(asioexec_asio ALIAS asioexec) add_library(stdexec_asio_pool ALIAS asioexec) add_library(STDEXEC::asio_pool ALIAS asioexec) add_library(STDEXEC::asioexec_asio ALIAS asioexec) - target_sources(asioexec PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include - FILES ${asioexec_sources} - BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include - FILES ${STDEXEC_ASIO_CONFIG_HPP} - ) + target_sources( + asioexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/include + FILES + ${asioexec_sources} + BASE_DIRS + ${CMAKE_CURRENT_BINARY_DIR}/include + FILES + ${STDEXEC_ASIO_CONFIG_HPP}) target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_STANDALONE) - target_link_libraries(asioexec INTERFACE - STDEXEC::stdexec - asio - ) + target_link_libraries(asioexec INTERFACE STDEXEC::stdexec asio) if(STDEXEC_INSTALL) - install(TARGETS asioexec asio + install( + TARGETS asioexec asio EXPORT stdexec-exports - FILE_SET headers - ) + FILE_SET headers) endif() else() diff --git a/cmake/Modules/ConfigureTBB.cmake b/cmake/Modules/ConfigureTBB.cmake index 6678f61af..b987ee91a 100644 --- a/cmake/Modules/ConfigureTBB.cmake +++ b/cmake/Modules/ConfigureTBB.cmake @@ -2,69 +2,75 @@ option(STDEXEC_ENABLE_TBB "Enable TBB targets" OFF) include(CheckIncludeFileCXX) rapids_find_package( - TBB QUIET - COMPONENTS tbb - BUILD_EXPORT_SET stdexec-exports - INSTALL_EXPORT_SET stdexec-exports -) + TBB + QUIET + COMPONENTS + tbb + BUILD_EXPORT_SET + stdexec-exports + INSTALL_EXPORT_SET + stdexec-exports) -# If TBB is available and the stdlib is libstdc++, then a #include of will -# pull in TBB headers, creating a link-time dependency on TBB. -if (TBB_FOUND) - if (NOT STDEXEC_ENABLE_TBB) +# If TBB is available and the stdlib is libstdc++, then a #include of +# will pull in TBB headers, creating a link-time dependency on TBB. +if(TBB_FOUND) + if(NOT STDEXEC_ENABLE_TBB) include(CheckCXXSymbolExists) check_cxx_symbol_exists(__GLIBCXX__ "ciso646" _glibcxx_version_defined) - if (_glibcxx_version_defined) + if(_glibcxx_version_defined) set(STDEXEC_ENABLE_TBB ON) - message(STATUS "Enabling TBB support in stdexec because is available and libstdc++ is used.") + message( + STATUS + "Enabling TBB support in stdexec because is available and libstdc++ is used." + ) endif() endif() else() set(STDEXEC_ENABLE_TBB OFF) endif() -# TBB does not sanitize cleanly. Disable TBB support if any sanitizer is enabled. +# TBB does not sanitize cleanly. Disable TBB support if any sanitizer is +# enabled. string(FIND "${CMAKE_CXX_FLAGS}" "-fsanitize" _fsanitize_flag_index) -if (_fsanitize_flag_index GREATER -1) - message(STATUS "Disabling TBB support in stdexec because sanitizers are enabled.") +if(_fsanitize_flag_index GREATER -1) + message( + STATUS "Disabling TBB support in stdexec because sanitizers are enabled.") set(STDEXEC_ENABLE_TBB OFF) endif() -if (STDEXEC_ENABLE_TBB) - # CONFIGURE_DEPENDS ensures that CMake reconfigures when a relevant hpp file is - # added or removed. +if(STDEXEC_ENABLE_TBB) + # CONFIGURE_DEPENDS ensures that CMake reconfigures when a relevant hpp file + # is added or removed. file(GLOB_RECURSE tbbexec_headers CONFIGURE_DEPENDS include/exec/tbb/*.hpp) add_library(tbbexec INTERFACE) list(APPEND stdexec_export_targets tbbexec) add_library(STDEXEC::tbbexec ALIAS tbbexec) - # These aliases are provided for backwards compatibility with the old target names + # These aliases are provided for backwards compatibility with the old target + # names add_library(tbbpool ALIAS tbbexec) add_library(STDEXEC::tbbpool ALIAS tbbexec) - target_sources(tbbexec - PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS include - FILES ${tbbexec_headers} - ) - target_compile_definitions(tbbexec INTERFACE - STDEXEC_ENABLE_TBB - ) + target_sources( + tbbexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + include + FILES + ${tbbexec_headers}) + target_compile_definitions(tbbexec INTERFACE STDEXEC_ENABLE_TBB) - target_link_libraries(stdexec INTERFACE - TBB::tbb - ) + target_link_libraries(stdexec INTERFACE TBB::tbb) - target_link_libraries(tbbexec INTERFACE - STDEXEC::stdexec - ) + target_link_libraries(tbbexec INTERFACE STDEXEC::stdexec) if(STDEXEC_INSTALL) - install(TARGETS tbbexec + install( + TARGETS tbbexec EXPORT stdexec-exports - FILE_SET headers - ) + FILE_SET headers) endif() endif() diff --git a/cmake/Modules/ConfigureTaskflow.cmake b/cmake/Modules/ConfigureTaskflow.cmake index 35cc9ba8d..72e678427 100644 --- a/cmake/Modules/ConfigureTaskflow.cmake +++ b/cmake/Modules/ConfigureTaskflow.cmake @@ -1,35 +1,40 @@ option(STDEXEC_ENABLE_TASKFLOW "Enable TaskFlow targets" OFF) if(STDEXEC_ENABLE_TASKFLOW) - rapids_cpm_find(Taskflow 3.7.0 - CPM_ARGS - GITHUB_REPOSITORY taskflow/taskflow - GIT_TAG v3.7.0 - OPTIONS "TF_BUILD_TESTS OFF" - ) - file(GLOB_RECURSE taskflowexec_headers CONFIGURE_DEPENDS include/exec/taskflow/*.hpp) + rapids_cpm_find( + Taskflow + 3.7.0 + CPM_ARGS + GITHUB_REPOSITORY + taskflow/taskflow + GIT_TAG + v3.7.0 + OPTIONS + "TF_BUILD_TESTS OFF") + file(GLOB_RECURSE taskflowexec_headers CONFIGURE_DEPENDS + include/exec/taskflow/*.hpp) add_library(taskflowexec INTERFACE ${taskflowexec_headers}) list(APPEND stdexec_export_targets taskflowexec) add_library(STDEXEC::taskflowexec ALIAS taskflowexec) - # These aliases are provided for backwards compatibility with the old target names + # These aliases are provided for backwards compatibility with the old target + # names add_library(taskflow_pool ALIAS taskflowexec) add_library(STDEXEC::taskflow_pool ALIAS taskflowexec) - target_sources(taskflowexec - PUBLIC - FILE_SET headers - TYPE HEADERS - BASE_DIRS include - FILES ${taskflowexec_headers} - ) + target_sources( + taskflowexec + PUBLIC FILE_SET + headers + TYPE + HEADERS + BASE_DIRS + include + FILES + ${taskflowexec_headers}) target_compile_definitions(taskflowexec INTERFACE STDEXEC_ENABLE_TASKFLOW) - target_link_libraries(stdexec INTERFACE - Taskflow - ) + target_link_libraries(stdexec INTERFACE Taskflow) - target_link_libraries(taskflowexec INTERFACE - STDEXEC::stdexec - ) + target_link_libraries(taskflowexec INTERFACE STDEXEC::stdexec) endif() diff --git a/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake index 6b1a37b53..46fc0abba 100644 --- a/cmake/Modules/FindSphinx.cmake +++ b/cmake/Modules/FindSphinx.cmake @@ -1,27 +1,27 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= # Look for an executable called sphinx-build -find_program(SPHINX_EXECUTABLE - NAMES sphinx-build - DOC "Path to sphinx-build executable") +find_program( + SPHINX_EXECUTABLE + NAMES sphinx-build + DOC "Path to sphinx-build executable") include(FindPackageHandleStandardArgs) # Handle standard arguments to find_package like REQUIRED and QUIET -find_package_handle_standard_args(Sphinx - "Failed to find sphinx-build executable" - SPHINX_EXECUTABLE) +find_package_handle_standard_args( + Sphinx "Failed to find sphinx-build executable" SPHINX_EXECUTABLE) diff --git a/cmake/Modules/Findnuma.cmake b/cmake/Modules/Findnuma.cmake index eb840a8de..ada06e9bd 100644 --- a/cmake/Modules/Findnuma.cmake +++ b/cmake/Modules/Findnuma.cmake @@ -1,18 +1,17 @@ # -# Copyright (c) 2023 Maikel Nadolski -# Copyright (c) 2023 NVIDIA Corporation +# Copyright (c) 2023 Maikel Nadolski Copyright (c) 2023 NVIDIA Corporation # -# Licensed under the Apache License Version 2.0 with LLVM Exceptions -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at +# Licensed under the Apache License Version 2.0 with LLVM Exceptions (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# https://llvm.org/LICENSE.txt +# https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. # #[=======================================================================[.rst: @@ -55,24 +54,22 @@ The following cache variables may also be set: #]=======================================================================] -find_path(numa_INCLUDE_DIR +find_path( + numa_INCLUDE_DIR NAMES numa.h PATHS ${PC_Foo_INCLUDE_DIRS} - PATH_SUFFIXES numa -) -find_library(numa_LIBRARY + PATH_SUFFIXES numa) +find_library( + numa_LIBRARY NAMES numa - PATHS ${PC_Foo_LIBRARY_DIRS} -) + PATHS ${PC_Foo_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(numa +find_package_handle_standard_args( + numa FOUND_VAR numa_FOUND - REQUIRED_VARS - numa_LIBRARY - numa_INCLUDE_DIR - VERSION_VAR numa_VERSION -) + REQUIRED_VARS numa_LIBRARY numa_INCLUDE_DIR + VERSION_VAR numa_VERSION) if(numa_FOUND) set(numa_LIBRARIES ${numa_LIBRARY}) @@ -82,14 +79,11 @@ endif() if(numa_FOUND AND NOT TARGET numa::numa) add_library(numa::numa UNKNOWN IMPORTED) - set_target_properties(numa::numa PROPERTIES - IMPORTED_LOCATION "${numa_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_numa_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${numa_INCLUDE_DIR}" - ) + set_target_properties( + numa::numa + PROPERTIES IMPORTED_LOCATION "${numa_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_numa_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${numa_INCLUDE_DIR}") endif() -mark_as_advanced( - numa_INCLUDE_DIR - numa_LIBRARY -) +mark_as_advanced(numa_INCLUDE_DIR numa_LIBRARY) diff --git a/cmake/RAPIDS.cmake b/cmake/RAPIDS.cmake index 0e9536d48..d1a61ff24 100644 --- a/cmake/RAPIDS.cmake +++ b/cmake/RAPIDS.cmake @@ -1,18 +1,18 @@ -#============================================================================= +# ============================================================================= # Copyright (c) 2021-2023, NVIDIA CORPORATION. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= # # This is the preferred entry point for projects using rapids-cmake # @@ -48,7 +48,8 @@ if(NOT rapids-cmake-url) string(APPEND rapids-cmake-url "archive/refs/tags/${rapids-cmake-tag}.zip") else() # Or if neither of the above two were defined, use a branch - string(APPEND rapids-cmake-url "archive/refs/heads/${rapids-cmake-branch}.zip") + string(APPEND rapids-cmake-url + "archive/refs/heads/${rapids-cmake-branch}.zip") endif() endif() @@ -63,8 +64,8 @@ if(POLICY CMP0135) endif() FetchContent_GetProperties(rapids-cmake) if(rapids-cmake_POPULATED) - # Something else has already populated rapids-cmake, only thing - # we need to do is setup the CMAKE_MODULE_PATH + # Something else has already populated rapids-cmake, only thing we need to do + # is setup the CMAKE_MODULE_PATH if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) list(APPEND CMAKE_MODULE_PATH "${rapids-cmake-dir}") endif() diff --git a/cmake/clangd_compile_info.cmake b/cmake/clangd_compile_info.cmake index d30c540a2..b2c56a83b 100644 --- a/cmake/clangd_compile_info.cmake +++ b/cmake/clangd_compile_info.cmake @@ -1,30 +1,35 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. SPDX-License-Identifier: Apache-2.0 # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_utilities.cmake) # Tell cmake to generate a json file of compile commands for clangd: set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# Symlink the compile command output to the source dir, where clangd will find it. +# Symlink the compile command output to the source dir, where clangd will find +# it. set(compile_commands_file "${CMAKE_BINARY_DIR}/compile_commands.json") set(compile_commands_link "${CMAKE_SOURCE_DIR}/compile_commands.json") -message(STATUS "Creating symlink from \"${compile_commands_file}\" to \"${compile_commands_link}\"...") -stdexec_execute_non_fatal_process(COMMAND - "${CMAKE_COMMAND}" -E rm -f "${compile_commands_link}") -stdexec_execute_non_fatal_process(COMMAND - "${CMAKE_COMMAND}" -E touch "${compile_commands_file}") -stdexec_execute_non_fatal_process(COMMAND - "${CMAKE_COMMAND}" -E create_symlink "${compile_commands_file}" "${compile_commands_link}") +message( + STATUS + "Creating symlink from \"${compile_commands_file}\" to \"${compile_commands_link}\"..." +) +stdexec_execute_non_fatal_process(COMMAND "${CMAKE_COMMAND}" -E rm -f + "${compile_commands_link}") +stdexec_execute_non_fatal_process(COMMAND "${CMAKE_COMMAND}" -E touch + "${compile_commands_file}") +stdexec_execute_non_fatal_process( + COMMAND "${CMAKE_COMMAND}" -E create_symlink "${compile_commands_file}" + "${compile_commands_link}") diff --git a/cmake/cmake_utilities.cmake b/cmake/cmake_utilities.cmake index 0e254d7d2..c6a81d3d7 100644 --- a/cmake/cmake_utilities.cmake +++ b/cmake/cmake_utilities.cmake @@ -1,45 +1,50 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. SPDX-License-Identifier: Apache-2.0 # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. # Passes all args directly to execute_process while setting up the following # results variables and propagating them to the caller's scope: # -# - stdexec_process_exit_code -# - stdexec_process_stdout -# - stdexec_process_stderr +# * stdexec_process_exit_code +# * stdexec_process_stdout +# * stdexec_process_stderr # -# If the command -# is not successful (e.g. the last command does not return zero), a non-fatal -# warning is printed. +# If the command is not successful (e.g. the last command does not return zero), +# a non-fatal warning is printed. function(stdexec_execute_non_fatal_process) - execute_process(${ARGN} + execute_process( + ${ARGN} RESULT_VARIABLE stdexec_process_exit_code OUTPUT_VARIABLE stdexec_process_stdout - ERROR_VARIABLE stdexec_process_stderr - ) + ERROR_VARIABLE stdexec_process_stderr) - if (NOT stdexec_process_exit_code EQUAL 0) - message(WARNING - "execute_process failed with non-zero exit code: ${stdexec_process_exit_code}\n" - "${ARGN}\n" - "stdout:\n${stdexec_process_stdout}\n" - "stderr:\n${stdexec_process_stderr}\n" - ) + if(NOT stdexec_process_exit_code EQUAL 0) + message( + WARNING + "execute_process failed with non-zero exit code: ${stdexec_process_exit_code}\n" + "${ARGN}\n" + "stdout:\n${stdexec_process_stdout}\n" + "stderr:\n${stdexec_process_stderr}\n") endif() - set(stdexec_process_exit_code "${stdexec_process_exit_code}" PARENT_SCOPE) - set(stdexec_process_stdout "${stdexec_process_stdout}" PARENT_SCOPE) - set(stdexec_process_stderr "${stdexec_process_stderr}" PARENT_SCOPE) + set(stdexec_process_exit_code + "${stdexec_process_exit_code}" + PARENT_SCOPE) + set(stdexec_process_stdout + "${stdexec_process_stdout}" + PARENT_SCOPE) + set(stdexec_process_stderr + "${stdexec_process_stderr}" + PARENT_SCOPE) endfunction() diff --git a/cmake/import_standalone_asio.cmake b/cmake/import_standalone_asio.cmake index 12962c990..8fe7cc880 100644 --- a/cmake/import_standalone_asio.cmake +++ b/cmake/import_standalone_asio.cmake @@ -1,73 +1,82 @@ -# - This function imports the standalone version of ASIO +# * This function imports the standalone version of ASIO # -# Importing standalone asio can't be done via rapids-cpm, because the library has no cmake -# build setup. But still it can be imported with CPM. +# Importing standalone asio can't be done via rapids-cpm, because the library +# has no cmake build setup. But still it can be imported with CPM. # # This function is based on the CPM example: # https://github.com/cpm-cmake/CPM.cmake/blob/master/examples/asio-standalone/CMakeLists.txt # -# import_standalone_asio([TAG github-tag] VERSION [version-stirng]) +# import_standalone_asio([TAG github-tag] VERSION [version-stirng]) # function(import_standalone_asio) - if(TARGET asio) - message(STATUS "stdexec: reusing existing asio target") - return() - endif() - set(options "") - set(args TAG VERSION) - set(multi_args "") - cmake_parse_arguments(IMPORT_STANDALONE_ASIO "${options}" "${args}" "${multi_args}" ${ARGN}) - - CPMFindPackage( - NAME asio - VERSION ${IMPORT_STANDALONE_ASIO_VERSION} - GIT_TAG ${IMPORT_STANDALONE_ASIO_TAG} - GITHUB_REPOSITORY chriskohlhoff/asio) + if(TARGET asio) + message(STATUS "stdexec: reusing existing asio target") + return() + endif() + set(options "") + set(args TAG VERSION) + set(multi_args "") + cmake_parse_arguments(IMPORT_STANDALONE_ASIO "${options}" "${args}" + "${multi_args}" ${ARGN}) - # ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on - # Windows: - # - # 1) If _WIN32_WINNT is not set, ASIO assumes _WIN32_WINNT=0x0501, i.e. Windows XP - # target, which is definitely not the platform which most users target. - # - # 2) WIN32_LEAN_AND_MEAN is defined to make Winsock2 work. - if(asio_ADDED) - add_library(asio INTERFACE) + cpmfindpackage( + NAME + asio + VERSION + ${IMPORT_STANDALONE_ASIO_VERSION} + GIT_TAG + ${IMPORT_STANDALONE_ASIO_TAG} + GITHUB_REPOSITORY + chriskohlhoff/asio) - target_include_directories(asio SYSTEM INTERFACE - $ - $) - target_compile_definitions(asio INTERFACE ASIO_STANDALONE ASIO_NO_DEPRECATED) - target_link_libraries(asio INTERFACE Threads::Threads) + # ASIO doesn't use CMake, we have to configure it manually. Extra notes for + # using on Windows: + # + # 1) If _WIN32_WINNT is not set, ASIO assumes _WIN32_WINNT=0x0501, i.e. + # Windows XP target, which is definitely not the platform which most users + # target. + # + # 2) WIN32_LEAN_AND_MEAN is defined to make Winsock2 work. + if(asio_ADDED) + add_library(asio INTERFACE) - if(WIN32) - # macro see @ https://stackoverflow.com/a/40217291/1746503 - macro(get_win32_winnt version) - if(CMAKE_SYSTEM_VERSION) - set(ver ${CMAKE_SYSTEM_VERSION}) - string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver}) - string(REGEX MATCH "^([0-9]+)" verMajor ${ver}) - # Check for Windows 10, b/c we'll need to convert to hex 'A'. - if("${verMajor}" MATCHES "10") - set(verMajor "A") - string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver}) - endif("${verMajor}" MATCHES "10") - # Remove all remaining '.' characters. - string(REPLACE "." "" ver ${ver}) - # Prepend each digit with a zero. - string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver}) - set(${version} "0x${ver}") - endif() - endmacro() + target_include_directories( + asio SYSTEM + INTERFACE $ + $) + target_compile_definitions(asio INTERFACE ASIO_STANDALONE + ASIO_NO_DEPRECATED) + target_link_libraries(asio INTERFACE Threads::Threads) - if(NOT DEFINED _WIN32_WINNT) - get_win32_winnt(ver) - set(_WIN32_WINNT ${ver}) + if(WIN32) + # macro see @ https://stackoverflow.com/a/40217291/1746503 + macro(get_win32_winnt version) + if(CMAKE_SYSTEM_VERSION) + set(ver ${CMAKE_SYSTEM_VERSION}) + string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver}) + string(REGEX MATCH "^([0-9]+)" verMajor ${ver}) + # Check for Windows 10, b/c we'll need to convert to hex 'A'. + if("${verMajor}" MATCHES "10") + set(verMajor "A") + string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver}) + endif("${verMajor}" MATCHES "10") + # Remove all remaining '.' characters. + string(REPLACE "." "" ver ${ver}) + # Prepend each digit with a zero. + string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver}) + set(${version} "0x${ver}") endif() + endmacro() - message(STATUS "Set _WIN32_WINNET=${_WIN32_WINNT}") - - target_compile_definitions(asio INTERFACE _WIN32_WINNT=${_WIN32_WINNT} WIN32_LEAN_AND_MEAN) + if(NOT DEFINED _WIN32_WINNT) + get_win32_winnt(ver) + set(_WIN32_WINNT ${ver}) endif() + + message(STATUS "Set _WIN32_WINNET=${_WIN32_WINNT}") + + target_compile_definitions(asio INTERFACE _WIN32_WINNT=${_WIN32_WINNT} + WIN32_LEAN_AND_MEAN) endif() + endif() endfunction() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 5645aac99..f927c6d74 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,18 +1,18 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= find_package(Doxygen REQUIRED) find_package(Sphinx REQUIRED) @@ -21,18 +21,17 @@ find_package(Sphinx REQUIRED) set(STDEXEC_PUBLIC_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) file(GLOB_RECURSE STDEXEC_PUBLIC_HEADERS ${STDEXEC_PUBLIC_HEADER_DIR}/*.hpp) -# Doxygen's INPUT tag accepts whitespace-separated, individually-quoted -# paths. CMake serializes lists with ';', which Doxygen would treat as -# part of a single path, so we explicitly quote each entry and join -# with a space here. (The corresponding line in Doxyfile.in must NOT -# wrap @DOXYGEN_INPUT_DIR@ in another layer of quotes.) -string(JOIN " " DOXYGEN_INPUT_DIR - "\"${PROJECT_SOURCE_DIR}/include\"" +# Doxygen's INPUT tag accepts whitespace-separated, individually-quoted paths. +# CMake serializes lists with ';', which Doxygen would treat as part of a single +# path, so we explicitly quote each entry and join with a space here. (The +# corresponding line in Doxyfile.in must NOT wrap @DOXYGEN_INPUT_DIR@ in another +# layer of quotes.) +string(JOIN " " DOXYGEN_INPUT_DIR "\"${PROJECT_SOURCE_DIR}/include\"" "\"${CMAKE_CURRENT_BINARY_DIR}\"") -string(JOIN " " DOXYGEN_EXCLUDE_DIR - "\"${PROJECT_SOURCE_DIR}/include/execpools\"" - "\"${PROJECT_SOURCE_DIR}/include/tbbexec\"" - "\"${PROJECT_SOURCE_DIR}/include/asioexec\"") +string( + JOIN " " DOXYGEN_EXCLUDE_DIR "\"${PROJECT_SOURCE_DIR}/include/execpools\"" + "\"${PROJECT_SOURCE_DIR}/include/tbbexec\"" + "\"${PROJECT_SOURCE_DIR}/include/asioexec\"") set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/build/doxygen) set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml) set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) @@ -40,14 +39,17 @@ set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) # Doxygen INPUT_FILTER that hyperlinks [exec.*] working-draft stable names in # the comments to the corresponding sections on https://eel.is/c++draft. -set(DOXYGEN_INPUT_FILTER "perl ${CMAKE_CURRENT_SOURCE_DIR}/eelis_link_filter.pl") +set(DOXYGEN_INPUT_FILTER + "perl ${CMAKE_CURRENT_SOURCE_DIR}/eelis_link_filter.pl") # Find the location of stddef.h -execute_process(COMMAND echo "#include " - COMMAND c++ -xc -dI -E - - COMMAND grep -oP "/usr/.*(?=/stddef\.h)" - COMMAND tail -n 1 - OUTPUT_VARIABLE STDDEF_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND echo "#include " + COMMAND c++ -xc -dI -E - + COMMAND grep -oP "/usr/.*(?=/stddef\.h)" + COMMAND tail -n 1 + OUTPUT_VARIABLE STDDEF_INCLUDE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS " include path: ${STDDEF_INCLUDE_PATH}") # Replace variables inside @@ with the current values @@ -57,12 +59,14 @@ configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) # Only regenerate Doxygen when the Doxyfile or public headers change -add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE} - DEPENDS ${STDEXEC_PUBLIC_HEADERS} - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} - MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN} - COMMENT "Generating docs" - VERBATIM) +add_custom_command( + OUTPUT ${DOXYGEN_INDEX_FILE} + DEPENDS ${STDEXEC_PUBLIC_HEADERS} + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} + MAIN_DEPENDENCY ${DOXYFILE_OUT} + ${DOXYFILE_IN} + COMMENT "Generating docs" + VERBATIM) # Nice named target so we can run the job easily add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE}) @@ -71,32 +75,27 @@ set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/source) set(SPHINX_BUILD ${PROJECT_BINARY_DIR}/docs) set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html) -file(GLOB_RECURSE - STDEXEC_DOCUMENTATION_SOURCE_FILES - CONFIGURE_DEPENDS +file(GLOB_RECURSE STDEXEC_DOCUMENTATION_SOURCE_FILES CONFIGURE_DEPENDS ${SPHINX_SOURCE}/*.rst ${SPHINX_SOURCE}/*.md) -# Only regenerate Sphinx when: -# - Doxygen has rerun -# - Our doc files have been updated -# - The Sphinx config has been updated -add_custom_command(OUTPUT ${SPHINX_INDEX_FILE} - COMMAND - ${SPHINX_EXECUTABLE} -b html - # Tell Breathe where to find the Doxygen output - -Dbreathe_projects.stdexec=${DOXYGEN_OUTPUT_DIR}/xml - ${SPHINX_SOURCE} ${SPHINX_BUILD} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS - # Other docs files you want to track should go here (or in some variable) - ${STDEXEC_DOCUMENTATION_SOURCE_FILES} - ${DOXYGEN_INDEX_FILE} - MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py - COMMENT "Generating documentation with Sphinx") +# Only regenerate Sphinx when: - Doxygen has rerun - Our doc files have been +# updated - The Sphinx config has been updated +add_custom_command( + OUTPUT ${SPHINX_INDEX_FILE} + COMMAND + ${SPHINX_EXECUTABLE} -b html + # Tell Breathe where to find the Doxygen output + -Dbreathe_projects.stdexec=${DOXYGEN_OUTPUT_DIR}/xml ${SPHINX_SOURCE} + ${SPHINX_BUILD} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS # Other docs files you want to track should go here (or in some + # variable) + ${STDEXEC_DOCUMENTATION_SOURCE_FILES} ${DOXYGEN_INDEX_FILE} + MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py + COMMENT "Generating documentation with Sphinx") # Nice named target so we can run the job easily -add_custom_target(docs ALL - DEPENDS ${SPHINX_INDEX_FILE}) +add_custom_target(docs ALL DEPENDS ${SPHINX_INDEX_FILE}) # Add an install target to install the docs -install(DIRECTORY ${SPHINX_BUILD} DESTINATION ${CMAKE_INSTALL_DOCDIR}) \ No newline at end of file +install(DIRECTORY ${SPHINX_BUILD} DESTINATION ${CMAKE_INSTALL_DOCDIR}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4d98a899e..9caf973ef 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,122 +1,132 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= add_library(stdexec_example_settings INTERFACE) -target_compile_definitions(stdexec_example_settings INTERFACE - $<$,$,26.3.0>>:STDEXEC_NAMESPACE=stdexec>) +target_compile_definitions( + stdexec_example_settings + INTERFACE + $<$,$,26.3.0>>:STDEXEC_NAMESPACE=stdexec> +) function(split pair name_out path_out) - string(STRIP "${pair}" pair) - string(REPLACE ":" ";" pair "${pair}") - list(POP_FRONT pair _name) - list(POP_FRONT pair _path) - string(STRIP "${_name}" _name) - string(STRIP "${_path}" _path) - set(${name_out} "${_name}" PARENT_SCOPE) - set(${path_out} "${_path}" PARENT_SCOPE) + string(STRIP "${pair}" pair) + string(REPLACE ":" ";" pair "${pair}") + list(POP_FRONT pair _name) + list(POP_FRONT pair _path) + string(STRIP "${_name}" _name) + string(STRIP "${_path}" _path) + set(${name_out} + "${_name}" + PARENT_SCOPE) + set(${path_out} + "${_path}" + PARENT_SCOPE) endfunction() function(def_example example) - split(${example} target source) - add_executable(${target} ${source}) - target_compile_options(${target} PUBLIC - $<$:-Wno-maybe-uninitialized> # warnings being emitted from stdlib headers, why? - $<$:-Wno-gnu-line-marker> - ) - target_link_libraries(${target} - PRIVATE STDEXEC::stdexec - stdexec_executable_flags - stdexec_example_settings - $) + split(${example} target source) + add_executable(${target} ${source}) + target_compile_options( + ${target} + PUBLIC + $<$:-Wno-maybe-uninitialized> # warnings being + # emitted from stdlib + # headers, why? + $<$:-Wno-gnu-line-marker>) + target_link_libraries( + ${target} + PRIVATE STDEXEC::stdexec stdexec_executable_flags stdexec_example_settings + $) endfunction() set(stdexec_examples - "example.problem : problem.cpp" - "example.hello_world : hello_world.cpp" - "example.hello_coro : hello_coro.cpp" - "example.scope : scope.cpp" - "example.sudoku : sudoku.cpp" - "example.retry : retry.cpp" - "example.then : then.cpp" - "example.server_theme.let_value : server_theme/let_value.cpp" - "example.server_theme.on_transfer : server_theme/on_transfer.cpp" - "example.server_theme.then_upon : server_theme/then_upon.cpp" - "example.server_theme.split_bulk : server_theme/split_bulk.cpp" - "example.benchmark.static_thread_pool : benchmark/static_thread_pool.cpp" -) + "example.problem : problem.cpp" + "example.hello_world : hello_world.cpp" + "example.hello_coro : hello_coro.cpp" + "example.scope : scope.cpp" + "example.sudoku : sudoku.cpp" + "example.retry : retry.cpp" + "example.then : then.cpp" + "example.server_theme.let_value : server_theme/let_value.cpp" + "example.server_theme.on_transfer : server_theme/on_transfer.cpp" + "example.server_theme.then_upon : server_theme/then_upon.cpp" + "example.server_theme.split_bulk : server_theme/split_bulk.cpp" + "example.benchmark.static_thread_pool : benchmark/static_thread_pool.cpp") -if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - # The following examples generate files with names that are too long for Windows. - set(stdexec_examples ${stdexec_examples} - "example.benchmark.static_thread_pool_nested : benchmark/static_thread_pool_nested.cpp" - "example.benchmark.static_thread_pool_bulk_enqueue : benchmark/static_thread_pool_bulk_enqueue.cpp" - "example.benchmark.static_thread_pool_bulk_enqueue_nested : benchmark/static_thread_pool_bulk_enqueue_nested.cpp" +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + # The following examples generate files with names that are too long for + # Windows. + set(stdexec_examples + ${stdexec_examples} + "example.benchmark.static_thread_pool_nested : benchmark/static_thread_pool_nested.cpp" + "example.benchmark.static_thread_pool_bulk_enqueue : benchmark/static_thread_pool_bulk_enqueue.cpp" + "example.benchmark.static_thread_pool_bulk_enqueue_nested : benchmark/static_thread_pool_bulk_enqueue_nested.cpp" ) -endif () +endif() -if (LINUX) - set(stdexec_examples ${stdexec_examples} - "example.io_uring : io_uring.cpp" - ) -endif () +if(LINUX) + set(stdexec_examples ${stdexec_examples} "example.io_uring : io_uring.cpp") +endif() foreach(example ${stdexec_examples}) def_example(${example}) endforeach() -if (STDEXEC_BUILD_PARALLEL_SCHEDULER) +if(STDEXEC_BUILD_PARALLEL_SCHEDULER) target_link_libraries(example.sudoku PRIVATE STDEXEC::parallel_scheduler) else() - target_compile_definitions(example.sudoku PRIVATE STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY) + target_compile_definitions(example.sudoku + PRIVATE STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY) endif() if(STDEXEC_ENABLE_CUDA) add_subdirectory(nvexec) endif() -if (STDEXEC_ENABLE_TBB) - add_executable(example.benchmark.tbb_thread_pool benchmark/tbb_thread_pool.cpp) +if(STDEXEC_ENABLE_TBB) + add_executable(example.benchmark.tbb_thread_pool + benchmark/tbb_thread_pool.cpp) target_link_libraries(example.benchmark.tbb_thread_pool - PRIVATE stdexec_example_settings - STDEXEC::tbbexec) + PRIVATE stdexec_example_settings STDEXEC::tbbexec) - add_executable(example.benchmark.tbb_thread_pool_nested benchmark/tbb_thread_pool_nested.cpp) + add_executable(example.benchmark.tbb_thread_pool_nested + benchmark/tbb_thread_pool_nested.cpp) target_link_libraries(example.benchmark.tbb_thread_pool_nested - PRIVATE stdexec_example_settings - STDEXEC::tbbexec) + PRIVATE stdexec_example_settings STDEXEC::tbbexec) add_executable(example.benchmark.fibonacci benchmark/fibonacci.cpp) target_link_libraries(example.benchmark.fibonacci - PRIVATE stdexec_example_settings - STDEXEC::tbbexec) + PRIVATE stdexec_example_settings STDEXEC::tbbexec) endif() if(STDEXEC_ENABLE_TASKFLOW) - add_executable(example.benchmark.taskflow_thread_pool benchmark/taskflow_thread_pool.cpp) - target_link_libraries(example.benchmark.taskflow_thread_pool - PRIVATE stdexec_example_settings - STDEXEC::taskflowexec - $) + add_executable(example.benchmark.taskflow_thread_pool + benchmark/taskflow_thread_pool.cpp) + target_link_libraries( + example.benchmark.taskflow_thread_pool + PRIVATE stdexec_example_settings STDEXEC::taskflowexec + $) endif() if(STDEXEC_ENABLE_ASIO) - add_executable(example.benchmark.asio_thread_pool benchmark/asio_thread_pool.cpp) - target_link_libraries(example.benchmark.asio_thread_pool - PRIVATE stdexec_example_settings - STDEXEC::asioexec - $) + add_executable(example.benchmark.asio_thread_pool + benchmark/asio_thread_pool.cpp) + target_link_libraries( + example.benchmark.asio_thread_pool + PRIVATE stdexec_example_settings STDEXEC::asioexec + $) endif() diff --git a/examples/nvexec/CMakeLists.txt b/examples/nvexec/CMakeLists.txt index d16a6502e..353c5be2a 100644 --- a/examples/nvexec/CMakeLists.txt +++ b/examples/nvexec/CMakeLists.txt @@ -1,110 +1,101 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= function(split pair name_out path_out) - string(STRIP "${pair}" pair) - string(REPLACE ":" ";" pair "${pair}") - list(POP_FRONT pair _name) - list(POP_FRONT pair _path) - string(STRIP "${_name}" _name) - string(STRIP "${_path}" _path) - set(${name_out} "${_name}" PARENT_SCOPE) - set(${path_out} "${_path}" PARENT_SCOPE) + string(STRIP "${pair}" pair) + string(REPLACE ":" ";" pair "${pair}") + list(POP_FRONT pair _name) + list(POP_FRONT pair _path) + string(STRIP "${_name}" _name) + string(STRIP "${_path}" _path) + set(${name_out} + "${_name}" + PARENT_SCOPE) + set(${path_out} + "${_path}" + PARENT_SCOPE) endfunction() set(_lang_cxx CXX) set(_lang_gpu CXX) if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) - set(_lang_gpu CUDA) + set(_lang_gpu CUDA) endif() -############################################################################### +# ############################################################################## # Define targets for common properties -############################################################################### +# ############################################################################## add_library(nvexec_example INTERFACE) -target_include_directories(nvexec_example - INTERFACE ${CMAKE_CURRENT_LIST_DIR} -) -target_link_libraries(nvexec_example - INTERFACE nvexec_executable_flags - stdexec_example_settings -) +target_include_directories(nvexec_example INTERFACE ${CMAKE_CURRENT_LIST_DIR}) +target_link_libraries(nvexec_example INTERFACE nvexec_executable_flags + stdexec_example_settings) add_library(stdpar_multicore INTERFACE) -target_include_directories(stdpar_multicore - SYSTEM - INTERFACE $<$:${CUDAToolkit_INCLUDE_DIRS}> -) -target_link_libraries(stdpar_multicore - INTERFACE stdexec_example_settings -) -target_compile_options(stdpar_multicore - INTERFACE $<$:-stdpar=multicore> - $<$: - # libc++ doesn't include stdpar yet - -stdlib=libstdc++ - # Silence Thrust -Wdeprecated-builtins warnings - -Wno-deprecated-builtins> -) - -target_link_options(stdpar_multicore - INTERFACE $<$:-stdpar=multicore> -) +target_include_directories( + stdpar_multicore SYSTEM + INTERFACE $<$:${CUDAToolkit_INCLUDE_DIRS}>) +target_link_libraries(stdpar_multicore INTERFACE stdexec_example_settings) +target_compile_options( + stdpar_multicore + INTERFACE $<$:-stdpar=multicore> + $<$: + # libc++ doesn't include stdpar yet + -stdlib=libstdc++ + # Silence Thrust -Wdeprecated-builtins warnings + -Wno-deprecated-builtins>) + +target_link_options(stdpar_multicore INTERFACE + $<$:-stdpar=multicore>) function(set_executable_output_name target) - string(LENGTH "${target}" str_len) - string(FIND "${target}" "." last_dot REVERSE) - math(EXPR last_dot "${last_dot} + 1") - math(EXPR str_len "${str_len} - ${last_dot}") - string(SUBSTRING "${target}" ${last_dot} ${str_len} exe_name) - set_target_properties(${target} PROPERTIES OUTPUT_NAME ${exe_name}) + string(LENGTH "${target}" str_len) + string(FIND "${target}" "." last_dot REVERSE) + math(EXPR last_dot "${last_dot} + 1") + math(EXPR str_len "${str_len} - ${last_dot}") + string(SUBSTRING "${target}" ${last_dot} ${str_len} exe_name) + set_target_properties(${target} PROPERTIES OUTPUT_NAME ${exe_name}) endfunction() -############################################################################### +# ############################################################################## # CPU examples -############################################################################### -set(nvexec_cpu_examples - "example.nvexec.maxwell_cpu_mt : maxwell_cpu_mt.cu" - "example.nvexec.maxwell_cpu_st : maxwell_cpu_st.cu" -) +# ############################################################################## +set(nvexec_cpu_examples "example.nvexec.maxwell_cpu_mt : maxwell_cpu_mt.cu" + "example.nvexec.maxwell_cpu_st : maxwell_cpu_st.cu") function(def_cpu_example example) - split(${example} target source) - add_executable(${target} ${source}) - set_executable_output_name(${target}) - target_link_libraries(${target} - PRIVATE stdpar_multicore - STDEXEC::stdexec - stdexec_executable_flags - ) - set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_cxx}) - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_link_options(${target} PRIVATE -lc++abi) - endif() + split(${example} target source) + add_executable(${target} ${source}) + set_executable_output_name(${target}) + target_link_libraries(${target} PRIVATE stdpar_multicore STDEXEC::stdexec + stdexec_executable_flags) + set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_cxx}) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_link_options(${target} PRIVATE -lc++abi) + endif() endfunction() foreach(example ${nvexec_cpu_examples}) - def_cpu_example(${example}) + def_cpu_example(${example}) endforeach() -############################################################################### +# ############################################################################## # GPU examples -############################################################################### +# ############################################################################## set(nvexec_gpu_examples " example.nvexec.bulk : bulk.cu" " example.nvexec.reduce : reduce.cu" @@ -112,46 +103,41 @@ set(nvexec_gpu_examples " example.nvexec.nvtx : nvtx.cu" " example.nvexec.launch : launch.cu" "example.nvexec.maxwell_gpu_s : maxwell_gpu_s.cu" - "example.nvexec.maxwell_gpu_m : maxwell_gpu_m.cu" -) + "example.nvexec.maxwell_gpu_m : maxwell_gpu_m.cu") function(def_gpu_example example) - split(${example} target source) - add_executable(${target} ${source}) - set_executable_output_name(${target}) - target_link_libraries(${target} - PRIVATE nvexec_example - STDEXEC::nvexec - stdexec_executable_flags - ) - set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_gpu}) + split(${example} target source) + add_executable(${target} ${source}) + set_executable_output_name(${target}) + target_link_libraries(${target} PRIVATE nvexec_example STDEXEC::nvexec + stdexec_executable_flags) + set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_gpu}) endfunction() foreach(example ${nvexec_gpu_examples}) - def_gpu_example(${example}) + def_gpu_example(${example}) endforeach() -############################################################################### +# ############################################################################## # MPI examples -############################################################################### +# ############################################################################## set(compiler_name "") get_filename_component(compiler_name "${CMAKE_CXX_COMPILER}" NAME) -if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") AND (compiler_name STREQUAL "mpic++")) - - function(def_mpi_example target source) - add_executable(${target} ${source}) - set_executable_output_name(${target}) - target_link_libraries(${target} - PRIVATE nvexec_example - STDEXEC::nvexec - stdexec_executable_flags - ) - target_compile_definitions(${target} PRIVATE ${ARGN}) - set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_gpu}) - endfunction() - - def_mpi_example(example.nvexec.maxwell_distributed maxwell_distributed.cu) - def_mpi_example(example.nvexec.maxwell_distributed_ov maxwell_distributed.cu OVERLAP) +if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") AND (compiler_name STREQUAL "mpic++" + )) + + function(def_mpi_example target source) + add_executable(${target} ${source}) + set_executable_output_name(${target}) + target_link_libraries(${target} PRIVATE nvexec_example STDEXEC::nvexec + stdexec_executable_flags) + target_compile_definitions(${target} PRIVATE ${ARGN}) + set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_gpu}) + endfunction() + + def_mpi_example(example.nvexec.maxwell_distributed maxwell_distributed.cu) + def_mpi_example(example.nvexec.maxwell_distributed_ov maxwell_distributed.cu + OVERLAP) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e14a0469d..c1a572379 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,25 +1,28 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= include(CheckCompilerFlag) check_compiler_flag(CXX -Wno-c2y-extensions HAVE_C2Y_EXTENSIONS_WARNING) function(add_compile_diagnostics TARGET) - if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU) - target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wpedantic -Werror $<$:-Wno-c2y-extensions>) - endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU) + target_compile_options( + ${TARGET} + PRIVATE -Wall -Wextra -Wpedantic -Werror + $<$:-Wno-c2y-extensions>) + endif() endfunction() set(stdexec_test_sources @@ -84,66 +87,60 @@ set(stdexec_test_sources stdexec/queries/test_get_completion_behavior.cpp stdexec/queries/test_forwarding_queries.cpp stdexec/types/test_task.cpp - stdexec/types/test_counting_scopes.cpp - ) + stdexec/types/test_counting_scopes.cpp) add_library(common_test_settings INTERFACE) -set_target_properties(common_test_settings PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF - MSVC_DEBUG_INFORMATION_FORMAT Embedded - ) -target_include_directories(common_test_settings INTERFACE "${CMAKE_CURRENT_LIST_DIR}") -target_compile_definitions(common_test_settings INTERFACE - STDEXEC_NAMESPACE=std::execution - $<$:NOMINMAX> - ) -target_compile_options(common_test_settings INTERFACE - $<$:/wd4714> # function marked as __forceinline not inlined - $<$:-Wno-maybe-uninitialized> # warnings being emitted from stdlib headers, why? - $<$:-Wno-gnu-line-marker> - ) -target_link_libraries(common_test_settings INTERFACE $) -# target_compile_definitions( -# common_test_settings INTERFACE -# $<$,$>>:STDEXEC_ENABLE_EXTRA_TYPE_CHECKING>) +set_target_properties( + common_test_settings + PROPERTIES CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + MSVC_DEBUG_INFORMATION_FORMAT Embedded) +target_include_directories(common_test_settings + INTERFACE "${CMAKE_CURRENT_LIST_DIR}") +target_compile_definitions( + common_test_settings INTERFACE STDEXEC_NAMESPACE=std::execution + $<$:NOMINMAX>) +target_compile_options( + common_test_settings + INTERFACE + $<$:/wd4714> # function marked as __forceinline not + # inlined + $<$:-Wno-maybe-uninitialized> # warnings being emitted + # from stdlib headers, + # why? + $<$:-Wno-gnu-line-marker>) +target_link_libraries(common_test_settings + INTERFACE $) +# target_compile_definitions( common_test_settings INTERFACE +# $<$,$>>:STDEXEC_ENABLE_EXTRA_TYPE_CHECKING>) add_executable(test.stdexec ${stdexec_test_sources}) add_compile_diagnostics(test.stdexec) -target_link_libraries(test.stdexec - PUBLIC - STDEXEC::stdexec - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.stdexec + PUBLIC STDEXEC::stdexec stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) if(STDEXEC_BUILD_PARALLEL_SCHEDULER) - add_executable(test.parallel_scheduler_replacement - test_main.cpp - stdexec/schedulers/test_parallel_scheduler_replacement.cpp) + add_executable( + test.parallel_scheduler_replacement + test_main.cpp stdexec/schedulers/test_parallel_scheduler_replacement.cpp) add_compile_diagnostics(test.parallel_scheduler_replacement) - target_link_libraries(test.parallel_scheduler_replacement - PUBLIC - STDEXEC::stdexec - STDEXEC::parallel_scheduler - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) + target_link_libraries( + test.parallel_scheduler_replacement + PUBLIC STDEXEC::stdexec STDEXEC::parallel_scheduler stdexec_executable_flags + Catch2::Catch2WithMain + PRIVATE common_test_settings) endif() add_executable(test.scratch test_main.cpp test_scratch.cpp) add_compile_diagnostics(test.scratch) -target_link_libraries(test.scratch - PUBLIC - STDEXEC::stdexec - $ - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.scratch + PUBLIC STDEXEC::stdexec $ + stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) # Discover the Catch2 test built by the application include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) @@ -156,41 +153,48 @@ catch_discover_tests(test.stdexec PROPERTIES TIMEOUT 30) catch_discover_tests(test.scratch PROPERTIES TIMEOUT 30) if(STDEXEC_BUILD_PARALLEL_SCHEDULER AND NOT STDEXEC_ENABLE_CUDA) - catch_discover_tests(test.parallel_scheduler_replacement PROPERTIES TIMEOUT 30) + catch_discover_tests(test.parallel_scheduler_replacement PROPERTIES TIMEOUT + 30) endif() add_subdirectory(exec) if(STDEXEC_ENABLE_CUDA) - add_subdirectory(nvexec) + add_subdirectory(nvexec) endif() # build failure tests: tests which parse a source file for an expected error # message icm_add_build_failure_test( - NAME test_let_fail1 - TARGET test_let_fail1 - SOURCES PARSE stdexec/algos/adaptors/test_let_fail1.cpp - LIBRARIES stdexec - FOLDER test -) + NAME + test_let_fail1 + TARGET + test_let_fail1 + SOURCES + PARSE + stdexec/algos/adaptors/test_let_fail1.cpp + LIBRARIES + stdexec + FOLDER + test) icm_add_build_failure_test( - NAME test_then_fail1 - TARGET test_then_fail1 - SOURCES PARSE stdexec/algos/adaptors/test_then_fail1.cpp - LIBRARIES stdexec - FOLDER test -) + NAME + test_then_fail1 + TARGET + test_then_fail1 + SOURCES + PARSE + stdexec/algos/adaptors/test_then_fail1.cpp + LIBRARIES + stdexec + FOLDER + test) if(STDEXEC_BUILD_RELACY_TESTS) - add_subdirectory(rrd) + add_subdirectory(rrd) endif() -# # Adding multiple tests with a glob -# icm_glob_build_failure_tests( -# PATTERN *_fail*.cpp -# LIBRARIES stdexec -# PREFIX stdexec -# FOLDER test/stdexec/algos/adaptors -# ) +# # Adding multiple tests with a glob icm_glob_build_failure_tests( PATTERN +# *_fail*.cpp LIBRARIES stdexec PREFIX stdexec FOLDER +# test/stdexec/algos/adaptors ) diff --git a/test/exec/CMakeLists.txt b/test/exec/CMakeLists.txt index e3240f30e..40b2fc2d1 100644 --- a/test/exec/CMakeLists.txt +++ b/test/exec/CMakeLists.txt @@ -1,18 +1,18 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= set(exec_test_sources ../test_main.cpp @@ -64,51 +64,57 @@ set(exec_test_sources test_unless_stop_requested.cpp test_function.cpp test_frame_allocator.cpp - test_memory_resource_adaptor.cpp - ) + test_memory_resource_adaptor.cpp) -set_source_files_properties(test_any_sender.cpp - PROPERTIES - COMPILE_FLAGS $<$:/bigobj>) +set_source_files_properties( + test_any_sender.cpp PROPERTIES COMPILE_FLAGS + $<$:/bigobj>) add_executable(test.exec ${exec_test_sources}) add_compile_diagnostics(test.exec) -target_link_libraries(test.exec - PUBLIC - STDEXEC::stdexec - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.exec + PUBLIC STDEXEC::stdexec stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) # Discover the Catch2 test built by the application catch_discover_tests(test.exec PROPERTIES TIMEOUT 30) if(STDEXEC_ENABLE_ASIO) - add_subdirectory(asio) + add_subdirectory(asio) endif() if(STDEXEC_ENABLE_TASKFLOW) - add_subdirectory(taskflow) + add_subdirectory(taskflow) endif() if(STDEXEC_ENABLE_TBB) - add_subdirectory(tbb) + add_subdirectory(tbb) endif() # Test which parses a source file for an expected error message icm_add_build_failure_test( - NAME test_repeat_until_fail - TARGET test_repeat_until_fail - SOURCES PARSE test_repeat_until_fail.cpp - LIBRARIES stdexec - FOLDER test -) + NAME + test_repeat_until_fail + TARGET + test_repeat_until_fail + SOURCES + PARSE + test_repeat_until_fail.cpp + LIBRARIES + stdexec + FOLDER + test) icm_add_build_failure_test( - NAME test_repeat_n_fail - TARGET test_repeat_n_fail - SOURCES PARSE test_repeat_n_fail.cpp - LIBRARIES stdexec - FOLDER test -) + NAME + test_repeat_n_fail + TARGET + test_repeat_n_fail + SOURCES + PARSE + test_repeat_n_fail.cpp + LIBRARIES + stdexec + FOLDER + test) diff --git a/test/exec/asio/CMakeLists.txt b/test/exec/asio/CMakeLists.txt index 75fe7c360..8621e928d 100644 --- a/test/exec/asio/CMakeLists.txt +++ b/test/exec/asio/CMakeLists.txt @@ -1,34 +1,27 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# Copyright (c) 2025 Robert Leahy. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. Copyright (c) 2025 Robert Leahy. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # -# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License"); -# you may not use this file except in compliance with the License. +# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the +# "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. -set(asioexec_test_sources - ../../test_main.cpp - test_asio_thread_pool.cpp - test_completion_token.cpp - test_use_sender.cpp - ) +set(asioexec_test_sources ../../test_main.cpp test_asio_thread_pool.cpp + test_completion_token.cpp test_use_sender.cpp) add_executable(test.asioexec ${asioexec_test_sources}) -target_link_libraries(test.asioexec - PUBLIC - STDEXEC::stdexec - $ - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.asioexec + PUBLIC STDEXEC::stdexec $ + stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) catch_discover_tests(test.asioexec PROPERTIES TIMEOUT 30) diff --git a/test/exec/taskflow/CMakeLists.txt b/test/exec/taskflow/CMakeLists.txt index fb0ad61ee..5d6826659 100644 --- a/test/exec/taskflow/CMakeLists.txt +++ b/test/exec/taskflow/CMakeLists.txt @@ -1,32 +1,26 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# Copyright (c) 2025 Robert Leahy. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. Copyright (c) 2025 Robert Leahy. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # -# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License"); -# you may not use this file except in compliance with the License. +# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the +# "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. -set(taskflowexec_test_sources - ../../test_main.cpp - test_taskflow_thread_pool.cpp - ) +set(taskflowexec_test_sources ../../test_main.cpp test_taskflow_thread_pool.cpp) add_executable(test.taskflowexec ${taskflowexec_test_sources}) -target_link_libraries(test.taskflowexec - PUBLIC - STDEXEC::stdexec - $ - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.taskflowexec + PUBLIC STDEXEC::stdexec $ + stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) catch_discover_tests(test.taskflowexec PROPERTIES TIMEOUT 30) diff --git a/test/exec/tbb/CMakeLists.txt b/test/exec/tbb/CMakeLists.txt index 6f8f62961..3854b9b7c 100644 --- a/test/exec/tbb/CMakeLists.txt +++ b/test/exec/tbb/CMakeLists.txt @@ -1,32 +1,26 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# Copyright (c) 2025 Robert Leahy. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. Copyright (c) 2025 Robert Leahy. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # -# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License"); -# you may not use this file except in compliance with the License. +# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the +# "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://llvm.org/LICENSE.txt # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. -set(tbbexec_test_sources - ../../test_main.cpp - test_tbb_thread_pool.cpp - ) +set(tbbexec_test_sources ../../test_main.cpp test_tbb_thread_pool.cpp) add_executable(test.tbbexec ${tbbexec_test_sources}) -target_link_libraries(test.tbbexec - PUBLIC - STDEXEC::stdexec - $ - stdexec_executable_flags - Catch2::Catch2WithMain - PRIVATE - common_test_settings) +target_link_libraries( + test.tbbexec + PUBLIC STDEXEC::stdexec $ + stdexec_executable_flags Catch2::Catch2WithMain + PRIVATE common_test_settings) catch_discover_tests(test.tbbexec PROPERTIES TIMEOUT 30) diff --git a/test/nvexec/CMakeLists.txt b/test/nvexec/CMakeLists.txt index 621d58112..83233fa27 100644 --- a/test/nvexec/CMakeLists.txt +++ b/test/nvexec/CMakeLists.txt @@ -1,18 +1,18 @@ -#============================================================================= +# ============================================================================= # Copyright 2023 NVIDIA Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= set(nvexec_test_sources continues_on.cpp @@ -39,34 +39,37 @@ set(nvexec_test_sources upon_error.cpp upon_stopped.cpp variant.cpp - when_all.cpp -) + when_all.cpp) if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) - set_source_files_properties(${nvexec_test_sources} PROPERTIES LANGUAGE CUDA) + set_source_files_properties(${nvexec_test_sources} PROPERTIES LANGUAGE CUDA) endif() add_executable(test.nvexec ${nvexec_test_sources}) -set_target_properties(test.nvexec PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF) +set_target_properties( + test.nvexec + PROPERTIES CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF) target_include_directories(test.nvexec PRIVATE ${CMAKE_CURRENT_LIST_DIR}/..) -target_link_libraries(test.nvexec - STDEXEC::nvexec - stdexec_executable_flags - Catch2::Catch2WithMain - nvexec_executable_flags) +target_link_libraries(test.nvexec STDEXEC::nvexec stdexec_executable_flags + Catch2::Catch2WithMain nvexec_executable_flags) catch_discover_tests(test.nvexec PROPERTIES TIMEOUT 30) icm_add_build_failure_test( - NAME when_all_fail - TARGET when_all_fail - SOURCES PARSE when_all_fail.cpp - LIBRARIES stdexec nvexec - FOLDER test -) + NAME + when_all_fail + TARGET + when_all_fail + SOURCES + PARSE + when_all_fail.cpp + LIBRARIES + stdexec + nvexec + FOLDER + test) if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) - set_source_files_properties(when_all_fail.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(when_all_fail.cpp PROPERTIES LANGUAGE CUDA) endif() diff --git a/test/rrd/CMakeLists.txt b/test/rrd/CMakeLists.txt index e27280b7f..36746b5a6 100644 --- a/test/rrd/CMakeLists.txt +++ b/test/rrd/CMakeLists.txt @@ -1,12 +1,15 @@ include(FetchContent) -# Relacy has its own runtime checks and does not compose with compiler sanitizers. -# Strip any -fsanitize* flags in this directory so Relacy-linked targets run cleanly. +# Relacy has its own runtime checks and does not compose with compiler +# sanitizers. Strip any -fsanitize* flags in this directory so Relacy-linked +# targets run cleanly. function(_stdexec_strip_sanitize_flags out_var in_value) separate_arguments(_flags UNIX_COMMAND "${in_value}") list(FILTER _flags EXCLUDE REGEX "^-fsanitize") string(JOIN " " _joined ${_flags}) - set(${out_var} "${_joined}" PARENT_SCOPE) + set(${out_var} + "${_joined}" + PARENT_SCOPE) endfunction() foreach(_cfg "" "_DEBUG" "_RELEASE" "_RELWITHDEBINFO" "_MINSIZEREL") @@ -20,42 +23,38 @@ endforeach() FetchContent_Declare( relacy GIT_REPOSITORY https://github.com/dvyukov/relacy - GIT_TAG master -) + GIT_TAG master) FetchContent_Populate(relacy) add_library(relacy INTERFACE) -target_include_directories(relacy INTERFACE - $ - $ - $ -) +target_include_directories( + relacy + INTERFACE $ + $ + $) function(add_relacy_test target_name) add_executable(${target_name} ${target_name}.cpp) target_link_libraries(${target_name} PRIVATE relacy) # Disable TBB - Relacy simulates all threads with fibers anyway... - target_compile_definitions(${target_name} PRIVATE _GLIBCXX_USE_TBB_PAR_BACKEND=0) + target_compile_definitions(${target_name} + PRIVATE _GLIBCXX_USE_TBB_PAR_BACKEND=0) target_include_directories(${target_name} PRIVATE ../../include) target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - set_target_properties(${target_name} PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF) + set_target_properties( + ${target_name} + PROPERTIES CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF) add_test(NAME relacy-${target_name} COMMAND ${target_name}) set_tests_properties(relacy-${target_name} PROPERTIES TIMEOUT 120) endfunction() -set(relacy_tests - async_scope - bwos_lifo_queue - intrusive_mpsc_queue - split - sync_wait -) +set(relacy_tests async_scope bwos_lifo_queue intrusive_mpsc_queue split + sync_wait) foreach(test ${relacy_tests}) add_relacy_test(${test})