#---------------------------------------------------------------------------- # Setup the project cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(CPPsimulation) #---------------------------------------------------------------------------- # Find Geant4 package, activating all available Vis drivers by default # You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui # to build a batch mode only executable # option(WITH_GEANT4_VIS "Build CPPsim with Geant4 Vis drivers" ON) if(WITH_GEANT4_VIS) find_package(Geant4 REQUIRED gdml vis_all) else() find_package(Geant4 REQUIRED gdml) endif() #---------------------------------------------------------------------------- # Setup Geant4 include directories and compile definitions # include(${Geant4_USE_FILE}) if(APPLE) set (CMAKE_EXE_LINKER_FLAGS "-undefined dynamic_lookup") endif() #---------------------------------------------------------------------------- # Locate sources and headers for this project # include_directories(${PROJECT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR}) file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc) file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh) #---------------------------------------------------------------------------- # Add DANA include_directories($ENV{HALLD_HOME}/$ENV{BMS_OSNAME}/include) link_directories($ENV{HALLD_HOME}/$ENV{BMS_OSNAME}/lib ) #---------------------------------------------------------------------------- # Add JANA execute_process(COMMAND $ENV{JANA_HOME}/bin/jana-config --cflags OUTPUT_VARIABLE JANACFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND $ENV{JANA_HOME}/bin/jana-config --libs OUTPUT_VARIABLE JANALIBS OUTPUT_STRIP_TRAILING_WHITESPACE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${JANACFLAGS} -Wno-shadow -Wno-unused-parameter") #---------------------------------------------------------------------------- # Add CCDB include_directories($ENV{CCDB_HOME}/include) link_directories($ENV{CCDB_HOME}/lib ) #---------------------------------------------------------------------------- # Add ROOT execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --cflags OUTPUT_VARIABLE ROOTCFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --glibs OUTPUT_VARIABLE ROOTLIBS OUTPUT_STRIP_TRAILING_WHITESPACE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOTCFLAGS}") set(ROOTLIBS "${ROOTLIBS} -lGeom -lTMVA") #---------------------------------------------------------------------------- # Add the EVIO and ET libraries if evironment variables are set # set (CODALIBS "") if(DEFINED ENV{EVIOROOT}) link_directories($ENV{EVIOROOT}/lib) set(CODALIBS "${CODALIBS} -levio -levioxx") endif() if(DEFINED ENV{ETROOT}) link_directories($ENV{ETROOT}/$ENV{ARCH}/lib) set(CODALIBS "${CODALIBS} -let -lcodaChannels") endif() if(DEFINED ENV{CODA}) link_directories($ENV{CODA}/$ENV{ARCH}/lib) endif() string(STRIP "${CODALIBS}" CODALIBS) #---------------------------------------------------------------------------- # Add the executable, and link it to the Geant4 libraries # add_executable(CPPsim CPPsim.cc ${sources} ${headers}) target_link_libraries(CPPsim ${Geant4_LIBRARIES} ) target_link_libraries(CPPsim DANA ANALYSIS BCAL CCAL CDC CERE FCAL FDC HDDM PID DIRC START_COUNTER TAGGER TOF TRACKING TRIGGER HDGEOMETRY PAIR_SPECTROMETER KINFITTER EVENTSTORE DAQ TTAB RF TPOL FMWPC xstream bz2) target_link_libraries(CPPsim ${JANALIBS} ${ROOTLIBS} ${CODALIBS} -lccdb) #---------------------------------------------------------------------------- # Copy all scripts to the build directory, i.e. the directory in which we # build G01. This is so that we can run the executable directly because it # relies on these scripts being in the current working directory. # set(CPPsim_SCRIPTS vis.mac cpproot.gdml run_cmake ) foreach(_script ${CPPsim_SCRIPTS}) configure_file( ${PROJECT_SOURCE_DIR}/${_script} ${PROJECT_BINARY_DIR}/${_script} COPYONLY ) endforeach() #---------------------------------------------------------------------------- # Add program to the project targets # (this avoids the need of typing the program name after make) # add_custom_target(CPPsimulation DEPENDS CPPsim) #---------------------------------------------------------------------------- # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX # #install(TARGETS load_gdml DESTINATION bin)