-
Notifications
You must be signed in to change notification settings - Fork 69
/
NVBenchDependencies.cmake
81 lines (71 loc) · 2.77 KB
/
NVBenchDependencies.cmake
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
################################################################################
# fmtlib/fmt
include("${rapids-cmake-dir}/cpm/fmt.cmake")
if(NOT BUILD_SHARED_LIBS AND NVBench_ENABLE_INSTALL_RULES)
set(export_set_details BUILD_EXPORT_SET nvbench-targets
INSTALL_EXPORT_SET nvbench-targets)
endif()
rapids_cpm_fmt(${export_set_details}
CPM_ARGS
OPTIONS
# Force static to keep fmt internal.
"BUILD_SHARED_LIBS OFF"
)
if(NOT fmt_ADDED)
set(fmt_is_external TRUE)
endif()
################################################################################
# nlohmann/json
#
# Following recipe from
# http://github.com/cpm-cmake/CPM.cmake/blob/master/examples/json/CMakeLists.txt
# Download the zips because the repo takes an excessively long time to clone.
rapids_cpm_find(nlohmann_json 3.9.1
# Release:
CPM_ARGS
URL https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip
URL_HASH SHA256=6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91
PATCH_COMMAND
# Work around compiler bug in nvcc 11.0, see NVIDIA/NVBench#18
${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/nlohmann_json.hpp"
"./include/nlohmann/json.hpp"
# Development version:
# I'm waiting for https://github.com/nlohmann/json/issues/2676 to be fixed,
# leave this in to simplify testing patches as they come out.
# CPM_ARGS
# VERSION develop
# URL https://github.com/nlohmann/json/archive/refs/heads/develop.zip
# OPTIONS JSON_MultipleHeaders ON
)
add_library(nvbench_json INTERFACE IMPORTED)
if (TARGET nlohmann_json::nlohmann_json)
# If we have a target, just use it. Cannot be an ALIAS library because
# nlohmann_json::nlohmann_json itself might be one.
target_link_libraries(nvbench_json INTERFACE nlohmann_json::nlohmann_json)
else()
# Otherwise we only downloaded the headers.
target_include_directories(nvbench_json SYSTEM INTERFACE
"${nlohmann_json_SOURCE_DIR}/include"
)
endif()
################################################################################
# CUDAToolkit
rapids_find_package(CUDAToolkit REQUIRED
BUILD_EXPORT_SET nvbench-targets
INSTALL_EXPORT_SET nvbench-targets
)
# Append CTK targets to this as we add optional deps (NMVL, CUPTI, ...)
set(ctk_libraries CUDA::toolkit)
################################################################################
# CUDAToolkit -> NVML
if (NVBench_ENABLE_NVML)
include("${CMAKE_CURRENT_LIST_DIR}/NVBenchNVML.cmake")
list(APPEND ctk_libraries nvbench::nvml)
endif()
################################################################################
# CUDAToolkit -> CUPTI
if (NVBench_ENABLE_CUPTI)
include("${CMAKE_CURRENT_LIST_DIR}/NVBenchCUPTI.cmake")
list(APPEND ctk_libraries CUDA::cuda_driver nvbench::cupti)
endif()