cudaCAC/CMakeLists.txt

79 lines
2.1 KiB
Text
Raw Normal View History

2017-12-28 11:15:19 -07:00
cmake_minimum_required(VERSION 3.9)
set(NAME "cudaCAC")
project(${NAME} LANGUAGES CUDA CXX)
2025-04-15 14:10:01 -04:00
2025-04-16 08:12:35 -04:00
enable_testing()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Default settings
2025-04-15 14:10:01 -04:00
add_compile_options(-Wall -Wextra -Wpedantic)
2017-12-28 11:15:19 -07:00
add_compile_options($<$<COMPILE_LANGUAGE:CUDA>:-Wno-pedantic>)
# Add pedantic just for
2017-12-28 11:15:19 -07:00
set(CMAKE_CXX_STANDARD 17)
# Cuda Settings
2025-04-15 14:10:01 -04:00
set(CMAKE_CUDA_ARCHITECTURES 61)
set(CUDA_SEPARABLE_COMPILATION ON)
# Cuda settings to get correct compile_commands.json
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
2025-04-15 14:10:01 -04:00
2025-04-16 08:12:35 -04:00
# Add Vec3 as a dependency
include(FetchContent)
FetchContent_Declare(Vec3
GIT_REPOSITORY https://www.alexselimov.com/git/aselimov/Vec3.git
)
2017-12-28 11:15:19 -07:00
2025-04-16 08:12:35 -04:00
FetchContent_GetProperties(Vec3)
if(NOT Vec3_POPULATED)
FetchContent_MakeAvailable(Vec3)
include_directories(${Vec3_SOURCE_DIR})
endif()
2017-12-28 11:15:19 -07:00
include_directories(/usr/local/cuda-12.8/include)
2017-12-28 11:15:19 -07:00
include_directories(src)
2025-04-15 14:10:01 -04:00
include_directories(kernels)
2017-12-28 11:15:19 -07:00
add_subdirectory(src)
2025-04-15 14:10:01 -04:00
add_subdirectory(kernels)
add_subdirectory(tests)
2025-04-15 14:10:01 -04:00
add_executable(${NAME} main.cpp)
2025-04-16 08:12:35 -04:00
install(DIRECTORY src/ DESTINATION src/)
2025-04-15 14:10:01 -04:00
target_link_libraries(
${NAME}
2025-04-15 14:10:01 -04:00
PRIVATE
${NAME}_lib
${NAME}_cuda_lib
2025-04-15 14:10:01 -04:00
${CUDA_LIBRARIES}
)
2017-12-28 11:23:40 -07:00
# Doxygen Build
option(BUILD_DOC "Build Documentation" OFF)
2017-12-28 11:23:40 -07:00
find_package(Doxygen)
if(DOXYGEN_FOUND AND BUILD_DOC)
2017-12-28 11:23:40 -07:00
set(BUILD_DOC_DIR ${CMAKE_SOURCE_DIR}/build/docs)
if(NOT EXISTS ${BUILD_DOC_DIR})
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
endif()
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen buld started")
add_custom_target(Doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND AND BUILD_DOC)
2017-12-28 11:23:40 -07:00
message("Doxygen needs to be installed to generate the documentation.")
endif(DOXYGEN_FOUND AND BUILD_DOC)