-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (42 loc) · 1.75 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
PROJECT(TranslationCUDA LANGUAGES CXX CUDA)
set(CMAKE_CUDA_SEPARABLE_COMPILATION true)
# Load some default paths for installation (e.g., /usr/local/)
INCLUDE(GNUInstallDirs)
# Default build type is release
set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
if (NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install CACHE PATH "Where to install the library." FORCE)
endif (NOT CMAKE_INSTALL_PREFIX)
# Set some default flags for build types
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -O2 -DNDEBUG")
include_directories(src)
include_directories(ext/cub-1.8.0/cub)
# Decide whether to build tests and where to install them
OPTION(BUILD_TESTS "Build tests" ON)
if (BUILD_TESTS)
set(TESTS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/tests CACHE STRING "Installation directory for tests.")
endif ()
# Decide whether to build examples
OPTION(BUILD_EXAMPLES "Build examples" ON)
if (BUILD_EXAMPLES)
set(EXAMPLES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/examples CACHE STRING "Installation directory for examples.")
endif ()
# Where to put the built files prior to installation--We'll put it right at the 'build' directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_subdirectory(src)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif (BUILD_EXAMPLES)