-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
52 lines (41 loc) · 1.43 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
cmake_minimum_required(VERSION 3.24)
project(recoil LANGUAGES CXX)
include(CheckCXXCompilerFlag)
set(FLAGS "" CACHE STRING "Custom compile options.")
find_package(CUDA)
if(CUDA_FOUND)
enable_language(CUDA)
if(NOT DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION)
set(CMAKE_CUDA20_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA20_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CUDA_FLAGS "-std=c++20 ${FLAGS}")
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
set(CMAKE_CUDA_ARCHITECTURES 70)
endif()
set(CMAKE_CUDA_FLAGS_DEBUG "-G ${CMAKE_CUDA_FLAGS}")
set(CMAKE_CUDA_FLAGS_RELEASE "-O3 ${CMAKE_CUDA_FLAGS}")
else()
set(CUDA_INCLUDE_DIRS)
set(CUDA_LIBRARIES)
message(WARNING "CUDA examples cannot be compiled, since CUDA is not found on this system")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_FLAGS "-pthread ${FLAGS}")
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -Winline -DNDEBUG ${CMAKE_CXX_FLAGS}")
include_directories(
${CUDA_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
$ENV{INCLUDE_DIR}
)
link_directories(
${CUDA_LIBRARIES}
$ENV{LINK_DIR}
)
add_subdirectory(examples)