1 |
pam-ts |
1.1 |
project(PamVMC) |
2 |
|
|
cmake_minimum_required(VERSION 2.6) |
3 |
|
|
|
4 |
|
|
###### Find external packages |
5 |
|
|
# ROOT |
6 |
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH}) |
7 |
|
|
find_package(ROOT REQUIRED) |
8 |
|
|
include_directories(${ROOT_INCLUDE_DIR}) |
9 |
pam-ts |
1.2 |
|
10 |
pam-ts |
1.1 |
# GEANT4 |
11 |
|
|
find_package(Geant4 REQUIRED) |
12 |
|
|
include(${Geant4_USE_FILE}) |
13 |
|
|
|
14 |
|
|
# VGM |
15 |
|
|
find_package(VGM REQUIRED) |
16 |
|
|
|
17 |
|
|
# GEANT4VMC |
18 |
|
|
find_package(Geant4VMC REQUIRED) |
19 |
|
|
include_directories(${Geant4VMC_INCLUDE_DIRS}) |
20 |
|
|
|
21 |
|
|
# PAMELA software include directories |
22 |
|
|
include_directories($ENV{PAM_INC} $ENV{PAM_INC}/yoda) |
23 |
|
|
|
24 |
|
|
###### Adjust configuration |
25 |
|
|
# Some compiler options have been set by external packages e.g. Geant4. |
26 |
|
|
|
27 |
|
|
# Remove the -pedantic compiler option introduced by Geant4. |
28 |
|
|
# This is necessary in order to avoid to trigger an error when initializing static const float |
29 |
|
|
# variables (e.g. trk/include/PamVMCTrkDig.h:97) |
30 |
|
|
string(REPLACE " -pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
31 |
|
|
|
32 |
|
|
# Automatically recurse over linked linbraries. |
33 |
|
|
# For binutils >= 2.22 (http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2011-12/msg00257.html) |
34 |
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--copy-dt-needed-entries" ) |
35 |
|
|
|
36 |
|
|
# Mute compile warnings (i.e. remove the -Wsomething compiler options). |
37 |
|
|
# Warnigns can be shown by adding -DPAMVMC_SHOW_WARNINGS=1 to the invocation of cmake. |
38 |
|
|
if(NOT "${PAMVMC_SHOW_WARNINGS}" STREQUAL "1") |
39 |
|
|
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
40 |
|
|
string(REPLACE " -W " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
41 |
|
|
string(REPLACE " -Wno-non-virtual-dtor" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
42 |
|
|
string(REPLACE " -Wno-long-long" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
43 |
|
|
string(REPLACE " -Wwrite-strings" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
44 |
|
|
string(REPLACE " -Wpointer-arith" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
45 |
|
|
string(REPLACE " -Woverloaded-virtual" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
46 |
|
|
string(REPLACE " -Wno-variadic-macros" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
47 |
|
|
string(REPLACE " -Wshadow" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
48 |
|
|
endif() |
49 |
|
|
|
50 |
|
|
# Enable compilation of Fortran code |
51 |
|
|
enable_language(Fortran) |
52 |
|
|
|
53 |
|
|
##### PamVMC build |
54 |
|
|
# Include PamVMC directories |
55 |
|
|
include_directories(. |
56 |
|
|
include |
57 |
|
|
cal/include |
58 |
|
|
trk/include |
59 |
|
|
trk/include/f77 |
60 |
|
|
tof/include |
61 |
|
|
ac/include |
62 |
|
|
s4/include |
63 |
|
|
nd/include |
64 |
|
|
PamG4RunConfiguration |
65 |
|
|
PamG4RunConfiguration/include |
66 |
|
|
) |
67 |
|
|
|
68 |
|
|
# Build PamG4RunConfiguration library |
69 |
|
|
root_generate_dictionary(PamG4RunConfigurationDict |
70 |
|
|
PamG4RunConfiguration/include/PamG4RunConfiguration.h |
71 |
|
|
LINKDEF PamG4RunConfiguration/include/PamG4RunConfigurationLinkDef.h |
72 |
|
|
) |
73 |
|
|
add_library(PamG4RunConfiguration SHARED |
74 |
|
|
PamG4RunConfiguration/src/PamG4RegionConstruction.cxx |
75 |
|
|
PamG4RunConfiguration/src/PamG4RunConfiguration.cxx |
76 |
|
|
PamG4RunConfigurationDict.cxx |
77 |
|
|
) |
78 |
|
|
|
79 |
|
|
# Build PamVMC_fc library |
80 |
|
|
file(GLOB HDR RELATIVE ${CMAKE_SOURCE_DIR} "include/*.h") |
81 |
|
|
list(REMOVE_ITEM HDR "include/PamVMC_fcLinkDef.h") |
82 |
|
|
file(GLOB AC_HDR RELATIVE ${CMAKE_SOURCE_DIR} "ac/include/*.h") |
83 |
|
|
file(GLOB CAL_HDR RELATIVE ${CMAKE_SOURCE_DIR} "cal/include/*.h") |
84 |
|
|
file(GLOB ND_HDR RELATIVE ${CMAKE_SOURCE_DIR} "nd/include/*.h") |
85 |
|
|
file(GLOB S4_HDR RELATIVE ${CMAKE_SOURCE_DIR} "s4/include/*.h") |
86 |
|
|
file(GLOB TRK_HDR RELATIVE ${CMAKE_SOURCE_DIR} "trk/include/*.h") |
87 |
|
|
file(GLOB TOF_HDR RELATIVE ${CMAKE_SOURCE_DIR} "tof/include/*.h") |
88 |
|
|
|
89 |
|
|
root_generate_dictionary(PamVMC_fcDict |
90 |
|
|
${HDR} |
91 |
|
|
${AC_HDR} |
92 |
|
|
${CAL_HDR} |
93 |
|
|
${ND_HDR} |
94 |
|
|
${S4_HDR} |
95 |
|
|
${TRK_HDR} |
96 |
|
|
${TOF_HDR} |
97 |
|
|
LINKDEF include/PamVMC_fcLinkDef.h |
98 |
|
|
) |
99 |
|
|
|
100 |
|
|
file(GLOB SRC "src/*.cxx") |
101 |
|
|
file(GLOB AC_SRC "ac/src/*.cxx") |
102 |
|
|
file(GLOB CAL_SRC "cal/src/*.cxx") |
103 |
|
|
file(GLOB ND_SRC "nd/src/*.cxx") |
104 |
|
|
file(GLOB S4_SRC "s4/src/*.cxx") |
105 |
|
|
file(GLOB TRK_SRC "trk/src/*.cxx") |
106 |
|
|
file(GLOB TRK_FSRC "trk/src/f77/*.F") |
107 |
|
|
file(GLOB TOF_SRC "tof/src/*.cxx") |
108 |
|
|
|
109 |
|
|
set(PamVMC_fc_SOURCE |
110 |
|
|
${SRC} |
111 |
|
|
${AC_SRC} |
112 |
|
|
${CAL_SRC} |
113 |
|
|
${ND_SRC} |
114 |
|
|
${S4_SRC} |
115 |
|
|
${TRK_SRC} |
116 |
|
|
${TRK_FSRC} |
117 |
|
|
${TOF_SRC} |
118 |
|
|
PamVMC_fcDict.cxx |
119 |
|
|
) |
120 |
|
|
|
121 |
pam-fi |
1.4 |
link_directories($ENV{PAM_LIB}) |
122 |
pam-ts |
1.1 |
add_library(PamVMC_fc SHARED ${PamVMC_fc_SOURCE}) |
123 |
pam-fi |
1.4 |
target_link_libraries(PamVMC_fc |
124 |
|
|
${ROOT_LIBRARIES} |
125 |
|
|
${Geant4VMC_LIBRARIES} |
126 |
|
|
XMLParser |
127 |
|
|
gfortran |
128 |
|
|
yoda |
129 |
|
|
DarthVader |
130 |
|
|
) |
131 |
pam-ts |
1.1 |
|
132 |
|
|
# Build PamVMC.exe |
133 |
|
|
add_executable(PamVMC.exe G4main/PamVMCmain.cxx) |
134 |
|
|
target_link_libraries(PamVMC.exe |
135 |
|
|
PamVMC_fc |
136 |
|
|
PamG4RunConfiguration |
137 |
pam-ts |
1.2 |
) |
138 |
pam-fi |
1.3 |
|
139 |
|
|
# Build libPrimaryInfo.so |
140 |
|
|
include_directories(aux/spectra_generator/) |
141 |
|
|
root_generate_dictionary(PrimaryInfoDict |
142 |
|
|
aux/spectra_generator/PrimaryInfo.h |
143 |
|
|
LINKDEF aux/spectra_generator/LinkDef.h |
144 |
|
|
) |
145 |
|
|
add_library(PrimaryInfo SHARED PrimaryInfoDict.cxx) |
146 |
|
|
|
147 |
|
|
# Build sp_gen |
148 |
|
|
add_executable(sp_gen |
149 |
pam-fi |
1.4 |
aux/spectra_generator/sp_gen.C |
150 |
pam-fi |
1.3 |
) |
151 |
|
|
target_link_libraries(sp_gen |
152 |
|
|
${ROOT_LIBRARIES} |
153 |
pam-fi |
1.4 |
PamVMC_fc |
154 |
pam-fi |
1.3 |
yoda |
155 |
|
|
DarthVader |
156 |
|
|
) |
157 |
pam-ts |
1.2 |
###### Install rules |
158 |
pam-fi |
1.3 |
install(TARGETS PamVMC.exe sp_gen DESTINATION bin) |
159 |
|
|
install(TARGETS PamVMC_fc PamG4RunConfiguration PrimaryInfo DESTINATION lib) |
160 |
pam-fi |
1.4 |
install(FILES config/g4config.in config/test.dtd config/g4Config.C config/g3Config.C DESTINATION config) |
161 |
|
|
file(GLOB auxFiles "aux/parameters_l*") |
162 |
|
|
set(auxFiles ${auxFiles} aux/CalibTrk_00110_000_000.root aux/resxy_new.root) |
163 |
|
|
install(FILES ${auxFiles} DESTINATION lib/tgt_$ENV{PLATFORM}) |