-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
90 lines (69 loc) · 3.31 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
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(Actscore VERSION 1.0.0 LANGUAGES CXX CUDA)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/INSTALL CACHE PATH "Default prefix of install directories" FORCE)
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#set(CMAKE_CXX_STANDARD 17)
include(CheckLanguage)
check_language(CUDA)
# if(NOT DEFINED CMAKE_CUDA_STANDARD)
# set(CMAKE_CUDA_STANDARD 17)
# set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# endif()
aux_source_directory(src/MagneticField LIB_SRC_BField)
aux_source_directory(src/Plugins LIB_SRC_Plugins)
find_package(ROOT)
find_package(CUDA)
message(${CUDA_TOOLKIT_INCLUDE})
include_directories(${CUDA_TOOLKIT_INCLUDE})
# include_directories(${CUDA_TOOLKIT_INCLUDE}/crt)
find_package(OpenMP)
# import Eigen
include(cmake/FindEigen.cmake)
# make sure libActscore.so is available at runtime
#set(CMAKE_INSTALL_RPATH "$ORIGIN/../bin")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr -std=c++14 -lineinfo -res-usage -arch=sm_70 -Xcompiler -fopenmp")
add_library(Actscore STATIC ${LIB_SRC_BField} ${LIB_SRC_Plugins})
target_link_libraries(Actscore PUBLIC OpenMP::OpenMP_CXX Eigen3::Eigen)
target_include_directories(Actscore
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
)
add_subdirectory(Run)
# install-tree
set(CONF_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../include")
configure_file(cmake/ActscoreConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake_install/ActscoreConfig.cmake @ONLY)
configure_file(cmake/ActscoreConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/cmake_install/ActscoreConfigVersion.cmake @ONLY)
install(FILES
${PROJECT_BINARY_DIR}/cmake_install/ActscoreConfig.cmake
${PROJECT_BINARY_DIR}/cmake_install/ActscoreConfigVersion.cmake
DESTINATION cmake COMPONENT devel)
install(TARGETS Actscore
EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION bin COMPONENT runtime
LIBRARY DESTINATION bin COMPONENT runtime
ARCHIVE DESTINATION bin COMPONENT devel
PUBLIC_HEADER DESTINATION include COMPONENT devel
RESOURCE DESTINATION resource COMPONENT runtime
)
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION cmake
)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/Performance/Scripts
${CMAKE_SOURCE_DIR}/INSTALL/Scripts)
install(CODE "MESSAGE(\"project is installed in ${CMAKE_INSTALL_PREFIX} .\")")
# build-tree
set(CONF_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/performance_testing)
configure_file(cmake/ActscoreConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/ActscoreConfig.cmake @ONLY)
configure_file(cmake/ActscoreConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/cmake/ActscoreConfigVersion.cmake @ONLY)
export(TARGETS Actscore FILE ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Targets.cmake)
export(PACKAGE ${PROJECT_NAME})