75 lines
2.0 KiB
CMake
75 lines
2.0 KiB
CMake
|
|
################################################################################
|
|
##### HEP/Geant - Geant4 integration library ###################################
|
|
################################################################################
|
|
|
|
if(NOT Geant4_FOUND)
|
|
message(STATUS "Geant4 not found - skipping mutomGeant library")
|
|
return()
|
|
endif()
|
|
|
|
message(STATUS "Geant4 found: ${Geant4_VERSION}")
|
|
include(${Geant4_USE_FILE})
|
|
|
|
set(HEADERS
|
|
GeantEvent.h
|
|
Matter.h
|
|
Scene.h
|
|
Solid.h
|
|
DetectorConstruction.hh
|
|
PhysicsList.hh
|
|
ActionInitialization.hh
|
|
SteppingAction.hh
|
|
SimulationContext.h
|
|
)
|
|
|
|
set(SOURCES
|
|
Scene.cpp
|
|
Solid.cpp
|
|
EmitterPrimary.cpp
|
|
DetectorConstruction.cpp
|
|
PhysicsList.cpp
|
|
ActionInitialization.cpp
|
|
SteppingAction.cpp
|
|
)
|
|
|
|
set(libname ${PACKAGE_LIBPREFIX}Geant)
|
|
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Geant PARENT_SCOPE)
|
|
|
|
add_library(${libname} SHARED ${SOURCES})
|
|
set_target_properties(${libname} PROPERTIES
|
|
VERSION ${PROJECT_VERSION}
|
|
SOVERSION ${PROJECT_SOVERSION})
|
|
|
|
target_include_directories(${libname} PRIVATE ${Geant4_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(${libname}
|
|
${PACKAGE_LIBPREFIX}Core
|
|
${PACKAGE_LIBPREFIX}Math
|
|
${PACKAGE_LIBPREFIX}Detectors
|
|
)
|
|
|
|
# Filter Geant4 libraries to remove Qt-dependent ones
|
|
set(Geant4_LIBS_FILTERED ${Geant4_LIBRARIES})
|
|
if(Geant4_LIBS_FILTERED)
|
|
list(REMOVE_ITEM Geant4_LIBS_FILTERED Geant4::G4interfaces Geant4::G4OpenGL Geant4::G4visQt3D)
|
|
endif()
|
|
|
|
target_link_libraries(${libname}
|
|
${Geant4_LIBS_FILTERED}
|
|
)
|
|
|
|
install(TARGETS ${libname}
|
|
EXPORT "uLibTargets"
|
|
RUNTIME DESTINATION ${INSTALL_BIN_DIR} COMPONENT bin
|
|
LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT lib)
|
|
|
|
install(FILES ${HEADERS}
|
|
DESTINATION ${INSTALL_INC_DIR}/HEP/Geant)
|
|
|
|
if(BUILD_TESTING)
|
|
include(uLibTargetMacros)
|
|
add_subdirectory(testing)
|
|
endif()
|