-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (65 loc) · 2.46 KB
/
CMakeLists.txt
File metadata and controls
81 lines (65 loc) · 2.46 KB
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
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(ambe)
#----------------------------------------------------------------------------
# check MPI package...
find_package(MPI REQUIRED)
#----------------------------------------------------------------------------
# Find ROOT package, required by TGraphs and ROOT specific objects
find_package(ROOT REQUIRED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
include_directories(${ROOT_INCLUDE_DIRS})
message(${ROOT_INCLUDE_DIRS})
link_directories(${ROOT_LIBRARY_DIR})
#link_directories(${ROOT_LIBRARIES})
message(${ROOT_LIBRARY_DIR})
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
option(WITH_GEANT4_UIVIS "Build with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
find_package(G4mpi REQUIRED)
#----------------------------------------------------------------------------
# Setup ROOT include directories and compile definitions
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
link_directories(${ROOT_LIBRARY_DIR})
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${ROOT_INCLUDE_DIRS})
include_directories(${G4mpi_INCLUDE_DIR})
# We presume the existence of three directories
file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/include/*.hh)
file(GLOB_RECURSE macros RELATIVE ${PROJECT_SOURCE_DIR} macros/*.mac)
file(GLOB_RECURSE xSections RELATIVE ${PROJECT_SOURCE_DIR} AmBeData/*)
# Enable macros for out-of-source build
foreach(_file ${macros})
configure_file(
${_file}
${PROJECT_BINARY_DIR}/${_file}
COPYONLY
)
endforeach()
foreach(_file ${xSections})
configure_file(
${_file}
${PROJECT_BINARY_DIR}/${_file}
COPYONLY
)
endforeach()
#Copy script
configure_file(
${PROJECT_SOURCE_DIR}/MakePlots.cc
${PROJECT_BINARY_DIR}/MakePlots.cc
COPYONLY
)
add_executable(ambe main.cc ${sources} ${headers})
target_link_libraries(ambe ${G4mpi_LIBRARIES} ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
install(TARGETS ambe DESTINATION bin)