Skip to content

Commit 02c6e4d

Browse files
committed
added linking to Pluto library
1 parent c4b6297 commit 02c6e4d

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@ else()
1515
find_package(Geant4 REQUIRED)
1616
endif()
1717

18+
# define variables
19+
set(EXT_LIBRARIES)
20+
1821
# use copied CMake modules from ROOT 6
1922
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
2023

2124
# locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
22-
find_package(ROOT REQUIRED MODULE COMPONENTS MathCore RIO Hist Tree Geom)
25+
find_package(ROOT REQUIRED MODULE COMPONENTS MathCore RIO Hist Tree TreePlayer Geom EG)
26+
27+
# locate Pluto
28+
find_package(Pluto)
29+
if (Pluto_FOUND)
30+
include_directories(${Pluto_INCLUDE_DIRS})
31+
set(EXT_LIBRARIES ${EXT_LIBRARIES} ${Pluto_LIBRARIES})
32+
add_definitions(-DWITH_PLUTO)
33+
endif()
2334

2435
# define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
2536
include(${ROOT_USE_FILE})
@@ -42,7 +53,7 @@ file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
4253
# Add the executable, and link it to the Geant4 libraries
4354
#
4455
add_executable(A2Geant4 ${PROJECT_SOURCE_DIR}/src/A2.cc ${sources} ${headers})
45-
target_link_libraries(A2Geant4 ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
56+
target_link_libraries(A2Geant4 ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${EXT_LIBRARIES})
4657

4758
#----------------------------------------------------------------------------
4859
# Copy all scripts to the build directory, i.e. the directory in which we

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ August 17, 2018
4646
* ROOT 5 or 6
4747
* CMake 3.3
4848
* Optional: Qt 4 or 5
49+
* Optional: Pluto 6 (only with ROOT 6, $PLUTOSYS needs to be set)
4950

5051
### Installation
5152

cmake/FindPluto.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# - Try to find Pluto
2+
# Once done this will define
3+
# Pluto_FOUND - System has Pluto
4+
# Pluto_INCLUDE_DIRS - The Pluto include directories
5+
# Pluto_LIBRARIES - The libraries needed to use Pluto
6+
7+
Set(Pluto_SEARCHPATH
8+
$ENV{PLUTOSYS}
9+
)
10+
11+
find_library(Pluto_LIBRARY NAMES Pluto PATHS ${Pluto_SEARCHPATH} PATH_SUFFIXES lib)
12+
find_path(Pluto_INCLUDE_DIR NAMES PParticle.h PATHS ${Pluto_SEARCHPATH}/.. PATH_SUFFIXES include)
13+
14+
include(FindPackageHandleStandardArgs)
15+
# handle the QUIETLY and REQUIRED arguments and set Pluto_FOUND to TRUE
16+
# if all listed variables are TRUE
17+
find_package_handle_standard_args(Pluto DEFAULT_MSG
18+
Pluto_LIBRARY Pluto_INCLUDE_DIR)
19+
20+
mark_as_advanced(Pluto_INCLUDE_DIR Pluto_LIBRARY)
21+
22+
set(Pluto_LIBRARIES ${Pluto_LIBRARY} )
23+
set(Pluto_INCLUDE_DIRS ${Pluto_INCLUDE_DIR} )

0 commit comments

Comments
 (0)