|
| 1 | +cmake_minimum_required(VERSION 3.21) |
| 2 | + |
| 3 | +project(CCCL_C_EXPERIMENTAL_STF LANGUAGES CUDA CXX C) |
| 4 | + |
| 5 | +option(CCCL_C_EXPERIMENTAL_STF_ENABLE_TESTING "Build cccl.experimental.c.stf tests." OFF) |
| 6 | + |
| 7 | +# FIXME Ideally this would be handled by presets and install rules, but for now |
| 8 | +# consumers may override this to control the target location of cccl.c.experimental.stf. |
| 9 | +set(CCCL_C_EXPERIMENTAL_STF_LIBRARY_OUTPUT_DIRECTORY "" CACHE PATH "Override output directory for the cccl.c.experimental.stf library") |
| 10 | +mark_as_advanced(CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY) |
| 11 | + |
| 12 | +file(GLOB_RECURSE srcs |
| 13 | + RELATIVE "${CMAKE_CURRENT_LIST_DIR}" |
| 14 | + CONFIGURE_DEPENDS |
| 15 | + "src/*.cu" "src/*.cuh" |
| 16 | +) |
| 17 | + |
| 18 | +add_library(cccl.c.experimental.stf SHARED ${srcs}) |
| 19 | +set_property(TARGET cccl.c.experimental.stf PROPERTY POSITION_INDEPENDENT_CODE ON) |
| 20 | +cccl_configure_target(cccl.c.experimental.stf DIALECT 17) |
| 21 | + |
| 22 | +# Override the properties set by cccl_configure_target: |
| 23 | +if (CCCL_C_EXPERIMENTAL_STF_LIBRARY_OUTPUT_DIRECTORY) |
| 24 | + set_target_properties(cccl.c.parallel PROPERTIES |
| 25 | + LIBRARY_OUTPUT_DIRECTORY "${CCCL_C_EXPERIMENTAL_STF_LIBRARY_OUTPUT_DIRECTORY}" |
| 26 | + ARCHIVE_OUTPUT_DIRECTORY "${CCCL_C_EXPERIMENTAL_STF_LIBRARY_OUTPUT_DIRECTORY}" |
| 27 | + ) |
| 28 | +endif() |
| 29 | + |
| 30 | +find_package(CUDAToolkit REQUIRED) |
| 31 | +set_target_properties(cccl.c.experimental.stf PROPERTIES CUDA_RUNTIME_LIBRARY STATIC) |
| 32 | +target_link_libraries(cccl.c.experimental.stf PRIVATE |
| 33 | + CUDA::cudart_static |
| 34 | + CUDA::nvrtc |
| 35 | + CUDA::nvJitLink |
| 36 | + CUDA::cuda_driver |
| 37 | + cccl.compiler_interface_cpp20 |
| 38 | + cccl.c.parallel.jit_template |
| 39 | + CUB::CUB |
| 40 | + Thrust::Thrust |
| 41 | + nlohmann_json::nlohmann_json |
| 42 | +) |
| 43 | +# target_compile_definitions(cccl.c.experimental.stf PUBLIC CCCL_C_EXPERIMENTAL=1) |
| 44 | +# target_compile_definitions(cccl.c.experimental.stf PRIVATE |
| 45 | +# NVRTC_GET_TYPE_NAME=1 |
| 46 | +# CUB_DISABLE_CDP=1 |
| 47 | +# CUB_DEFINE_RUNTIME_POLICIES |
| 48 | +# ) |
| 49 | +target_compile_options(cccl.c.experimental.stf PRIVATE $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:--extended-lambda>) |
| 50 | + |
| 51 | +target_include_directories(cccl.c.experimental.stf PUBLIC "include") |
| 52 | +target_include_directories(cccl.c.experimental.stf PRIVATE "src") |
| 53 | + |
| 54 | +if (CCCL_C_Parallel_ENABLE_TESTING) |
| 55 | + add_subdirectory(test) |
| 56 | +endif() |
| 57 | + |
| 58 | +if (CCCL_C_Parallel_ENABLE_HEADER_TESTING) |
| 59 | + include(cmake/CParallelHeaderTesting.cmake) |
| 60 | +endif() |
0 commit comments