Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ include(ipc_toolkit_use_colors)
# Generate position-independent code by default
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

################################################################################
# CUDA
################################################################################

if(IPC_TOOLKIT_WITH_CUDA)
# If CMAKE_CUDA_ARCHITECTURES was not specified, set it to native.
if(DEFINED CMAKE_CUDA_ARCHITECTURES)
message(STATUS "CMAKE_CUDA_ARCHITECTURES was specified, skipping auto-detection")
else()
message(STATUS "CMAKE_CUDA_ARCHITECTURES was not specified, set it to native")
set(CMAKE_CUDA_ARCHITECTURES "native")
endif()
message(STATUS "Targeting CUDA_ARCHITECTURES \"${CMAKE_CUDA_ARCHITECTURES}\"")

# Enable CUDA support
enable_language(CUDA)
endif()

################################################################################
# IPC Toolkit Library
################################################################################
Expand All @@ -118,6 +136,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(ipc_toolkit)
add_library(ipc::toolkit ALIAS ipc_toolkit)

if(IPC_TOOLKIT_WITH_CUDA)
# We need to explicitly state that we need all CUDA files in the particle
# library to be built with -dc as the member functions could be called by
# other libraries and executables.
set_target_properties(ipc_toolkit PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
endif()

# Fill in configuration options
configure_file(
"${IPC_TOOLKIT_SOURCE_DIR}/config.hpp.in"
Expand Down Expand Up @@ -233,29 +258,6 @@ endif()
# Use C++17
target_compile_features(ipc_toolkit PUBLIC cxx_std_17)

################################################################################
# CUDA
################################################################################

if(IPC_TOOLKIT_WITH_CUDA)
# If CMAKE_CUDA_ARCHITECTURES was not specified, set it to native.
if(DEFINED CMAKE_CUDA_ARCHITECTURES)
message(STATUS "CMAKE_CUDA_ARCHITECTURES was specified, skipping auto-detection")
else()
message(STATUS "CMAKE_CUDA_ARCHITECTURES was not specified, set it to native")
set(CMAKE_CUDA_ARCHITECTURES "native")
endif()
message(STATUS "Targeting CUDA_ARCHITECTURES \"${CMAKE_CUDA_ARCHITECTURES}\"")

# Enable CUDA support
enable_language(CUDA)

# We need to explicitly state that we need all CUDA files in the particle
# library to be built with -dc as the member functions could be called by
# other libraries and executables.
set_target_properties(ipc_toolkit PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
endif()

################################################################################
# Tests
################################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/broad_phase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ set(SOURCES
spatial_hash.hpp
sweep_and_prune.cpp
sweep_and_prune.hpp
sweep_and_tiniest_queue.cpp
sweep_and_tiniest_queue.cu
sweep_and_tiniest_queue.hpp
voxel_size_heuristic.cpp
voxel_size_heuristic.hpp
)

target_sources(ipc_toolkit PRIVATE ${SOURCES})
target_sources(ipc_toolkit PRIVATE ${SOURCES})