diff --git a/CMakeLists.txt b/CMakeLists.txt index c574a5341..021150f8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,6 +260,10 @@ if (NOT STDEXEC_NAMESPACE STREQUAL "stdexec") target_compile_definitions(stdexec INTERFACE STDEXEC_NAMESPACE=${STDEXEC_NAMESPACE}) endif() +if (NOT STDEXEC_BUILD_PARALLEL_SCHEDULER) + target_compile_definitions(stdexec INTERFACE STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY) +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) @@ -455,12 +459,15 @@ if(STDEXEC_BUILD_PARALLEL_SCHEDULER) $<$:/Zc:__cplusplus /Zc:preprocessor /Zc:externConstexpr> ) target_link_libraries(parallel_scheduler PUBLIC stdexec) - - add_library(STDEXEC::parallel_scheduler ALIAS parallel_scheduler) - add_library(system_context ALIAS parallel_scheduler) - add_library(STDEXEC::system_context ALIAS parallel_scheduler) +else() + add_library(parallel_scheduler INTERFACE) + target_link_libraries(parallel_scheduler INTERFACE stdexec) endif() +add_library(STDEXEC::parallel_scheduler ALIAS parallel_scheduler) +add_library(system_context ALIAS parallel_scheduler) +add_library(STDEXEC::system_context ALIAS parallel_scheduler) + option(STDEXEC_ENABLE_IO_URING "Enable the use of the io_uring scheduler on Linux" OFF) if(STDEXEC_ENABLE_IO_URING) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index f48c7636a..33c916b65 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -32,6 +32,9 @@ function(def_example example) $<$:-Wno-maybe-uninitialized> # warnings being emitted from stdlib headers, why? $<$:-Wno-gnu-line-marker> ) + target_compile_definitions(${target} PRIVATE + $<$:NOMINMAX> + ) target_link_libraries(${target} PRIVATE STDEXEC::stdexec stdexec_executable_flags @@ -72,11 +75,7 @@ foreach(example ${stdexec_examples}) def_example(${example}) endforeach() -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) -endif() +target_link_libraries(example.sudoku PRIVATE STDEXEC::parallel_scheduler) if(STDEXEC_ENABLE_CUDA) add_subdirectory(nvexec) diff --git a/examples/benchmark/asio_thread_pool.cpp b/examples/benchmark/asio_thread_pool.cpp index ef693fe9f..4cfa92a00 100644 --- a/examples/benchmark/asio_thread_pool.cpp +++ b/examples/benchmark/asio_thread_pool.cpp @@ -14,8 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "./common.hpp" + +// ASIO requires a specific include order. #include +// + +#include "./common.hpp" #include struct RunThread diff --git a/examples/benchmark/common.hpp b/examples/benchmark/common.hpp index 30ebc10f4..d37edac2e 100644 --- a/examples/benchmark/common.hpp +++ b/examples/benchmark/common.hpp @@ -38,6 +38,8 @@ namespace pmr = std::pmr; # define STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE 1 #endif +#include + struct statistics { std::chrono::milliseconds total_time_ms; @@ -192,4 +194,6 @@ void my_main(int argc, char** argv, exec::numa_policy policy = exec::get_numa_po auto [dur_ms, ops_per_sec, avg, max, min, stddev] = compute_perf(starts, ends, warmup, nRuns - 1, total_scheds); std::cout << avg << " | " << max << " | " << min << " | " << stddev << "\n"; -} \ No newline at end of file +} + +#include diff --git a/examples/scope.cpp b/examples/scope.cpp index 102aecb67..04942390a 100644 --- a/examples/scope.cpp +++ b/examples/scope.cpp @@ -100,7 +100,7 @@ auto main() -> int { sender auto nest = scope.nest(begin); - auto op = connect(std::move(nest), noop_receiver{}); + auto op = stdexec::connect(std::move(nest), noop_receiver{}); (void) op; } sync_wait(scope.on_empty()); diff --git a/include/stdexec/__detail/__env.hpp b/include/stdexec/__detail/__env.hpp index 3d9aba8e1..0bd7df411 100644 --- a/include/stdexec/__detail/__env.hpp +++ b/include/stdexec/__detail/__env.hpp @@ -241,8 +241,8 @@ namespace STDEXEC noexcept(__nothrow_queryable_with<__1st_env_t<_Query, _Args...>, _Query, _Args...>) -> __query_result_t<__1st_env_t<_Query, _Args...>, _Query, _Args...> { - auto const &__env = __detail::__get_1st_env<_Query, _Args...>()(*this); - return __query<_Query>()(__env, static_cast<_Args &&>(__args)...); + return __query<_Query>()(__detail::__get_1st_env<_Query, _Args...>()(*this), + static_cast<_Args &&>(__args)...); } }; diff --git a/include/stdexec/__detail/__parallel_scheduler_replacement_api.hpp b/include/stdexec/__detail/__parallel_scheduler_replacement_api.hpp index b87d63e2c..4d3ecd188 100644 --- a/include/stdexec/__detail/__parallel_scheduler_replacement_api.hpp +++ b/include/stdexec/__detail/__parallel_scheduler_replacement_api.hpp @@ -27,7 +27,6 @@ namespace STDEXEC::parallel_scheduler_replacement { /// Get the backend for the parallel scheduler. /// Users might replace this function. - STDEXEC_ATTRIBUTE(weak) auto query_parallel_scheduler_backend() -> std::shared_ptr; /// The type of a factory that can create `parallel_scheduler_backend` instances. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e14a0469d..1ce3111f0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -96,7 +96,6 @@ set_target_properties(common_test_settings PROPERTIES ) 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 @@ -114,6 +113,7 @@ add_compile_diagnostics(test.stdexec) target_link_libraries(test.stdexec PUBLIC STDEXEC::stdexec + STDEXEC::parallel_scheduler stdexec_executable_flags Catch2::Catch2WithMain PRIVATE diff --git a/test/exec/asio/test_asio_thread_pool.cpp b/test/exec/asio/test_asio_thread_pool.cpp index 1cbcdd3d6..141ccf9f6 100644 --- a/test/exec/asio/test_asio_thread_pool.cpp +++ b/test/exec/asio/test_asio_thread_pool.cpp @@ -15,6 +15,10 @@ * limitations under the License. */ +// ASIO requires a specific include order. +#include +// + #include #include @@ -25,8 +29,6 @@ #include #include -#include - #include namespace ex = STDEXEC; diff --git a/test/stdexec/schedulers/test_parallel_scheduler.cpp b/test/stdexec/schedulers/test_parallel_scheduler.cpp index 5ca814f85..ad4bc9b7b 100644 --- a/test/stdexec/schedulers/test_parallel_scheduler.cpp +++ b/test/stdexec/schedulers/test_parallel_scheduler.cpp @@ -16,10 +16,10 @@ #include -#define STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY 1 - #include +#include + #include #include #include