-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
45 lines (39 loc) · 1.29 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
cmake_minimum_required(VERSION 3.9)
project(culib)
enable_language(CUDA)
set(include_dir ${CMAKE_CURRENT_LIST_DIR}/include)
set(src_dir ${CMAKE_CURRENT_LIST_DIR}/src)
set(cmake_dir ${CMAKE_CURRENT_LIST_DIR}/cmake)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
include(${cmake_dir}/FindAvxDetect.cmake)
add_subdirectory(${src_dir})
#helper target to propagate common settings
add_library(common_config_ INTERFACE)
target_compile_features(common_config_ INTERFACE cxx_std_17)
target_include_directories(common_config_
INTERFACE $<BUILD_INTERFACE:${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}>
INTERFACE $<BUILD_INTERFACE:${include_dir}>
)
target_link_libraries(common_config_
INTERFACE Threads::Threads
INTERFACE ${CUDART_LIBRARY}
INTERFACE AvxDetect::AvxDetect
)
add_library(culib INTERFACE)
target_link_libraries(culib
INTERFACE common_config_
INTERFACE culib_bin
)
option(BUILD_TEST "build culib tests" OFF)
option(BUILD_BENCHMARK "build culib benchmark" OFF)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(BUILD_TEST)
add_subdirectory(test)
endif()
if(BUILD_BENCHMARK)
add_subdirectory(benchmark)
endif()
endif()