Skip to content

Commit d05c62e

Browse files
authored
Merge branch 'main' into misc-tweaks
2 parents 0d2c416 + c211de1 commit d05c62e

File tree

3 files changed

+71
-34
lines changed

3 files changed

+71
-34
lines changed

CMakeLists.txt

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,23 @@ set(stdexec_export_targets)
151151
# Define the main library
152152
add_library(stdexec INTERFACE)
153153

154+
file(GLOB_RECURSE exec_headers CONFIGURE_DEPENDS include/exec/*.hpp)
155+
file(GLOB_RECURSE stdexec_headers CONFIGURE_DEPENDS include/stdexec/*.hpp)
156+
target_sources(stdexec
157+
PUBLIC
158+
FILE_SET headers
159+
TYPE HEADERS
160+
BASE_DIRS include
161+
FILES
162+
${exec_headers}
163+
${stdexec_headers}
164+
# stdexec_version_config.hpp is generated by rapids' script
165+
FILE_SET version_config
166+
TYPE HEADERS
167+
BASE_DIRS ${CMAKE_BINARY_DIR}/include
168+
FILES
169+
${CMAKE_BINARY_DIR}/include/stdexec_version_config.hpp
170+
)
154171
list(APPEND stdexec_export_targets stdexec)
155172

156173
# Set library version
@@ -160,10 +177,6 @@ set_target_properties(stdexec PROPERTIES
160177

161178
# Declare the public include directories
162179
include(GNUInstallDirs)
163-
target_include_directories(stdexec INTERFACE
164-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
165-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
166-
)
167180

168181
target_link_libraries(stdexec INTERFACE Threads::Threads)
169182

@@ -269,9 +282,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
269282
endif()
270283

271284
if(STDEXEC_ENABLE_CUDA)
272-
273-
file(GLOB_RECURSE nvexec_sources include/nvexec/*.cuh)
274-
add_library(nvexec INTERFACE ${nvexec_sources})
285+
file(GLOB_RECURSE nvexec_headers CONFIGURE_DEPENDS include/nvexec/*.cuh)
286+
add_library(nvexec INTERFACE)
287+
target_sources(nvexec
288+
PUBLIC
289+
FILE_SET headers
290+
TYPE HEADERS
291+
BASE_DIRS include
292+
FILES ${nvexec_headers}
293+
)
275294
list(APPEND stdexec_export_targets nvexec)
276295
add_library(STDEXEC::nvexec ALIAS nvexec)
277296

@@ -283,6 +302,10 @@ if(STDEXEC_ENABLE_CUDA)
283302
target_link_options(nvexec INTERFACE
284303
$<$<AND:$<CXX_COMPILER_ID:NVHPC>,$<COMPILE_LANGUAGE:CXX>>:-stdpar -gpu=cc${CMAKE_CUDA_ARCHITECTURES}>)
285304

305+
install(TARGETS nvexec
306+
EXPORT stdexec-exports
307+
FILE_SET headers)
308+
286309
if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
287310
include(rapids-cuda)
288311
# Needs to run before `enable_language(CUDA)`
@@ -330,16 +353,29 @@ if (STDEXEC_ENABLE_TBB)
330353
INSTALL_EXPORT_SET stdexec-exports
331354
)
332355

333-
file(GLOB_RECURSE tbbpool_sources include/execpools/tbb/*.hpp)
334-
add_library(tbbpool INTERFACE ${tbbpool_sources})
356+
# CONFIGURE_DEPENDS ensures that CMake reconfigures when a relevant hpp file is
357+
# added or removed.
358+
file(GLOB_RECURSE tbbpool_headers CONFIGURE_DEPENDS include/execpools/tbb/*.hpp)
359+
add_library(tbbpool INTERFACE)
335360
list(APPEND stdexec_export_targets tbbpool)
336361
add_library(STDEXEC::tbbpool ALIAS tbbpool)
362+
target_sources(tbbpool
363+
PUBLIC
364+
FILE_SET headers
365+
TYPE HEADERS
366+
BASE_DIRS include
367+
FILES ${tbbpool_headers}
368+
)
337369

338370
target_link_libraries(tbbpool
339371
INTERFACE
340372
STDEXEC::stdexec
341373
TBB::tbb
342374
)
375+
376+
install(TARGETS tbbpool
377+
EXPORT stdexec-exports
378+
FILE_SET headers)
343379
endif()
344380

345381
option(STDEXEC_ENABLE_TASKFLOW "Enable TaskFlow targets" OFF)
@@ -435,10 +471,6 @@ endif()
435471

436472
set(SYSTEM_CONTEXT_SOURCES src/system_context/system_context.cpp)
437473
add_library(system_context STATIC ${SYSTEM_CONTEXT_SOURCES})
438-
target_include_directories(system_context PRIVATE
439-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
440-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
441-
)
442474
target_compile_features(system_context PUBLIC cxx_std_20)
443475
set_target_properties(system_context PROPERTIES
444476
CXX_STANDARD 20
@@ -448,7 +480,7 @@ target_compile_options(system_context PUBLIC
448480
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/Zc:__cplusplus /Zc:preprocessor>
449481
)
450482
add_library(STDEXEC::system_context ALIAS system_context)
451-
483+
target_link_libraries(system_context PUBLIC stdexec)
452484

453485

454486
if(CMAKE_CROSSCOMPILING)
@@ -499,16 +531,9 @@ endif()
499531
include(CPack)
500532

501533
install(TARGETS stdexec system_context
502-
DESTINATION ${CMAKE_INSTALL_LIBDIR}
503-
EXPORT stdexec-exports)
504-
505-
install(
506-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
507-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
508-
509-
install(
510-
FILES ${CMAKE_CURRENT_BINARY_DIR}/include/stdexec_version_config.hpp
511-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
534+
EXPORT stdexec-exports
535+
FILE_SET headers
536+
FILE_SET version_config)
512537

513538
##############################################################################
514539
# Install exports ------------------------------------------------------------

include/exec/any_sender_of.hpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,13 @@ namespace exec {
567567
}
568568
};
569569

570-
template <class _VTable = __empty_vtable, class _Allocator = std::allocator<std::byte>>
571-
using __immovable_storage_t = __t<__immovable_storage<_VTable, _Allocator>>;
570+
template <
571+
class _VTable = __empty_vtable,
572+
class _Allocator = std::allocator<std::byte>,
573+
std::size_t _InlineSize = 3 * sizeof(void*),
574+
std::size_t _Alignment = alignof(std::max_align_t)>
575+
using __immovable_storage_t =
576+
__t<__immovable_storage<_VTable, _Allocator, _InlineSize, _Alignment>>;
572577

573578
template <class _VTable, class _Allocator = std::allocator<std::byte>>
574579
using __unique_storage_t = __t<__storage<_VTable, _Allocator>>;
@@ -791,7 +796,8 @@ namespace exec {
791796
}
792797
};
793798

794-
using __immovable_operation_storage = __immovable_storage_t<__operation_vtable>;
799+
using __immovable_operation_storage =
800+
__immovable_storage_t<__operation_vtable, std::allocator<std::byte>, 6 * sizeof(void*)>;
795801

796802
template <class _Sigs, class _Queries>
797803
using __receiver_ref = __mapply<__mbind_front<__q<__rec::__ref>, _Sigs>, _Queries>;
@@ -1205,6 +1211,7 @@ namespace exec {
12051211

12061212
template <auto... _SchedulerQueries>
12071213
class any_scheduler {
1214+
// Add the required set_value_t() completions to the schedule-sender.
12081215
using __schedule_completions = stdexec::__concat_completion_signatures<
12091216
_Completions,
12101217
stdexec::completion_signatures<stdexec::set_value_t()>>;
@@ -1216,10 +1223,11 @@ namespace exec {
12161223
template <class _Tag>
12171224
struct __ret_equals_to {
12181225
template <class _Sig>
1219-
using __f = std::is_same<_Tag, decltype(__ret_fn(static_cast<_Sig>(nullptr)))>;
1226+
using __f =
1227+
stdexec::__mbool<STDEXEC_IS_SAME(_Tag, decltype(__ret_fn(static_cast<_Sig>(nullptr))))>;
12201228
};
12211229

1222-
using schedule_sender_queries = stdexec::__minvoke<
1230+
using __schedule_sender_queries = stdexec::__minvoke<
12231231
stdexec::__mremove_if<
12241232
__ret_equals_to<stdexec::get_completion_scheduler_t<stdexec::set_value_t>>>,
12251233
decltype(_SenderQueries)...>;
@@ -1238,7 +1246,7 @@ namespace exec {
12381246
stdexec::get_completion_scheduler<stdexec::set_value_t>.template signature<any_scheduler() noexcept>>;
12391247
#endif
12401248
using __schedule_sender =
1241-
stdexec::__mapply<stdexec::__q<__schedule_sender_fn>, schedule_sender_queries>;
1249+
stdexec::__mapply<stdexec::__q<__schedule_sender_fn>, __schedule_sender_queries>;
12421250

12431251
using __scheduler_base =
12441252
__any::__scheduler<__schedule_sender, queries<_SchedulerQueries...>>;

include/exec/task.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ namespace exec {
3838
namespace __task {
3939
using namespace stdexec;
4040

41-
using __any_scheduler = //
42-
any_receiver_ref< //
43-
completion_signatures<set_error_t(std::exception_ptr), set_stopped_t()> //
44-
>::any_sender<>::any_scheduler<>;
41+
// The required set_value_t() scheduler-sender completion signature is added in
42+
// any_receiver_ref::any_sender::any_scheduler.
43+
using __any_scheduler_completions =
44+
completion_signatures<set_error_t(std::exception_ptr), set_stopped_t()>;
45+
46+
using __any_scheduler =
47+
any_receiver_ref<__any_scheduler_completions>::any_sender<>::any_scheduler<>;
48+
4549
static_assert(scheduler<__any_scheduler>);
4650

4751
template <class _Ty>

0 commit comments

Comments
 (0)