Warning, /acts/Traccc/device/cuda_utils/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # TRACCC library, part of the ACTS project (R&D line)
0002 #
0003 # (c) 2026 CERN for the benefit of the ACTS project
0004 #
0005 # Mozilla Public License Version 2.0
0006
0007 # Find the CUDA toolkit
0008 find_package(CUDAToolkit REQUIRED)
0009
0010 # Enable the CUDA language, otherwise covfie::cuda would cause an error.
0011 enable_language(CUDA)
0012
0013 # Project include(s).
0014 include(traccc-compiler-options-cpp)
0015
0016 # Set up the build of the traccc::cuda_utils library.
0017 traccc_add_library( traccc_cuda_utils cuda_utils TYPE SHARED
0018 # Public facing code.
0019 "include/traccc/cuda/utils/stream_wrapper.hpp"
0020 "src/stream_wrapper.cpp"
0021 "include/traccc/cuda/utils/make_magnetic_field.hpp"
0022 "src/make_magnetic_field.cpp"
0023 # Implementation details.
0024 "src/cuda_error_handling.hpp"
0025 "src/cuda_error_handling.cpp"
0026 )
0027 target_link_libraries(
0028 traccc_cuda_utils
0029 PUBLIC traccc::core
0030 PRIVATE CUDA::cudart covfie::core covfie::cuda
0031 )
0032
0033 # Check if cudaStreamGetDevice(...) is available. It's done through a helper
0034 # function, so that CMAKE_CXX_FLAGS "would be handled correctly".
0035 include(CheckCXXSourceCompiles)
0036
0037 function(traccc_cuda_utils_set_flags)
0038 set(CMAKE_CXX_FLAGS "") # Needed not to pick up -Werror for the following
0039 # test.
0040 set(CMAKE_REQUIRED_INCLUDES "${CUDAToolkit_INCLUDE_DIRS}")
0041 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
0042 check_cxx_source_compiles(
0043 "#include <cuda_runtime_api.h>
0044 void foo() {
0045 cudaStream_t stream{nullptr};
0046 int device{-1};
0047 cudaStreamGetDevice(stream, &device);
0048 }"
0049 TRACCC_HAVE_CUDA_STREAM_GET_DEVICE
0050 )
0051 if(TRACCC_HAVE_CUDA_STREAM_GET_DEVICE)
0052 target_compile_definitions(
0053 traccc_cuda_utils
0054 PRIVATE TRACCC_HAVE_CUDA_STREAM_GET_DEVICE
0055 )
0056 endif()
0057 endfunction()
0058
0059 traccc_cuda_utils_set_flags()