
commit d6a52a8841a88bdc22f566731923bd1fc9b337aa Author: Carl Pearson <pearson@illinois.edu> Date: Fri Sep 20 07:32:02 2019 -0500 add badge commit c0a5bbaa2c77d028719c08012da10496c6585bc9 Author: Carl Pearson <pearson@illinois.edu> Date: Fri Sep 20 07:23:20 2019 -0500 download cmake instead of build, add bin to path commit ed3526a8b27984634a9fdd76d40a586d24bda310 Author: Carl Pearson <pearson@illinois.edu> Date: Thu Sep 19 17:23:07 2019 -0500 install cmake 3.15.3 commit 6442aa4f3f4cbc38bae184ac4e06954976134e0a Author: Carl Pearson <pearson@illinois.edu> Date: Thu Sep 19 17:20:33 2019 -0500 require CMake 3.13+ commit 3a0176484fd1c563a7a35edbf0e196544ee2771c Author: Carl Pearson <pearson@illinois.edu> Date: Thu Sep 19 17:17:49 2019 -0500 make VERBOSE=1 commit 8114641a64d6a3044e228fbcf17c1938991918a0 Author: Carl Pearson <pearson@illinois.edu> Date: Thu Sep 19 17:14:24 2019 -0500 try to add stubs dir to link path
57 lines
2.2 KiB
CMake
57 lines
2.2 KiB
CMake
# 3.8+ for project(LANGUAGES CUDA) and CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
|
|
# 3.9+ for OpenMP::OpenMP_CXX
|
|
# 3.10+ findopenmp gained support for language-specific components
|
|
# 3.11+ for CMake not to add -fopenmp to the nvcc flags
|
|
# 3.13+ for target_link_directories
|
|
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
|
|
|
project(perfect LANGUAGES CUDA CXX VERSION 0.1.0)
|
|
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
|
|
|
#https://blog.kitware.com/cmake-and-the-default-build-type/
|
|
# Set a default build type if none was specified
|
|
set(default_build_type "Release")
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
|
set(default_build_type "Debug")
|
|
endif()
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
|
STRING "Choose the type of build." FORCE)
|
|
# Set the possible values of build type for cmake-gui
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
endif()
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
|
message(STATUS "Setting verbose build during Debug")
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} -G)
|
|
elseif (CMAKE_BUILD_TYPE MATCHES Release)
|
|
add_definitions(-DNDEBUG)
|
|
set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} -lineinfo)
|
|
endif()
|
|
|
|
# find the CUDA stubs directory in case the drivers are not installed
|
|
# for CI, for example
|
|
set(CUDA_TOOLKIT_ROOT_DIR "${CMAKE_CUDA_COMPILER}")
|
|
get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}" DIRECTORY)
|
|
get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}" DIRECTORY)
|
|
set(CUDA_TOOLKIT_LIB_DIR ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs)
|
|
message(STATUS "CUDA toolkit stubs dir:" ${CUDA_TOOLKIT_LIB_DIR})
|
|
|
|
|
|
set(CMAKE_CUDA_STANDARD 11)
|
|
|
|
add_subdirectory(include/perfect)
|
|
|
|
add_library(perfect INTERFACE)
|
|
target_include_directories(perfect INTERFACE include/)
|
|
target_include_directories(perfect INTERFACE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
|
target_link_directories(perfect INTERFACE ${CUDA_TOOLKIT_LIB_DIR})
|
|
target_link_libraries(perfect INTERFACE nvidia-ml)
|
|
|
|
|
|
add_subdirectory(examples)
|
|
add_subdirectory(tools) |