6 |
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH}) |
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH}) |
7 |
find_package(ROOT REQUIRED) |
find_package(ROOT REQUIRED) |
8 |
include_directories(${ROOT_INCLUDE_DIR}) |
include_directories(${ROOT_INCLUDE_DIR}) |
9 |
|
|
10 |
# GEANT4 |
# GEANT4 |
11 |
find_package(Geant4 REQUIRED) |
find_package(Geant4 REQUIRED) |
12 |
include(${Geant4_USE_FILE}) |
include(${Geant4_USE_FILE}) |
31 |
|
|
32 |
# Automatically recurse over linked linbraries. |
# Automatically recurse over linked linbraries. |
33 |
# For binutils >= 2.22 (http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2011-12/msg00257.html) |
# 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" ) |
execute_process( |
35 |
|
COMMAND ld -v |
36 |
|
OUTPUT_VARIABLE LD_VERSION_LONG |
37 |
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
38 |
|
string(REGEX MATCH "[0-9]*\\.[0-9]*" LD_VERSION ${LD_VERSION_LONG}) |
39 |
|
if(NOT ${LD_VERSION} STRLESS "2.22") |
40 |
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--copy-dt-needed-entries" ) |
41 |
|
endif() |
42 |
|
|
43 |
# Mute compile warnings (i.e. remove the -Wsomething compiler options). |
# Mute compile warnings (i.e. remove the -Wsomething compiler options). |
44 |
# Warnigns can be shown by adding -DPAMVMC_SHOW_WARNINGS=1 to the invocation of cmake. |
# Warnigns can be shown by adding -DPAMVMC_SHOW_WARNINGS=1 to the invocation of cmake. |
125 |
PamVMC_fcDict.cxx |
PamVMC_fcDict.cxx |
126 |
) |
) |
127 |
|
|
128 |
|
link_directories($ENV{PAM_LIB}) |
129 |
add_library(PamVMC_fc SHARED ${PamVMC_fc_SOURCE}) |
add_library(PamVMC_fc SHARED ${PamVMC_fc_SOURCE}) |
130 |
|
target_link_libraries(PamVMC_fc |
131 |
|
${ROOT_LIBRARIES} |
132 |
|
${Geant4VMC_LIBRARIES} |
133 |
|
XMLParser |
134 |
|
gfortran |
135 |
|
yoda |
136 |
|
DarthVader |
137 |
|
) |
138 |
|
|
139 |
# Build PamVMC.exe |
# Build PamVMC.exe |
|
link_directories($ENV{PAM_LIB}) |
|
140 |
add_executable(PamVMC.exe G4main/PamVMCmain.cxx) |
add_executable(PamVMC.exe G4main/PamVMCmain.cxx) |
141 |
target_link_libraries(PamVMC.exe |
target_link_libraries(PamVMC.exe |
142 |
PamVMC_fc |
PamVMC_fc |
143 |
PamG4RunConfiguration |
PamG4RunConfiguration |
144 |
|
) |
145 |
|
|
146 |
|
# Build libPrimaryInfo.so |
147 |
|
include_directories(aux/spectra_generator/) |
148 |
|
root_generate_dictionary(PrimaryInfoDict |
149 |
|
aux/spectra_generator/PrimaryInfo.h |
150 |
|
LINKDEF aux/spectra_generator/LinkDef.h |
151 |
|
) |
152 |
|
add_library(PrimaryInfo SHARED PrimaryInfoDict.cxx) |
153 |
|
|
154 |
|
# Build sp_gen |
155 |
|
add_executable(sp_gen |
156 |
|
aux/spectra_generator/sp_gen.C |
157 |
|
) |
158 |
|
target_link_libraries(sp_gen |
159 |
${ROOT_LIBRARIES} |
${ROOT_LIBRARIES} |
160 |
XMLParser |
PamVMC_fc |
|
${Geant4VMC_LIBRARIES} |
|
161 |
yoda |
yoda |
162 |
DarthVader |
DarthVader |
163 |
gfortran |
) |
164 |
) |
###### Install rules |
165 |
|
install(TARGETS PamVMC.exe sp_gen DESTINATION bin) |
166 |
|
install(TARGETS PamVMC_fc PamG4RunConfiguration PrimaryInfo DESTINATION lib) |
167 |
|
install(FILES config/g4config.in config/test.dtd config/g4Config.C config/g3Config.C DESTINATION config) |
168 |
|
file(GLOB auxFiles "aux/parameters_l*") |
169 |
|
set(auxFiles ${auxFiles} aux/CalibTrk_00110_000_000.root aux/resxy_new.root) |
170 |
|
install(FILES ${auxFiles} DESTINATION lib/tgt_$ENV{PLATFORM}) |