Files
nvbench/CMakeLists.txt
Allison Vacanti c133784763 Add the first example.
- New NVBench_ENABLE_EXAMPLES CMake option.
- examples/axis.cu provides examples of parameter sweeps.
- Moves testing/sleep_kernel.cuh -> nvbench/test_kernels.cuh
  - Accessible to examples and provides some built-in kernels for users
    to experiement with.
  - Not included with `<nvbench/nvbench.cuh>`.
2021-03-08 18:26:26 -05:00

59 lines
1.5 KiB
CMake

# 3.18.3 is needed for a MSVC + NVCC + C++17 bugfix.
cmake_minimum_required(VERSION 3.18.3)
# CXX to work around issues with CUDA-only CMake projects.
project(NVBench CUDA CXX)
option(NVBench_ENABLE_TESTING "Build NVBench testing suite." OFF)
option(NVBench_ENABLE_EXAMPLES "Build NVBench examples." OFF)
# Setup some vars for CPM packages:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
# NVBench requires C++17.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)
# TODO this probably should use GNUInstallDirs or something.
set(NVBench_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/lib")
set(NVBench_EXECUTABLE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")
include(CPM)
CPMAddPackage(
NAME fmt
GITHUB_REPOSITORY fmtlib/fmt
GIT_TAG 7.1.3
)
# Following recipe from
# http://github.com/cpm-cmake/CPM.cmake/blob/master/examples/json/CMakeLists.txt
CPMAddPackage(
NAME nlohmann_json
VERSION 3.9.1
# not using the repo as it takes forever to clone
URL https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip
URL_HASH SHA256=6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91
)
if(nlohmann_json_ADDED)
add_library(nvbench_json INTERFACE)
target_include_directories(nvbench_json SYSTEM INTERFACE
"${nlohmann_json_SOURCE_DIR}/include"
)
endif()
add_subdirectory(nvbench)
if (NVBench_ENABLE_EXAMPLES OR NVBench_ENABLE_TESTING)
enable_testing()
endif()
if (NVBench_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
if (NVBench_ENABLE_TESTING)
add_subdirectory(testing)
endif()