forked from A2-Collaboration/a2geant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (60 loc) · 2.92 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
# Setup the project
cmake_minimum_required(VERSION 2.6)
project(A2)
# check for in-source build, forbid it!
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "\nIn-source build attempt detected!\n"
"Please create a new directory (e.g. build) and run `cmake ..`.\n"
"Also don't forget to delete the created CMakeCache.txt and CMakeFiles dir"
)
endif()
include (cmake/settings.cmake)
message(STATUS "*** Build Type: " ${CMAKE_BUILD_TYPE})
message(STATUS "*** Compiler Flags: " ${DEFAULT_COMPILE_FLAGS})
message(STATUS "*** Install bin to: " ${EXECUTABLE_OUTPUT_PATH})
# require a fairly recent ROOT version 5.30...
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(ROOT "5.30" REQUIRED)
include_directories(${ROOT_INCLUDES})
link_directories(${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 example 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()
include_directories(${Geant4_INCLUDE_DIRS})
add_definitions(${Geant4_DEFINITIONS})
# the project header files
include_directories(${PROJECT_SOURCE_DIR}/include)
# create the "main" A2 executable, link it to Geant4 and ROOT
# explicitly list all source files, this is recommended to detect
# changes in the source file list by the build system!
add_executable(A2 src/A2.cc
src/A2CBOutput.cc src/A2CBSD.cc src/A2CryoTarget.cc
src/A2DetCherenkov.cc src/A2DetCrystalBall.cc src/A2Detector.cc
src/A2DetectorConstruction.cc src/A2DetectorMessenger.cc src/A2DetMWPC.cc
src/A2DetPID.cc src/A2DetTAPS.cc src/A2DetTOF.cc src/A2EventAction.cc
src/A2EventActionMessenger.cc src/A2Hit.cc src/A2MagneticField.cc
src/A2PhysicsList.cc src/A2PhysicsListMessenger.cc src/A2PolarizedTarget.cc
src/A2PrimaryGeneratorAction.cc src/A2PrimaryGeneratorMessenger.cc
src/A2RunAction.cc src/A2SD.cc src/A2SolidTarget.cc src/A2SteppingAction.cc
src/A2SteppingVerbose.cc src/A2Target.cc src/A2VisCBSD.cc src/A2VisHit.cc
src/A2VisSD.cc src/A2WCSD.cc)
target_link_libraries(A2 ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
# build the pluto2mkin tool
foreach(f TOGlobals TOMCMkinWriter TOMCParticle TOSUtils)
list(APPEND pluto2mkin_HEADERS "${CMAKE_SOURCE_DIR}/include/${f}.h")
list(APPEND pluto2mkin_SRCS "${CMAKE_SOURCE_DIR}/src/${f}.cxx")
endforeach()
set(pluto2mkin_DICT "${CMAKE_BINARY_DIR}/include/pluto2mkinDict.cc")
ROOT_GENERATE_DICTIONARY(
"${pluto2mkin_HEADERS}"
"${CMAKE_SOURCE_DIR}/include/LinkDef.h"
"${pluto2mkin_DICT}"
"${ROOT_INCLUDES};${CMAKE_SOURCE_DIR}/include")
add_executable(pluto2mkin src/MainPluto2Mkin.cxx ${pluto2mkin_SRCS} ${pluto2mkin_DICT})
target_link_libraries(pluto2mkin ${ROOT_LIBRARIES})