-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (50 loc) · 1.46 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.18)
option(ENABLE_CUDA "Enable compilation with CUDA for GPU acceleration"
$ENV{ENABLE_CUDA})
if(ENABLE_CUDA)
project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX CUDA)
else(ENABLE_CUDA)
project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX)
endif(ENABLE_CUDA)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug"
"RelWithDebInfo")
endif()
if(ENABLE_CUDA)
add_definitions(-DENABLE_CUDA)
endif()
# Enable CPM
include(cmake/CPM.cmake)
if(ENABLE_CUDA)
# CUDA support
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
find_package(CUDAToolkit 12.0 REQUIRED)
else(CMAKE_CUDA_COMPILER)
message(STATUS "No CUDA compiler found")
endif(CMAKE_CUDA_COMPILER)
endif(ENABLE_CUDA)
# Add source files
add_subdirectory(src)
# Add Python binding
add_subdirectory(python)
# Add tests
enable_testing()
add_subdirectory(tests)