forked from eic/pfRICH
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
102 lines (74 loc) · 3.02 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
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(pfRICH)
set(CMAKE_BUILD_TYPE Debug)
#----------------------------------------------------------------------------
find_package(ROOT 6.0.00 REQUIRED COMPONENTS RIO Hist Tree)
include(${ROOT_USE_FILE})
#----------------------------------------------------------------------------
find_package(Geant4 REQUIRED ui_all vis_all)
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
include(CheckCXXCompilerFlag)
SET(CMAKE_CXX_FLAGS "-Wall -std=c++0x -Wno-misleading-indentation")
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
if(HAVE_FLAG_STD_CXX17)
# Have -std=c++17, use it;
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
check_cxx_compiler_flag(-std=c++11 HAVE_FLAG_STD_CXX11)
if(HAVE_FLAG_STD_CXX11)
# Have -std=c++11, use it;
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
#----------------------------------------------------------------------------
include_directories(
${Geant4_INCLUDE_DIR}
${ROOT_INCLUDE_DIRS}
${IRT}/include/IRT
${BMF}/include
${HEPMC3}/include
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/g4irt/include
)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.h )
SET(G4IRT_LIB g4irt)
SET(PFRICH_EXE pfrich)
#set(XML_EXE xmlreader)
SET( G4IRT_SRC
${PROJECT_SOURCE_DIR}/g4irt/source/G4Object.cc
${PROJECT_SOURCE_DIR}/g4irt/source/G4RadiatorMaterial.cc
${PROJECT_SOURCE_DIR}/g4irt/source/CherenkovMirror.cc
${PROJECT_SOURCE_DIR}/g4irt/source/CherenkovSteppingAction.cc
${PROJECT_SOURCE_DIR}/g4irt/source/CherenkovStackingAction.cc
)
SET( sources
${PROJECT_SOURCE_DIR}/source/TofPetMultiColumn.cc
${PROJECT_SOURCE_DIR}/source/MagneticField.cc
${PROJECT_SOURCE_DIR}/source/Materials.cc
${PROJECT_SOURCE_DIR}/source/DetectorConstruction.cc
${PROJECT_SOURCE_DIR}/source/PrimaryGeneratorAction.cc
${PROJECT_SOURCE_DIR}/source/RunAction.cc
)
SET( XML_SRC
${PROJECT_SOURCE_DIR}/source/XmlReader.cc
)
ADD_LIBRARY( ${G4IRT_LIB} SHARED ${G4IRT_SRC} )
TARGET_LINK_LIBRARIES(${G4IRT_LIB} ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} -L${IRT}/lib IRT)
#----------------------------------------------------------------------------
add_executable(${PFRICH_EXE} pfRICH.cc ${sources} ${headers})
target_link_libraries(${PFRICH_EXE} ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${G4IRT_LIB})
if(DEFINED BMF)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBMF")
target_link_libraries(${PFRICH_EXE} ${LIBNAME} -L${BMF}/lib bmf)
endif()
if(DEFINED HEPMC3)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHEPMC3")
target_link_libraries(${PFRICH_EXE} ${LIBNAME} -L${HEPMC3}/lib -L${HEPMC3}/lib64 HepMC3)
endif()
#----------------------------------------------------------------------------
add_executable( xmlreader ${XML_SRC})
target_link_libraries( xmlreader xerces-c)
#----------------------------------------------------------------------------
install(TARGETS ${PFRICH_EXE} DESTINATION bin)
install(TARGETS ${G4IRT_LIB} DESTINATION lib)