Refactor CMakeLists.txt under 4_CUDA_Libraries

This commit is contained in:
Rob Armstrong
2024-12-16 14:38:36 -08:00
parent 090f957854
commit 00999c1789
33 changed files with 627 additions and 178 deletions

View File

@@ -1,3 +1,16 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(freeImageInteropNPP LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES "native")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(
../../../Common
@@ -5,15 +18,16 @@ include_directories(
)
# Source file
set(SRC_FILES
freeImageInteropNPP.cpp
)
find_package(FreeImage)
if(${FreeImage_FOUND})
# Add target for freeImageInteropNPP
add_executable(freeImageInteropNPP ${SRC_FILES})
add_executable(freeImageInteropNPP freeImageInteropNPP.cpp)
target_compile_options(freeImageInteropNPP PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(freeImageInteropNPP PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(freeImageInteropNPP PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(freeImageInteropNPP PRIVATE