-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
117 lines (91 loc) · 2.72 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Note:
#
# cuda-kat is a _header-only_ library. You can't build it, and you don't need
# to run CMake in order to use it or install it. Just add the `src/` directory
# to your include path (or copy its contents to some `include/` directory.
# cuda-kat only depends on having a C++11 compiler and the CUDA toolkit
# installed.
#
# This file is provided mostly in order to build the library unit tests.
cmake_minimum_required(VERSION 3.8.2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
project(cuda-kat
DESCRIPTION "CUDA kernel author's tools"
VERSION 0.1.0
HOMEPAGE_URL "https://github.com/eyalroz/cuda-kat"
LANGUAGES CXX CUDA)
###############
## Modules ##
###############
# Standard CMake modules
# Custom modules
############################
## Package dependencies ##
############################
# cuda-kat can't use the standard library's string formatting and output stream code,
# because most of it is host-side only; and it doesn't make sense to bundle a modified
# half of the standard library just for that. Instead, we use the strf library
# (available at: https://github.com/robhz786/strf )
find_package(strf 0.10.4)
###############
## OPTIONS ##
###############
#message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
set(BUILD_TESTS FALSE CACHE BOOL "Build tests for the library")
###############
## Targets ##
###############
add_library(cuda-kat INTERFACE)
target_include_directories(
cuda-kat
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>"
"$<INSTALL_INTERFACE:include>"
)
# TODO: Consider enabling the following command. It helps IDEs
# notice the library's header files even if they're not currently
# in use.
#
#target_sources(cuda-kat
# src/kat/on_device/time.cuh
# src/kat/on_device/shared_memory.cuh
# etc. etc.
#############
## Tests ##
#############
if(BUILD_TESTS)
enable_testing()
# set(TEST_RUNNER_PARAMS "--force-colors=true" CACHE STRING "Options to add to our test runners commands")
add_subdirectory(tests)
endif()
####################
## Installation ##
####################
include(GNUInstallDirs)
install(
TARGETS cuda-kat
EXPORT cuda-kat_export
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install(
DIRECTORY src/kat
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING REGEX "\\.(h|hpp|cuh)$"
)
install(
EXPORT cuda-kat_export
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cuda-kat"
NAMESPACE "cuda-kat::"
FILE cuda-kat-config.cmake
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"cuda-kat-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cuda-kat-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cuda-kat"
)