Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -1,197 +0,0 @@
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ROOT_FOUND If the ROOT is found
|
||||
# ROOT_INCLUDE_DIR PATH to the include directory (deprecated)
|
||||
# ROOT_INCLUDE_DIRS PATH to the include directory
|
||||
# ROOT_LIBRARIES Most common libraries
|
||||
# ROOT_LIBRARY_DIR PATH to the library directory
|
||||
# ROOT_BIN_DIR PATH to the excutables directory
|
||||
# ROOT_PYTHONVER Compatible python version string
|
||||
|
||||
# First search for ROOTConfig.cmake on the path defined via user setting
|
||||
# ROOT_DIR
|
||||
|
||||
if(EXISTS ${ROOT_DIR}/ROOTConfig.cmake)
|
||||
include(${ROOT_DIR}/ROOTConfig.cmake)
|
||||
message(STATUS "Found ROOT CMake configuration in ${ROOT_DIR}")
|
||||
set(ROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIRS})
|
||||
set(ROOT_FOUND TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_program(ROOT_CONFIG_EXECUTABLE root-config
|
||||
PATHS ${ROOTSYS}/bin $ENV{ROOTSYS}/bin)
|
||||
|
||||
if(NOT ROOT_CONFIG_EXECUTABLE)
|
||||
set(ROOT_FOUND FALSE)
|
||||
else()
|
||||
set(ROOT_FOUND TRUE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
|
||||
OUTPUT_VARIABLE ROOTSYS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ROOT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
|
||||
OUTPUT_VARIABLE ROOT_INCLUDE_DIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --libs
|
||||
OUTPUT_VARIABLE ROOT_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --python-version
|
||||
OUTPUT_VARIABLE ROOT_PYTHONVER
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --bindir
|
||||
OUTPUT_VARIABLE ROOT_BIN_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
|
||||
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
|
||||
set(ROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIRS})
|
||||
|
||||
# Make variables changeble to the advanced user
|
||||
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
if(NOT ROOT_FIND_QUIETLY)
|
||||
message(STATUS "Found ROOT ${ROOT_VERSION} in ${ROOTSYS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT ROOT_FOUND)
|
||||
if (ROOT_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "ROOT required, but not found")
|
||||
endif (ROOT_FIND_REQUIRED)
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments)
|
||||
find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
|
||||
find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin)
|
||||
find_package(GCCXML)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function ROOT_GENERATE_DICTIONARY( dictionary
|
||||
# header1 header2 ...
|
||||
# LINKDEF linkdef1 ...
|
||||
# OPTIONS opt1...)
|
||||
function(ROOT_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
if(NOT f MATCHES LinkDef)
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get the list of include directories------------------
|
||||
# Filter out UNIX system directory to workaround bug in
|
||||
# rootcint (info from Andrea Dotti, and info from post:
|
||||
# http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=15086
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
if(NOT ${d} STREQUAL "/usr/include")
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get LinkDef.h file------------------------------------
|
||||
set(linkdefs)
|
||||
foreach( f ${ARG_LINKDEF})
|
||||
if( IS_ABSOLUTE ${f})
|
||||
set(linkdefs ${linkdefs} ${f})
|
||||
else()
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
|
||||
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
|
||||
else()
|
||||
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/${f})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
#---call rootcint------------------------------------------
|
||||
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
|
||||
COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx
|
||||
-c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
|
||||
DEPENDS ${headerfiles} ${linkdefs})
|
||||
endfunction()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function REFLEX_GENERATE_DICTIONARY(dictionary
|
||||
# header1 header2 ...
|
||||
# SELECTION selectionfile ...
|
||||
# OPTIONS opt1...)
|
||||
function(REFLEX_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "SELECTION;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get Selection file------------------------------------
|
||||
if(IS_ABSOLUTE ${ARG_SELECTION})
|
||||
set(selectionfile ${ARG_SELECTION})
|
||||
else()
|
||||
set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION})
|
||||
endif()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get preprocessor definitions--------------------------
|
||||
get_directory_property(defs COMPILE_DEFINITIONS)
|
||||
foreach( d ${defs})
|
||||
set(definitions ${definitions} -D${d})
|
||||
endforeach()
|
||||
#---Names and others---------------------------------------
|
||||
set(gensrcdict ${dictionary}.cpp)
|
||||
if(MSVC)
|
||||
set(gccxmlopts "--gccxmlopt=\"--gccxml-compiler cl\"")
|
||||
elseif(APPLE)
|
||||
set(gccxmlopts "--gccxmlopt=--gccxml-compiler g++ ")
|
||||
else()
|
||||
set(gccxmlopts)
|
||||
endif()
|
||||
#set(rootmapname ${dictionary}Dict.rootmap)
|
||||
#set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
|
||||
#---Check GCCXML and get path-----------------------------
|
||||
if(GCCXML)
|
||||
get_filename_component(gccxmlpath ${GCCXML} PATH)
|
||||
else()
|
||||
message(WARNING "GCCXML not found. Install and setup your environment to find 'gccxml' executable")
|
||||
endif()
|
||||
#---Actual command----------------------------------------
|
||||
add_custom_command(OUTPUT ${gensrcdict} ${rootmapname}
|
||||
COMMAND ${GENREFLEX_EXECUTABLE} ${headerfiles} -o ${gensrcdict} ${gccxmlopts} ${rootmapopts} --select=${selectionfile}
|
||||
--gccxmlpath=${gccxmlpath} ${ARG_OPTIONS} ${includedirs} ${definitions}
|
||||
DEPENDS ${headerfiles} ${selectionfile})
|
||||
endfunction()
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#
|
||||
# STATTEST_FOUND - Application found
|
||||
# STATTEST_APP - Application
|
||||
# STATTEST_CMD - Command line to run the application
|
||||
# STATTEST_ADD_TEST - Helper function to define a ctest using
|
||||
# STATTEST_CMD - Command line to run the application
|
||||
# STATTEST_ADD_TEST - Helper function to define a ctest using
|
||||
# StatTest (Only if we are using for G4 testing)
|
||||
#
|
||||
# Variables used by this module, which can change the default behaviour
|
||||
@@ -14,6 +14,13 @@
|
||||
#
|
||||
# STATTEST_ROOT_DIR Root directory to StatTest package
|
||||
#
|
||||
|
||||
if(NOT GEANT4_ENABLE_TESTING)
|
||||
#No meaning for this if not testing
|
||||
SET(STATTEST_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
#Search application
|
||||
#Note that the second suggested path is G4 specific...
|
||||
find_path(STATTEST_APP_DIR
|
||||
@@ -23,7 +30,7 @@ find_path(STATTEST_APP_DIR
|
||||
)
|
||||
|
||||
#If we didn't find it there, fall back to some standard search paths
|
||||
find_path(STATTEST_APP_DIR NAMES StatTest/StatTestVersion.py)
|
||||
find_path(STATTEST_APP_DIR NAMES StatTestVersion.py)
|
||||
|
||||
####
|
||||
#### Run-time dependencies...
|
||||
@@ -32,102 +39,101 @@ find_path(STATTEST_APP_DIR NAMES StatTest/StatTestVersion.py)
|
||||
find_package(ROOT QUIET)
|
||||
if(NOT ROOT_FOUND)
|
||||
MESSAGE(STATUS "StatTest: ROOT package not found --> StatTest package disabled")
|
||||
set(STATTEST_FOUND FALSE)
|
||||
set(_root_isok FALSE)
|
||||
else()
|
||||
set(_root_isok TRUE)
|
||||
# - Check if python interpreter is correct version
|
||||
# (the one compatible with root)
|
||||
find_package(PythonInterp ${ROOT_PYTHONVER} QUIET)
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
MESSAGE(STATUS "StatTest: Python interpreter of version ${ROOT_PYTHONVER} not found --> StatTest package disabled")
|
||||
set(STATTEST_FOUND FALSE)
|
||||
set(_python_isok FALSE)
|
||||
else()
|
||||
set(STATTEST_FOUND TRUE)
|
||||
set(_python_isok TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - Check if python interpreter is correct version
|
||||
# (the one compatible with root)
|
||||
find_package(PythonInterp ${ROOT_PYTHONVER} QUIET)
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
MESSAGE(STATUS "StatTest: Python interpreter of version ${ROOT_PYTHONVER} not found --> StatTest package disabled")
|
||||
set(_python_isok FALSE)
|
||||
else()
|
||||
set(_python_isok TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
StatTest
|
||||
DEFAULT_MSG
|
||||
STATTEST_APP_DIR
|
||||
_root_isok
|
||||
_python_isok
|
||||
StatTest
|
||||
DEFAULT_MSG
|
||||
STATTEST_APP_DIR
|
||||
_root_isok
|
||||
_python_isok
|
||||
)
|
||||
|
||||
|
||||
if(STATTEST_FOUND)
|
||||
set(STATTEST_APP ${STATTEST_APP_DIR}/runtests.py)
|
||||
set(STATTEST_CMD ${PYTHON_EXECUTABLE} ${STATTEST_APP})
|
||||
|
||||
if(GEANT4_ENABLE_TESTING)
|
||||
# Let's create a function that helps in building tests for
|
||||
# regression testing
|
||||
# function STATTEST_ADD_TEST(<name>
|
||||
# G4TEST testname
|
||||
# CONFIG conffile
|
||||
# INPUT inputfile
|
||||
# [DEBUG]
|
||||
# [TEXT] #Input is text file instead of root
|
||||
# [REFERENCE reference]
|
||||
# [LABELS label1 label2 ...]
|
||||
# [IMG filename])
|
||||
function(STATTEST_ADD_TEST stattest)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;TEXT"
|
||||
# Let's create a function that helps in building tests for
|
||||
# regression testing
|
||||
# function STATTEST_ADD_TEST(<name>
|
||||
# G4TEST testname
|
||||
# CONFIG conffile
|
||||
# INPUT inputfile
|
||||
# [DEBUG]
|
||||
# [TEXT] #Input is text file instead of root
|
||||
# [REFERENCE reference]
|
||||
# [LABELS label1 label2 ...]
|
||||
# [IMG filename])
|
||||
function(STATTEST_ADD_TEST stattest)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;TEXT"
|
||||
"CONFIG;INPUT;REFERENCE;G4TEST;IMG"
|
||||
"LABELS" ${ARGN}
|
||||
)
|
||||
|
||||
#check mandatory arguments
|
||||
list(LENGTH ARG_CONFIG _len)
|
||||
if(_len LESS 1)
|
||||
)
|
||||
#check mandatory arguments
|
||||
list(LENGTH ARG_CONFIG _len)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: conffile is mandatory")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(LENGTH ARG_INPUT _len)
|
||||
if(_len LESS 1)
|
||||
list(LENGTH ARG_INPUT _len)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: inputfile is mandatory")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(LENGTH ARG_G4TEST _len)
|
||||
if(_len LESS 1)
|
||||
list(LENGTH ARG_G4TEST _len)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: testname is mandatory")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#Set basic command line
|
||||
if(ARG_IMG)
|
||||
#Set basic command line
|
||||
if(ARG_IMG)
|
||||
set(_command ${STATTEST_CMD} -g ${ARG_IMG})
|
||||
else()
|
||||
else()
|
||||
set(_command ${STATTEST_CMD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ARG_TEXT)
|
||||
set(_command ${_command} "-T")
|
||||
endif()
|
||||
if(ARG_TEXT)
|
||||
set(_command ${_command} "-T")
|
||||
endif()
|
||||
|
||||
#Mandatory parameters
|
||||
set(_command ${_command} ${ARG_CONFIG} ${ARG_INPUT})
|
||||
if(ARG_REFERENCE)
|
||||
#Mandatory parameters
|
||||
set(_command ${_command} ${ARG_CONFIG} ${ARG_INPUT})
|
||||
if(ARG_REFERENCE)
|
||||
set(_command ${_command} ${ARG_REFERENCE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ARG_LABELS)
|
||||
if(ARG_LABELS)
|
||||
set(_labels ${ARG_LABELS})
|
||||
else()
|
||||
else()
|
||||
set(_labels "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(Geant4CTest)
|
||||
include(Geant4CTest)
|
||||
|
||||
#Now build G4 test
|
||||
GEANT4_ADD_TEST(${stattest}
|
||||
#Now build G4 test
|
||||
GEANT4_ADD_TEST(${stattest}
|
||||
COMMAND ${_command}
|
||||
DEPENDS ${ARG_G4TEST}
|
||||
LABELS ${_labels}
|
||||
)
|
||||
endfunction()
|
||||
endif(GEANT4_ENABLE_TESTING)
|
||||
endfunction()
|
||||
endif(STATTEST_FOUND)
|
||||
|
||||
mark_as_advanced(STATTEST_APP_DIR)
|
||||
|
||||
@@ -155,6 +155,8 @@ enum_option(GEANT4_BUILD_CXXSTD
|
||||
|
||||
string(REGEX REPLACE "^c\\+\\+" "" GEANT4_BUILD_CXXSTD "${GEANT4_BUILD_CXXSTD}")
|
||||
mark_as_advanced(GEANT4_BUILD_CXXSTD)
|
||||
geant4_add_feature(GEANT4_BUILD_CXXSTD "Compiling against C++ Standard '${GEANT4_BUILD_CXXSTD}'")
|
||||
|
||||
|
||||
# Require at least C++11 with no extensions and the following features
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
@@ -306,6 +308,24 @@ if(GEANT4_BUILD_VERBOSE_CODE)
|
||||
add_definitions(-DG4VERBOSE)
|
||||
endif()
|
||||
|
||||
#.rst:
|
||||
# - ``GEANT4_BUILD_MUONIC_ATOMS_IN_USE`` (Default: OFF)
|
||||
#
|
||||
# - Switched off by default to improve performance when not using
|
||||
# Muonic Atom code. It should be switched on if the project requires
|
||||
# support for Muonic Atoms.
|
||||
# Mark as advanced because most users should not need to worry about it
|
||||
#
|
||||
option(GEANT4_BUILD_MUONIC_ATOMS_IN_USE
|
||||
"Enable turning on some if statements in track and event code. Switch on if using new Muonic Atom code."
|
||||
OFF)
|
||||
mark_as_advanced(GEANT4_BUILD_MUONIC_ATOMS_IN_USE)
|
||||
|
||||
# TODO: Migrate this to header
|
||||
if(GEANT4_BUILD_MUONIC_ATOMS_IN_USE)
|
||||
add_definitions(-DG4MUATOMS_INUSE)
|
||||
endif()
|
||||
|
||||
#.rst:
|
||||
# - ``GEANT4_BUILD_MSVC_MP`` (Windows only, Default: OFF)
|
||||
#
|
||||
@@ -324,7 +344,6 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Library Mode and Link Options
|
||||
|
||||
@@ -114,25 +114,20 @@ endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# - Examples build/install
|
||||
# NB: Build of examples is a *testing* proceedure. It is *not* intended
|
||||
# that examples be built and installed as part of a full Geant4 install.
|
||||
option(GEANT4_BUILD_EXAMPLES "Build all the examples of the project" OFF)
|
||||
GEANT4_ADD_FEATURE(GEANT4_BUILD_EXAMPLES "Build all the examples of the project")
|
||||
mark_as_advanced(GEANT4_BUILD_EXAMPLES)
|
||||
# ON by default for end users. Developers can switch this OFF if they
|
||||
# need to save time/space
|
||||
option(GEANT4_INSTALL_EXAMPLES "Install code and documentation for Geant4 examples" ON)
|
||||
mark_as_advanced(GEANT4_INSTALL_EXAMPLES)
|
||||
|
||||
if(GEANT4_BUILD_EXAMPLES)
|
||||
set(Geant4_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Current build directory")
|
||||
add_subdirectory(examples)
|
||||
if(GEANT4_INSTALL_EXAMPLES)
|
||||
install(DIRECTORY examples
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Geant4-${Geant4_VERSION}
|
||||
COMPONENT Examples
|
||||
PATTERN "CVS" EXCLUDE
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
|
||||
# - Install example code to datarootdir
|
||||
install(DIRECTORY examples
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Geant4-${Geant4_VERSION}
|
||||
COMPONENT Examples
|
||||
PATTERN "CVS" EXCLUDE
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# - CPack-aging
|
||||
include(Geant4CPackBase)
|
||||
|
||||
@@ -160,12 +160,9 @@ set(CMAKE_MODULE_PATH \${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||
# Geant4 data used in build tree
|
||||
geant4_export_datasets(BUILD GEANT4_DATASET_DESCRIPTIONS)
|
||||
|
||||
# Export targets from the build tree. We rely on the GEANT4_EXPORTED_TARGETS
|
||||
# global property to list these for us.
|
||||
#
|
||||
get_property(__geant4_exported_targets GLOBAL PROPERTY GEANT4_EXPORTED_TARGETS)
|
||||
|
||||
export(TARGETS ${__geant4_exported_targets}
|
||||
# Export targets in the Geant4LibraryDepends export set from the build tree
|
||||
# No longer need GEANT4_EXPORTED_TARGETS global property to list these for us.
|
||||
export(EXPORT Geant4LibraryDepends
|
||||
FILE ${PROJECT_BINARY_DIR}/Geant4LibraryDepends.cmake
|
||||
)
|
||||
|
||||
@@ -190,7 +187,7 @@ configure_file(
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
foreach(_mod AIDA HepMC Pythia6 ROOT StatTest TBB)
|
||||
foreach(_mod AIDA HepMC Pythia6 StatTest TBB)
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/Find${_mod}.cmake
|
||||
${PROJECT_BINARY_DIR}/Modules/Find${_mod}.cmake
|
||||
|
||||
@@ -531,7 +531,7 @@ macro(_g4tc_configure_tc_variables SHELL_FAMILY SCRIPT_NAME)
|
||||
# Derive base dir from include path, NB, not 100% robust as Geant4GNUmake makes
|
||||
# significant assumptions about how USolids was installed
|
||||
get_filename_component(_USOLIDS_INCLUDE_DIR "${USOLIDS_INCLUDE_DIRS}" REALPATH)
|
||||
get_filename_component(_USOLIDS_BASE_DIR "${_USOLIDS_INCLUDE_DIR}" DIRECTORY)
|
||||
get_filename_component(_USOLIDS_BASE_DIR "${VECGEOM_INSTALL_DIR}" REALPATH)
|
||||
_g4tc_setenv_command(GEANT4_TC_USOLIDS_BASE_DIR ${SHELL_FAMILY} USOLIDS_BASE_DIR "${_USOLIDS_BASE_DIR}")
|
||||
|
||||
if(GEANT4_USE_ALL_USOLIDS)
|
||||
@@ -562,14 +562,6 @@ macro(_g4tc_configure_tc_variables SHELL_FAMILY SCRIPT_NAME)
|
||||
if(GEANT4_USE_QT)
|
||||
_g4tc_setenv_command(GEANT4_TC_QTHOME ${SHELL_FAMILY} QTHOME ${G4QTHOME})
|
||||
_g4tc_setenv_command(GEANT4_TC_QTLIBPATH ${SHELL_FAMILY} QTLIBPATH ${G4QTLIBPATH})
|
||||
if(QT4_FOUND)
|
||||
set(GEANT4_TC_QTLIBS "#Geant4Make automatically handles QTLIBS for Qt4")
|
||||
set(GEANT4_TC_GLQTLIBS "#Geant4Make automatically handles GLQTLIBS for Qt4")
|
||||
else()
|
||||
_g4tc_setenv_command(GEANT4_TC_QTLIBS ${SHELL_FAMILY} QTLIBS "\"-L${G4QTLIBPATH} ${G4QTLIBLIST}\"")
|
||||
_g4tc_setenv_command(GEANT4_TC_GLQTLIBS ${SHELL_FAMILY} GLQTLIBS "\"-L${G4QTLIBPATH} ${G4GLQTLIBLIST}\"")
|
||||
endif()
|
||||
|
||||
_g4tc_setenv_command(GEANT4_TC_G4UI_USE_QT ${SHELL_FAMILY} G4UI_USE_QT 1)
|
||||
_g4tc_setenv_command(GEANT4_TC_G4VIS_USE_OPENGLQT ${SHELL_FAMILY} G4VIS_USE_OPENGLQT 1)
|
||||
|
||||
|
||||
@@ -123,6 +123,13 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
set(G4_BUILTWITH_MULTITHREADING "no")
|
||||
endif()
|
||||
|
||||
# - Muonic Atom support
|
||||
if(GEANT4_BUILD_MUONIC_ATOMS_IN_USE)
|
||||
set(G4_BUILTWITH_MUONIC_ATOMS "yes")
|
||||
else()
|
||||
set(G4_BUILTWITH_MUONIC_ATOMS "no")
|
||||
endif()
|
||||
|
||||
# - CLHEP
|
||||
if(GEANT4_USE_SYSTEM_CLHEP)
|
||||
set(G4_BUILTWITH_CLHEP "no")
|
||||
@@ -204,6 +211,13 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
set(G4_BUILTWITH_FREETYPE "no")
|
||||
endif()
|
||||
|
||||
# - Freetype
|
||||
if(GEANT4_USE_HDF5)
|
||||
set(G4_BUILTWITH_HDF5 "yes")
|
||||
else()
|
||||
set(G4_BUILTWITH_HDF5 "no")
|
||||
endif()
|
||||
|
||||
# - Qt
|
||||
if(GEANT4_USE_QT)
|
||||
set(G4_BUILTWITH_QT "yes")
|
||||
|
||||
@@ -307,16 +307,21 @@ macro(geant4_library_target)
|
||||
set_target_properties(${G4LIBTARGET_NAME}
|
||||
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
# Always use '@rpath' in install names of libraries. This is the
|
||||
# most flexible mechanism for
|
||||
# Use '@rpath' in install names of libraries on macOS to provide relocatibility
|
||||
set_target_properties(${G4LIBTARGET_NAME}
|
||||
PROPERTIES MACOSX_RPATH 1
|
||||
)
|
||||
# Add '@loader_path' to INSTALL_RPATH on macOS so that Geant4
|
||||
# libraries self-locate each other whilst remaining relocatable
|
||||
if(APPLE)
|
||||
set_property(TARGET ${G4LIBTARGET_NAME}
|
||||
APPEND PROPERTY INSTALL_RPATH "@loader_path"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Install the library - note the use of RUNTIME, LIBRARY and ARCHIVE
|
||||
# this helps with later DLL builds.
|
||||
# Export to standard depends file for later install
|
||||
# NEEDS WORK TO REMOVE HARDCODED LIB/BIN DIR
|
||||
install(TARGETS ${G4LIBTARGET_NAME}
|
||||
EXPORT Geant4LibraryDepends
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
|
||||
|
||||
@@ -18,31 +18,31 @@ geant4_add_dataset(
|
||||
# - Low energy electromagnetics
|
||||
geant4_add_dataset(
|
||||
NAME G4EMLOW
|
||||
VERSION 6.54
|
||||
VERSION 7.3
|
||||
FILENAME G4EMLOW
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4LEDATA
|
||||
MD5SUM 9d9b5207861fbed0aebddb7f89384151
|
||||
MD5SUM 0446e7f53af993343956e5d3900157b8
|
||||
)
|
||||
|
||||
# - Photon evaporation
|
||||
geant4_add_dataset(
|
||||
NAME PhotonEvaporation
|
||||
VERSION 5.0
|
||||
VERSION 5.2
|
||||
FILENAME G4PhotonEvaporation
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4LEVELGAMMADATA
|
||||
MD5SUM d796cc6d8c65d010f8f0e1641408b89d
|
||||
MD5SUM 37c5dea9614a07885050350d071a6973
|
||||
)
|
||||
|
||||
# - Radioisotopes
|
||||
geant4_add_dataset(
|
||||
NAME RadioactiveDecay
|
||||
VERSION 5.1.1
|
||||
VERSION 5.2
|
||||
FILENAME G4RadioactiveDecay
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4RADIOACTIVEDATA
|
||||
MD5SUM d298454d2217359b7b3d1050c9ac34fc
|
||||
MD5SUM e035ed77e12be3a69c2d32806d1b5cde
|
||||
)
|
||||
|
||||
# - Neutron XS
|
||||
@@ -88,20 +88,20 @@ geant4_add_dataset(
|
||||
# - ABLA
|
||||
geant4_add_dataset(
|
||||
NAME G4ABLA
|
||||
VERSION 3.0
|
||||
VERSION 3.1
|
||||
FILENAME G4ABLA
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4ABLADATA
|
||||
MD5SUM d7049166ef74a592cb97df0ed4b757bd
|
||||
MD5SUM 180f1f5d937733b207f8d5677f76296e
|
||||
)
|
||||
|
||||
# - ENSDFSTATE
|
||||
geant4_add_dataset(
|
||||
NAME G4ENSDFSTATE
|
||||
VERSION 2.1
|
||||
VERSION 2.2
|
||||
FILENAME G4ENSDFSTATE
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4ENSDFSTATEDATA
|
||||
MD5SUM 95d970b97885aeafaa8909f29997b0df
|
||||
MD5SUM 495439cf600225753d7bd99825e5c6bc
|
||||
)
|
||||
|
||||
|
||||
@@ -106,8 +106,6 @@ if(GEANT4_USE_QT)
|
||||
set(QT_USE_FILE "${PROJECT_BINARY_DIR}/Geant4UseQt5.cmake")
|
||||
configure_file("${Qt5_USE_FILE_IN}" "${QT_USE_FILE}" @ONLY)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
|
||||
set(G4QTLIBLIST "-lQt5PrintSupport -lQt5Widgets -lQt5Gui -lQt5Core")
|
||||
set(G4GLQTLIBLIST "-lQt5OpenGL ${G4QTLIBLIST}")
|
||||
else()
|
||||
unset(Qt5Core_DIR CACHE)
|
||||
unset(Qt5Gui_DIR CACHE)
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
# ZLIB - Control use of internal G4zlib, or locate external ZLIB
|
||||
# GDML - Requires external XercesC
|
||||
# G3TOG4 - UNIX only
|
||||
# USOLIDS - Allow use of USolids classes in geometry, and must find
|
||||
# external USolids install
|
||||
# USOLIDS - Allow use of VecGeom classes in geometry, and must find
|
||||
# external VecGeom install
|
||||
# FREETYPE - For analysis module, find external FreeType install
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -113,8 +113,24 @@ else()
|
||||
option(GEANT4_USE_SYSTEM_EXPAT "Use system Expat library" ON)
|
||||
|
||||
if(GEANT4_USE_SYSTEM_EXPAT)
|
||||
# If system package requested, make damn sure we find it
|
||||
# If system package requested, find it or fail
|
||||
find_package(EXPAT REQUIRED)
|
||||
|
||||
# Check version requirement externally to provide information
|
||||
# on using internal expat.
|
||||
if(${EXPAT_VERSION_STRING} VERSION_LESS "2.0.1")
|
||||
set(__badexpat_include_dir ${EXPAT_INCLUDE_DIR})
|
||||
set(__badexpat_library ${EXPAT_LIBRARY})
|
||||
unset(EXPAT_FOUND)
|
||||
unset(EXPAT_INCLUDE_DIR CACHE)
|
||||
unset(EXPAT_LIBRARY CACHE)
|
||||
message(FATAL_ERROR
|
||||
"Detected system expat header and library:
|
||||
EXPAT_INCLUDE_DIR = ${__badexpat_include_dir}
|
||||
EXPAT_LIBRARY = ${__badexpat_library}
|
||||
are of insufficient version '${EXPAT_VERSION_STRING}' (Required >= 2.0.1)
|
||||
Set the above CMake variables to point to an expat install of the required version, or set GEANT4_USE_SYSTEM_EXPAT to OFF to use Geant4's packaged version.")
|
||||
endif()
|
||||
else()
|
||||
set(EXPAT_FOUND TRUE)
|
||||
set(GEANT4_USE_BUILTIN_EXPAT TRUE)
|
||||
@@ -191,18 +207,21 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Optional support for USolids - Requires USolids package
|
||||
# Optional support for VecGeom - Requires VecGeom package
|
||||
# GEANT4_USE_USOLIDS is a list argument which must take values:
|
||||
# - Empty/CMake boolean false : DEFAULT, do not replace G4 solids with USolids
|
||||
# - ALL/CMake boolean true : Replace all G4 solids with USolids
|
||||
# - List : Replace listed G4 solids with Usolids equivalents. Valid elements are
|
||||
# - Empty/CMake boolean false : DEFAULT, do not replace G4 solids with VecGeom
|
||||
# - ALL/CMake boolean true : Replace all G4 solids with VecGeom
|
||||
# - List : Replace listed G4 solids with VecGeom equivalents. Valid elements are
|
||||
set(GEANT4_USOLIDS_SHAPES
|
||||
BOX
|
||||
CONS
|
||||
CTUBS
|
||||
EXTRUDEDSOLID
|
||||
HYPE
|
||||
GENERICPOLYCONE
|
||||
GENERICTRAP
|
||||
ORB
|
||||
PARA
|
||||
PARABOLOID
|
||||
POLYCONE
|
||||
POLYHEDRA
|
||||
@@ -214,7 +233,7 @@ set(GEANT4_USOLIDS_SHAPES
|
||||
TUBS
|
||||
)
|
||||
|
||||
set(GEANT4_USE_USOLIDS OFF CACHE STRING "EXPERIMENTAL: List Geant4 solids to replace with USolids equivalents (ALL;${GEANT4_USOLIDS_SHAPES})")
|
||||
set(GEANT4_USE_USOLIDS OFF CACHE STRING "EXPERIMENTAL: List Geant4 solids to replace with VecGeom equivalents (ALL;${GEANT4_USOLIDS_SHAPES})")
|
||||
mark_as_advanced(GEANT4_USE_USOLIDS)
|
||||
|
||||
# - Must be a CMake list - no real way to enforce this
|
||||
@@ -242,28 +261,28 @@ if(NOT GEANT4_USE_ALL_USOLIDS AND GEANT4_USE_USOLIDS)
|
||||
endif()
|
||||
|
||||
|
||||
# - G4USolids setup
|
||||
# - Geant4 USolids/VecGom setup
|
||||
if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
|
||||
find_package(USolids REQUIRED)
|
||||
find_package(VecGeom REQUIRED)
|
||||
|
||||
if(GEANT4_USE_ALL_USOLIDS)
|
||||
set(GEANT4_USOLIDS_COMPILE_DEFINITIONS "-DG4GEOM_USE_USOLIDS")
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing all Geant4 solids with USolids equivalents (EXPERIMENTAL)")
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing Geant4 solids with all VecGeom equivalents (EXPERIMENTAL)")
|
||||
else()
|
||||
set(GEANT4_USOLIDS_COMPILE_DEFINITIONS "-DG4GEOM_USE_PARTIAL_USOLIDS")
|
||||
foreach(__g4_usolid_shape ${GEANT4_USE_PARTIAL_USOLIDS_SHAPE_LIST})
|
||||
list(APPEND GEANT4_USOLIDS_COMPILE_DEFINITIONS "-DG4GEOM_USE_U${__g4_usolid_shape}")
|
||||
endforeach()
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing Geant4 solids with USolids equivalents for ${GEANT4_USE_PARTIAL_USOLIDS_SHAPE_LIST} (EXPERIMENTAL)")
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing Geant4 solids with VecGeom equivalents for ${GEANT4_USE_PARTIAL_USOLIDS_SHAPE_LIST} (EXPERIMENTAL)")
|
||||
endif()
|
||||
list (APPEND GEANT4_USOLIDS_COMPILE_DEFINITIONS ${VECGEOM_DEFINITIONS})
|
||||
|
||||
# Combined definitions
|
||||
add_definitions(${GEANT4_USOLIDS_COMPILE_DEFINITIONS})
|
||||
|
||||
# Add USolids inc dirs here - can be removed once USolids supports
|
||||
# Add VecGeom inc dirs here - can be removed once VecGeom supports
|
||||
# INTERFACE_INCLUDE_DIRECTORIES
|
||||
include_directories(${USOLIDS_INCLUDE_DIRS} ${VECGEOM_EXTERNAL_INCLUDES})
|
||||
include_directories(${VECGEOM_INCLUDE_DIR} ${VECGEOM_EXTERNAL_INCLUDES})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -279,3 +298,46 @@ endif()
|
||||
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_FREETYPE "Building Geant4 analysis library with Freetype support")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Optional support for HDF5
|
||||
# - Requires external HDF5 1.8 or higher install
|
||||
# - Install must be MT safe if building Geant4 in MT mode
|
||||
#
|
||||
option(GEANT4_USE_HDF5 "Build Geant4 analysis library with HDF5 support" OFF)
|
||||
mark_as_advanced(GEANT4_USE_HDF5)
|
||||
|
||||
if(GEANT4_USE_HDF5)
|
||||
find_package(HDF5 1.8 REQUIRED)
|
||||
|
||||
# If we're in MT mode, found HDF5 must also support MT
|
||||
if(GEANT4_BUILD_MULTITHREADED)
|
||||
include(CheckCXXSymbolExists)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${HDF5_INCLUDE_DIRS}")
|
||||
check_cxx_symbol_exists(H5_HAVE_THREADSAFE "H5pubconf.h" GEANT4_HAVE_H5_HAVE_THREADSAFE)
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
if(NOT GEANT4_HAVE_H5_HAVE_THREADSAFE)
|
||||
message(FATAL_ERROR
|
||||
"Found an install of HDF5, but it was not built with support for thread safety. "
|
||||
"Either build Geant4 in single threaded mode, or use/reinstall HDF5 with "
|
||||
"thread safety enabled. See HDF5's install guides, available from https://support.hdfgroup.org/HDF5/release/, for instructions on this.\n"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# As FindHDF5 does not yet supply imported targets, we
|
||||
# create an internal INTERFACE target to wrap these.
|
||||
# This still hard-codes include/library paths, but limits it
|
||||
# to one place. Later, we'll create proper imported targets
|
||||
# with re-finds but for now this is the best minimally invasive proceedure
|
||||
add_library(G4HDF5 INTERFACE)
|
||||
target_include_directories(G4HDF5 INTERFACE ${HDF5_INCLUDE_DIRS})
|
||||
target_link_libraries(G4HDF5 INTERFACE ${HDF5_LIBRARIES})
|
||||
install(TARGETS G4HDF5 EXPORT Geant4LibraryDepends)
|
||||
|
||||
# Override HDF5_LIBRARIES for back compatibility
|
||||
set(HDF5_LIBRARIES G4HDF5)
|
||||
endif()
|
||||
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_HDF5 "Building Geant4 analysis library with HDF5 support")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user