-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
69 lines (53 loc) · 2.7 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
cmake_minimum_required(VERSION 3.22)
project(CGlauber VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
find_package(COLA REQUIRED)
find_package(ROOT REQUIRED)
include(CMakePackageConfigHelpers)
set(CMAKE_INSTALL_PREFIX ${COLA_DIR})
set(COLA_MODULE_NAME CGlauber)
# Add library target
set(srcs Wrapper/CGlauberFactory.cc Wrapper/CGlauberGenerator.cc TGlauber/TGlauNucleon.cc TGlauber/TGlauNucleus.cc TGlauber/TGlauberMC.cc FermiMomentum/FermiMomentum.cc)
add_library(CGlauber SHARED ${srcs})
target_include_directories(CGlauber PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/TGlauber;${PROJECT_SOURCE_DIR}/Wrapper;${PROJECT_SOURCE_DIR}/FermiMomentum;${PROJECT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:include/${COLA_MODULE_NAME}>)
target_link_libraries(CGlauber PUBLIC COLA ROOT::RIO ROOT::MathMore ${ROOT_LIBRARIES})
# Specify public headers for installation
set(PROJECT_PUBLIC_HEADERS "Wrapper/CGlauber.hh" "Wrapper/CGlauberFactory.hh" "Wrapper/CGlauberGenerator.hh"
"TGlauber/TGlauberMC.hh" "TGlauber/TGlauNucleon.hh" "TGlauber/TGlauNucleus.hh"
"GlauberConst.hh"
"FermiMomentum/FermiMomentum.hh")
set_target_properties(CGlauber PROPERTIES PUBLIC_HEADER "${PROJECT_PUBLIC_HEADERS}")
# Add installation path for library to find .dat files:
add_compile_definitions(DATA_INSTALL="${CMAKE_INSTALL_PREFIX}/data/${COLA_MODULE_NAME}/")
# Configure config files
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/CGlauberConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CGlauberConfig.cmake"
INSTALL_DESTINATION lib/cmake/${COLA_MODULE_NAME}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/CGlauberConfigVersion.cmake
COMPATIBILITY AnyNewerVersion)
# Install library
install(TARGETS CGlauber
EXPORT CGlauberExport
LIBRARY DESTINATION lib/${COLA_MODULE_NAME}
PUBLIC_HEADER DESTINATION include/${COLA_MODULE_NAME}
INCLUDES DESTINATION include/${COLA_MODULE_NAME})
# Install export file and config files
install(EXPORT CGlauberExport
DESTINATION lib/cmake/${COLA_MODULE_NAME})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CGlauberConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/CGlauberConfigVersion.cmake"
DESTINATION lib/cmake/${COLA_MODULE_NAME})
#install .dat files for proper TGlauber generation
install(FILES ${PROJECT_SOURCE_DIR}/data/ca40_alv.dat
${PROJECT_SOURCE_DIR}/data/carbon_plaintext.dat
${PROJECT_SOURCE_DIR}/data/h3_plaintext.dat
${PROJECT_SOURCE_DIR}/data/he3_plaintext.dat
${PROJECT_SOURCE_DIR}/data/he4_plaintext.dat
${PROJECT_SOURCE_DIR}/data/o16_alv.dat
${PROJECT_SOURCE_DIR}/data/oxygen_plaintext.dat
DESTINATION data/${COLA_MODULE_NAME})