Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+87
View File
@@ -30,6 +30,93 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
----------------------------------------------------------
20th November 2020 - Ben Morgan (cmake-V10-06-46)
- Make GEANT4_USE_SYSTEM_PTL option advanced
12th November 2020 - Jonathan Madsen (cmake-V10-06-45)
- Updated find package routines for timemory
19th November 2020 - Ben Morgan (cmake-V10-06-44)
- Require VecGeom 1.1.8 or newer
18th November 2020 - Ben Morgan (cmake-V10-06-43)
- Add GEANT4_BUILD_BUILTIN_BACKTRACE option to enable automatic
use of G4BackTrace signal handling in G4RunManager.
17th November 2020 - Gunter Folger (cmake-V10-06-42)
- Bump CLHEP minimum required version to 2.4.4.0
4th November 2020 - Ben Morgan (cmake-V10-06-41)
- Make Qt53D driver optional based on find of required Qt5 modules
2nd/3rd November 2020 - Gunter Folger (cmake-V10-06-40)
- Update to dataset RadioactiveDecay5.6 and PhotonEvaporation5.7 as
provided by Laurent
30th October 2020 - Gunter Folger (cmake-V10-06-39)
- Update datasets as provided by Laurent:
- G4ENSDFSTATE2.3
- PhotonEvaporation5.6
- RadioactiveDecay5.5
29th October 2020 - Ben Morgan (cmake-V10-06-38)
- Remove obsolete Geant4MacroDefineModule and G4DeveloperAPI_OLD modules
- Make Geant4MacroLibraryTargets module a no-op pending final removal in
2021
- Remove GEANT4_USE_NEW_CMAKE option to complete migration to new system
- Use STRINGS cache property for enum options and CMAKE_BUILD_TYPE to
give easier interface in (G)UIs
- Remove pre CMake3 functionality from G4InstallData module
27th October 2020 - Gunter Folger (cmake-V10-06-37)
- Add optional TENDL dataset
26th October 2020 - Ben Morgan (cmake-V10-06-36)
- Explicitly initialize GEANT4_USE_QT3D to OFF to prevent
user override.
26th October 2020 - Gunter Folger (cmake-V10-06-35)
- Switch to G4PARTICLEXS 3.1
23rd October 2020 - John Allison (cmake-V10-06-34)
- Introduce changes for Qt3D vis driver.
20th October 2020 - Ben Morgan (cmake-V10-06-33)
- Update functions to use G4expat{-static} as custom built targets.
Fixes GitLab Issue #44.
19th October 2020 - Ben Morgan (cmake-V10-06-32)
- Support CMake 3.8 through 3.18
- Allow specification of C++20 for CMake 3.12 and above
12th October 2020 - Daren Sawkey (cmake-V10-06-31)
- Switch to new data set G4RealSurface 2.2
12th October 2020 - Gunter Folger (cmake-V10-06-30)
- Switch to G4PARTICLEXS 3.0
24th September 2020 - Gunter Folger (cmake-V10-06-29)
- Switch to G4EMLOW 7.13
15 September 2020 - Jonathan Madsen (cmake-V10-06-28)
- Updated GEANT4_TEST_ENVIRONMENT to set G4RUN_MANAGER_TYPE=TBB when MT and
GEANT4_USE_TBB=ON
28 August - Ben Morgan (cmake-V10-06-27)
- Improve support for Inventor (Coin)
- Simplify configuration options, handling co-working ones both
at configure time and by client applications.
- Separate out dependency finding to keep these in one place.
- Improve consistency of using XQuartz vs System OpenGL on
macOS.
- Remove obsolete FindInventor module
21 July 2020 - Ben Morgan (cmake-V10-06-26)
- Provide new GEANT4_BUILD_PHP_AS_HP option to enable ParticleHP as
HP in G4processes. Replaces PHP_AS_HP environment variable.
- Add PHP_AS_HP "feature" in Geant4Config.cmake/geant4-config to allow
clients to check availability.
17th June 2020 - Jonathan Madsen (cmake-V10-06-25)
- Moved TBB before PTL
- Forced PTL_USE_TBB to be set to GEANT4_USE_TBB when not
-260
View File
@@ -1,260 +0,0 @@
# - Locate Open Inventor
#
# The file tries to locate Open Inventor compatible library
# and associated libraries (SoXt, SoQt,...).
#
# Currently tested Open Inventor clones:
# - Coin (+SoXt and SoWin coming with Coin)
# - SGI Inventor
#
# Detection algorithms are described through the file.
#
# Author: PCJohn (Jan Peciva, jpeciva@strathmore.edu)
# http://www.cmake.org/pipermail/cmake/2008-August/023446.html
# Modifications by Ben Morgan (Ben.Morgan@warwick.ac.uk)
#
# This module defines:
# INVENTOR_FOUND, if false, do not try to link against Inventor.
# INVENTOR_INCLUDE_DIR, where to find headers.
# INVENTOR_LIBRARY, the library to link against.
# INVENTOR_LIBRARY_DEBUG, the debug library to link against.
# INVENTOR_SOWIN_LIBRARY, the SoWin library - window binding library for Inventor
# INVENTOR_SOWIN_LIBRARY_DEBUG, the SoWin debug library
#
# INVENTOR_SOXT_LIBRARY, the SoXt library - window binding library for Inventor
# INVENTOR_SOXT_LIBRARY_DEBUG, the SoXt debug library
#
# notes:
# - Coin is honored over SGI Inventor
# - Coin is detected by coin-config script, COINDIR environment variable,
# and finally standard system locations are searched
# - SGI Inventor is searched at standard system locations only
#
# coin-config is used (if present) to find a prefix
execute_process (COMMAND coin-config --prefix
OUTPUT_VARIABLE COIN_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
${COIN_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# default Inventor lib search paths
SET(INVENTOR_LIB_SEARCH_PATH
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
# try to find Coin release lib (priority paths)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${COIN_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find Coin release lib (regular paths)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SGI Inventor lib
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES Inventor
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find Coin debug lib (priority paths)
#FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
# NAMES coin5d coin4d coin3d coin2d coin1d
# PATHS ${COIN_PREFIX}/lib
# $ENV{COINDIR}/lib
# NO_DEFAULT_PATH
#)
# try to find Coin debug lib (regular paths)
#FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
# NAMES coin5d coin4d coin3d coin2d coin1d
# PATHS ${INVENTOR_LIB_SEARCH_PATH}
#)
# set release to debug if only debug found
#IF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
# SET(INVENTOR_LIBRARY_RELEASE ${INVENTOR_LIBRARY_DEBUG})
#ENDIF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
# set debug to release (if only release found)
#IF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
# SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY_RELEASE})
#ENDIF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
# INVENTOR_LIBRARY
#IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# SET(INVENTOR_LIBRARY
# optimized ${INVENTOR_LIBRARY_RELEASE}
# debug ${INVENTOR_LIBRARY_RELEASE})
#ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# SET(INVENTOR_LIBRARY
# ${INVENTOR_LIBRARY_RELEASE})
#ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# set INVENTOR_FOUND appropriately
SET(INVENTOR_FOUND "NO")
IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
SET(INVENTOR_FOUND "YES")
ENDIF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
if(WIN32 AND NOT CYGWIN)
#
# SoWin
#
# notes: SoWin is searched by COINDIR environment variable
# (as expected to be located at Windows platform)
# try to find SoWin lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SoWin debug lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin debug lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# SoWin debug library defaults to non-debug lib
IF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
IF(INVENTOR_SOWIN_LIBRARY)
SET(INVENTOR_SOWIN_LIBRARY_DEBUG INVENTOR_SOWIN_LIBRARY)
ENDIF(INVENTOR_SOWIN_LIBRARY)
ENDIF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
endif()
if(UNIX)
#
# SoXt
#
# notes:
# - SoXt is detected by soxt-config script (as expected by
# Coin's SoXt on Linux/Unix) and on standard system locations
# - SGI's InventorXt support is missing now
#
# soxt-config tells much of SoXt instalation (if present)
execute_process (COMMAND soxt-config --prefix
OUTPUT_VARIABLE SOXT_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_SOXT_INCLUDE_DIR Inventor/Xt/SoXt.h
${SOXT_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_SOXT_INCLUDE_DIR Inventor/Xt/SoXt.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# try to find SoXt lib (priority paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${SOXT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoXt lib (regular paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
#
# SoQt
#
# notes:
# - SoQt is detected by soqt-config script (as expected by
# Coin's SoQt on Linux/Unix) and on standard system locations
#
# soqt-config tells much of SoQt installation (if present)
execute_process (COMMAND soqt-config --prefix
OUTPUT_VARIABLE SOQT_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_SOQT_INCLUDE_DIR Inventor/Qt/SoQt.h
${SOQT_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_SOQT_INCLUDE_DIR Inventor/Qt/SoQt.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# try to find SoQt lib (priority paths)
FIND_LIBRARY(INVENTOR_SOQT_LIBRARY
NAMES soqt1 SoQt
PATHS ${SOQT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoQt lib (regular paths)
FIND_LIBRARY(INVENTOR_SOQT_LIBRARY
NAMES soqt1 SoQt
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
endif()
+3 -3
View File
@@ -41,7 +41,7 @@ The following cache variables may also be set
# Just don't run if we're on macOS
if(NOT APPLE)
message(FATAL_ERROR "FindXquartzGL is only for use on macOS platforms")
message(FATAL_ERROR "FindXQuartzGL is only for use on macOS platforms")
endif()
# - This is for X11 GL drivers, so we DON'T want Framework!
@@ -79,7 +79,7 @@ mark_as_advanced(XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRAR
if(XQuartzGL_FOUND)
if(NOT TARGET XQuartzGL::GL)
add_library(XQuartzGL::GL UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GL PROPERTIES
set_target_properties(XQuartzGL::GL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
IMPORTED_LOCATION "${XQuartzGL_gl_LIBRARY}"
)
@@ -87,7 +87,7 @@ if(XQuartzGL_FOUND)
if(NOT TARGET XQuartzGL::GLU AND XQuartzGL_glu_LIBRARY)
add_library(XQuartzGL::GLU UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GLU PROPERTIES
set_target_properties(XQuartzGL::GLU PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES XQuartzGL::GL
IMPORTED_LOCATION "${XQuartzGL_glu_LIBRARY}"
+61 -28
View File
@@ -117,6 +117,7 @@ mark_as_advanced(CMAKE_CXX_FLAGS_MAINTAINER)
#
if(NOT CMAKE_CONFIGURATION_TYPES)
# Single mode build tools like Make, Ninja,
set(__g4buildmodes "" Release TestRelease MinSizeRel Debug Debug_FPE RelWithDebInfo MinSizeRel Maintainer)
if(NOT CMAKE_BUILD_TYPE)
# Default to a Release build if nothing else...
set(CMAKE_BUILD_TYPE Release
@@ -130,6 +131,7 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
FORCE
)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${__g4buildmodes})
else()
# Multimode tools like VS, Xcode
list(APPEND CMAKE_CONFIGURATION_TYPES Debug_FPE)
@@ -154,14 +156,19 @@ endif() #NOT WIN32
#
#.rst
# - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, c++11, c++14, c++17)
# - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, 20)
#
# - Choose C++ Standard to build against from supported list.
# - Note that only C++17 is supported on Windows with MSVC
# - C++20 awareness is only available from CMake 3.12 onwards
#
set(__g4_default_cxxstd 11 14 17 c++11 c++14 c++17)
set(__g4_default_cxxstd 11 14 17)
if(MSVC)
set(__g4_default_cxxstd 17 c++17)
set(__g4_default_cxxstd 17)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
list(APPEND __g4_default_cxxstd 20)
endif()
enum_option(GEANT4_BUILD_CXXSTD
@@ -175,7 +182,9 @@ 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
# Require at minimal set of C++11 features plus user's selection of standard, no extensions
# Explicit features are retained for C++11 to identify use of old compilers with partial support.
# Here, the `cxx_std_11` epoch feature might not be sufficient.
set(CMAKE_CXX_EXTENSIONS OFF)
set(GEANT4_TARGET_COMPILE_FEATURES
cxx_alias_templates
@@ -190,36 +199,25 @@ set(GEANT4_TARGET_COMPILE_FEATURES
cxx_range_for
cxx_strong_enums
cxx_uniform_initialization
# Features that MSVC 18.0 cannot support but in list of Geant4 coding
# guidelines - to be required once support for that compiler is dropped.
# Version 10.2 is coded without these being required.
#cxx_deleted_functions
#cxx_generalized_initializers
#cxx_constexpr
#cxx_inheriting_constructors
)
cxx_std_${GEANT4_BUILD_CXXSTD})
# If a standard higher than 11 has been selected, check that compiler has
# at least one feature from that standard and append these to the required
# feature list
if(GEANT4_BUILD_CXXSTD GREATER 11)
if(CMAKE_CXX${GEANT4_BUILD_CXXSTD}_COMPILE_FEATURES)
list(APPEND GEANT4_TARGET_COMPILE_FEATURES ${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_COMPILE_FEATURES})
else()
message(FATAL_ERROR "Geant4 requested to be compiled against C++ standard '${GEANT4_BUILD_CXXSTD}'\nbut detected compiler '${CMAKE_CXX_COMPILER_ID}', version '${CMAKE_CXX_COMPILER_VERSION}'\ndoes not support, or CMake (${CMAKE_VERSION}) is not aware of, any features of that standard.")
endif()
# Emit early fatal error if we don't have a record of the core standard
# in CMake's known features. CMake will check this for us as well, but doing
# the check here only emits one error. We can also give a better hint on the
# cause/resolution
if(NOT ("${CMAKE_CXX_COMPILE_FEATURES}" MATCHES "cxx_std_${GEANT4_BUILD_CXXSTD}"))
message(FATAL_ERROR
"Geant4 requested compilation using C++ standard '${GEANT4_BUILD_CXXSTD}' using compiler\n"
"'${CMAKE_CXX_COMPILER_ID}', version '${CMAKE_CXX_COMPILER_VERSION}'\n"
"but CMake ${CMAKE_VERSION} is not aware of any support for that standard by this compiler. You may need a newer CMake and/or compiler.\n")
endif()
# - Check for Standard Library Implementation Features
# Smart pointers are a library implementation feature
# Hashed containers are a library implementation feature
# Random numbers are a library implementation feature?
# An example of where a workaround is needed
# Rest of concurrency a library implementation feature
# e.g. Smart pointers are a library implementation feature
# and provide workarounds if needed
# Hold any appropriate compile flag(s) in variable for later export to
# config files. Needed to support clients using late CMake 2.8 where compile features
# are not available.
# non-cmake config files
set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTION}")
#-----------------------------------------------------------------------
@@ -276,6 +274,27 @@ if(GEANT4_BUILD_MULTITHREADED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}")
endif()
#-----------------------------------------------------------------------
# Physics
#-----------------------------------------------------------------------
#.rst:
# - ``GEANT4_BUILD_PHP_AS_HP`` (Default: OFF, ON if ``PHP_AS_HP`` set in environment)
#
# - Build ParticleHP as HP.
# - Use of the ``PHP_AS_HP`` environment variable to enable this build
# option is deprecated and will be removed in the next release
#
set(_default_build_php_as_hp OFF)
if(DEFINED ENV{PHP_AS_HP})
message(WARNING "Use of the PHP_AS_HP environment variable to enable building ParticleHP as HP is deprecated. "
"Use the GEANT4_BUILD_PHP_AS_HP CMake option to enable this functionality.")
set(_default_build_php_as_hp ON)
endif()
option(GEANT4_BUILD_PHP_AS_HP "Build ParticleHP as HP" ${_default_build_php_as_hp})
mark_as_advanced(GEANT4_BUILD_PHP_AS_HP)
geant4_add_feature(GEANT4_BUILD_PHP_AS_HP "Building ParticleHP as HP")
#-----------------------------------------------------------------------
# Miscellaneous
#-----------------------------------------------------------------------
@@ -303,6 +322,20 @@ option(GEANT4_BUILD_VERBOSE_CODE
ON)
mark_as_advanced(GEANT4_BUILD_VERBOSE_CODE)
#.rst:
# - ``GEANT4_BUILD_BUILTIN_BACKTRACE`` (Unix only, Default: OFF)
#
# - Setting to ``ON`` will build in automatic signal handling for ``G4RunManager``
# through ``G4Backtrace``. Applications requiring/implenting their own signal
# handling should not enable this option.
#
if(UNIX)
option(GEANT4_BUILD_BUILTIN_BACKTRACE
"Enable automatic G4Backtrace signal handling in G4RunManager. Switch off for applications implementing their own signal handling"
OFF)
mark_as_advanced(GEANT4_BUILD_BUILTIN_BACKTRACE)
endif()
#.rst:
# - ``GEANT4_BUILD_MSVC_MP`` (Windows only, Default: OFF)
#
+1 -1
View File
@@ -79,7 +79,7 @@ option(GEANT4_USE_PYTHON "Build Python bindings for Geant4" OFF)
if(GEANT4_USE_PYTHON)
# We can only build g4py with MT geant4 if TLS is global-dynamic (or auto?)
if(GEANT4_BUILD_MULTITHREADED AND (NOT GEANT4_BUILD_TLS_MODEL MATCHES "global-dynamic"))
message(FATAL_ERROR "Geant4Py only supports 'global-dynamic' thread local storage
message(FATAL_ERROR "Geant4Py only supports 'global-dynamic' thread local storage, but
'${GEANT4_BUILD_TLS_MODEL}' selected by GEANT4_BUILD_TLS_MODEL option
")
endif()
+1 -1
View File
@@ -42,7 +42,6 @@ endif()
#
# This module includes the following modules:
include(CMakeDependentOption)
include(Geant4MacroDefineModule)
include(Geant4MacroLibraryTargets)
#-----------------------------------------------------------------------
@@ -118,6 +117,7 @@ function(enum_option _var)
endif()
endif()
endif()
set_property(CACHE ${_var} PROPERTY STRINGS ${_ENUMOP_VALUES})
endfunction()
#-----------------------------------------------------------------------
+6
View File
@@ -41,6 +41,12 @@ if(GEANT4_ENABLE_TESTING)
if(GEANT4_USE_FREETYPE)
list(APPEND GEANT4_TEST_ENVIRONMENT TOOLS_FONT_PATH=${PROJECT_SOURCE_DIR}/source/analysis/fonts)
endif()
# - Configure 'G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default)'
# to use TBB
if(GEANT4_BUILD_MULTITHREADED AND GEANT4_USE_TBB)
list(APPEND GEANT4_TEST_ENVIRONMENT G4RUN_MANAGER_TYPE=TBB)
endif()
endif()
#-----------------------------------------------------------------------
@@ -123,6 +123,13 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_MULTITHREADING "no")
endif()
# - PHP_AS_HP
if(GEANT4_BUILD_PHP_AS_HP)
set(G4_BUILTWITH_PHP_AS_HP "yes")
else()
set(G4_BUILTWITH_PHP_AS_HP "no")
endif()
# - Smart Stack
if(GEANT4_USE_SMARTSTACK)
set(G4_BUILTWITH_SMARTSTACK "yes")
@@ -222,7 +229,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_FREETYPE "no")
endif()
# - Freetype
# - HDF5
if(GEANT4_USE_HDF5)
set(G4_BUILTWITH_HDF5 "yes")
else()
@@ -232,7 +239,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
# - Qt
if(GEANT4_USE_QT)
set(G4_BUILTWITH_QT "yes")
set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS})
set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS} ${Qt53DCore_INCLUDE_DIRS} ${Qt53DExtras_INCLUDE_DIRS} ${Qt53DRender_INCLUDE_DIRS})
list(REMOVE_DUPLICATES G4_QT_INCLUDE_DIRS)
if(_cxx_compiler_dirs)
+28 -12
View File
@@ -18,41 +18,41 @@ geant4_add_dataset(
# - Low energy electromagnetics
geant4_add_dataset(
NAME G4EMLOW
VERSION 7.12
VERSION 7.13
FILENAME G4EMLOW
EXTENSION tar.gz
ENVVAR G4LEDATA
MD5SUM 0d3d46eeb7420f2b996242fec756ee52
MD5SUM 55922521aa331655a0494cdf8f9a70e8
)
# - Photon evaporation
geant4_add_dataset(
NAME PhotonEvaporation
VERSION 5.5
VERSION 5.7
FILENAME G4PhotonEvaporation
EXTENSION tar.gz
ENVVAR G4LEVELGAMMADATA
MD5SUM 707514c864414089af9671db0f656e35
MD5SUM 81ff27deb23af4aa225423e6b3a06b39
)
# - Radioisotopes
geant4_add_dataset(
NAME RadioactiveDecay
VERSION 5.4
VERSION 5.6
FILENAME G4RadioactiveDecay
EXTENSION tar.gz
ENVVAR G4RADIOACTIVEDATA
MD5SUM 08abe2bcc0bcd1ac4bbe09f5ae69cdbe
MD5SUM acc1dbeb87b6b708b2874ced729a3a8f
)
# - Particle XS - replaces Neutron XS
geant4_add_dataset(
NAME G4PARTICLEXS
VERSION 2.1
VERSION 3.1
FILENAME G4PARTICLEXS
EXTENSION tar.gz
ENVVAR G4PARTICLEXSDATA
MD5SUM 24a68bb627a95629e2edcd098131d6b3
MD5SUM 35a3fe5cf0a29d453e6805e2cfacacee
)
# - PII
@@ -68,11 +68,11 @@ geant4_add_dataset(
# - Optical Surfaces
geant4_add_dataset(
NAME RealSurface
VERSION 2.1.1
VERSION 2.2
FILENAME G4RealSurface
EXTENSION tar.gz
ENVVAR G4REALSURFACEDATA
MD5SUM 1d0fcc24c7082edae1e22a3d43fbb4d9
MD5SUM ea8f1cfa8d8aafd64b71fb30b3e8a6d9
)
# - SAID
@@ -109,10 +109,26 @@ geant4_add_dataset(
# - ENSDFSTATE
geant4_add_dataset(
NAME G4ENSDFSTATE
VERSION 2.2
VERSION 2.3
FILENAME G4ENSDFSTATE
EXTENSION tar.gz
ENVVAR G4ENSDFSTATEDATA
MD5SUM 495439cf600225753d7bd99825e5c6bc
MD5SUM 6f18fce8f217e7aaeaa3711be9b2c7bf
)
# - TENDL
option(GEANT4_INSTALL_DATASETS_TENDL "Install optional TENDL dataset" OFF)
mark_as_advanced(GEANT4_INSTALL_DATASETS_TENDL)
if(GEANT4_INSTALL_DATASETS_TENDL)
geant4_add_dataset(
NAME G4TENDL
VERSION 1.4
FILENAME G4TENDL
EXTENSION tar.gz
ENVVAR G4PARTICLEHPDATA
MD5SUM ecdad2f8234c10caecaac82ac0cb96f8
)
endif()
+8 -17
View File
@@ -41,15 +41,6 @@ else()
return()
endif()
# Whilst we test, allow switching between old and new implementations
option(GEANT4_USE_NEW_CMAKE "Use new CMake module/library implementation" ON)
mark_as_advanced(GEANT4_USE_NEW_CMAKE)
if(NOT GEANT4_USE_NEW_CMAKE)
include(G4DeveloperAPI_OLD)
return()
endif()
# Needed modules
include(G4ClangFormat)
@@ -499,12 +490,12 @@ function(geant4_compose_targets)
endif()
endforeach()
# Process all defined libraries, except for G4clhep{-static}
# G4clhep/G4ptl are a corner cases because its call to add_library happens
# Process all defined libraries, except for G4{clhep,expat,ptl}{-static}
# These are corner cases because its call to add_library happens
# at a different (lower) directory level than all the other targets
# This means we cannot install it here. That's left to it
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
list(REMOVE_ITEM __g4definedlibraries G4clhep G4clhep-static G4ptl G4ptl-static)
list(REMOVE_ITEM __g4definedlibraries G4clhep G4clhep-static G4expat G4expat-static G4ptl G4ptl-static)
set(__g4builtlibraries)
set(__g4public_headers)
@@ -670,8 +661,8 @@ endfunction()
# GEANT4_LINK_LIBRARIES lib1 [lib2 ...]
# LINK_LIBRARIES lib1 [lib2 ...])
#
# DEPRECATED: Maintained only for building internal G4clhep target because of its
# different include structure.
# Maintained for building internal G4clhep,G4expat targets because we try and
# reuse their upstream code/build layout as far as possible
#
function(geant4_library_target)
cmake_parse_arguments(G4GLOBLIB
@@ -681,7 +672,7 @@ function(geant4_library_target)
${ARGN}
)
# Currently a hack to get G4clhep to build, so an error if used elsewhere
if(NOT (${G4GLOBLIB_NAME} STREQUAL "G4clhep"))
if(NOT (${G4GLOBLIB_NAME} MATCHES "G4clhep|G4expat"))
message(FATAL_ERROR "geant4_library_target called for '${G4GLOBLIB_NAME}' in '${CMAKE_CURRENT_LIST_DIR}'")
endif()
@@ -856,8 +847,8 @@ endfunction()
# This is used internally by the ``geant4_compose_targets`` command.
#
function(__geant4_add_library _name _type)
# TEMP HACK: G4clhep/G4ptl are a special cases, and build is handled separately
if(_name MATCHES "G4clhep|G4ptl")
# TEMP HACK: G4clhep/G4expat/G4ptl are a special cases, and build is handled separately
if(_name MATCHES "G4clhep|G4expat|G4ptl")
return()
endif()
-453
View File
@@ -1,453 +0,0 @@
#.rst:
# G4DeveloperAPI_OLD
# ------------------
#
# Old style API for declaring Geant4 source code modules and
# compiling, linking and installing binary libraries composed
# from one or more source code modules.
#
#-----------------------------------------------------------------
# License and Disclaimer
#
# The Geant4 software is copyright of the Copyright Holders of
# the Geant4 Collaboration. It is provided under the terms and
# conditions of the Geant4 Software License, included in the file
# LICENSE and available at http://cern.ch/geant4/license . These
# include a list of copyright holders.
#
# Neither the authors of this software system, nor their employing
# institutes,nor the agencies providing financial support for this
# work make any representation or warranty, express or implied,
# regarding this software system or assume any liability for its
# use. Please see the license in the file LICENSE and URL above
# for the full disclaimer and the limitation of liability.
#
# This code implementation is the result of the scientific and
# technical work of the GEANT4 collaboration.
# By using, copying, modifying or distributing the software (or
# any work based on the software) you agree to acknowledge its
# use in resulting scientific publications, and indicate your
# acceptance of all terms of the Geant4 Software license.
#
#-----------------------------------------------------------------
# - Include guard
if(NOT __G4DEVELOPERAPI_OLD_INCLUDED)
set(__G4DEVELOPERAPI_OLD_INCLUDED 1)
else()
return()
endif()
# - Needed CMake modules
include(CMakeParseArguments)
include(G4ClangFormat)
#-----------------------------------------------------------------------
#.rst:
# Source Code Module Declaration Functions
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Geant4's source code is organised into categories composed of one or
# more "modules" of source code. Each module has the following layout
# of headers and sources:
#
# - include/
# - Public headers
# - src/
# - Implementations
#
# The functions here declare a module ready for it to be integrated
# by the library build functions described below.
#-----------------------------------------------------------------------
# macro geant4_define_module(NAME <name>
# HEADERS <header1> <header2> ... <headerN>
# SOURCES <source1> <source2> ... <sourceN>
# GRANULAR_DEPENDENCIES <dep1> ... <depN>
# GLOBAL_DEPENDENCIES <dep1> ... <depN>
# LINK_LIBRARIES <lib1> ... <lib2>)
# Define a Geant4 Module's sources and what internal and external
# libraries it links to.
#
# GEANT4_DEFINE_MODULE will take the name of the module, a list of header
# files, a list of source files and dependencies:
#
# GEANT4_DEFINE_MODULE(NAME name
# HEADERS hdr1 hdr2 ...
# SOURCES src1 src2 ...
# GRANULAR_DEPENDENCIES dep1 dep2 ...
# GLOBAL_DEPENDENCIES dep1 dep2 ...
# LINK_LIBRARIES lib1 lib2 ...)
#
# It assumes that it will be called from a CMake located in the module
# root directory (i.e. the directory containing the include and src
# subdirectories). It uses this location to define absolute paths to the
# headers and sources, and will ignore any absolute paths passed in HEADERS
# or SOURCES so that generated files can be passed in.
#
# The macro defines the variables
#
# G4MODULENAME = name
# ${G4MODULENAME}_HEADERS = List of absolute paths to files given in HEADERS
# ${G4MODULENAME}_SOURCES = List of absolute paths to files given in SOURCES
# ${G4MODULENAME}_GRANULAR_DEPS = List of granular libraries on which this
# module depends
# ${G4MODULENAME}_GLOBAL_DEPS = List of global libraries on which this module
# depends
# ${G4MODULENAME}_LINK_LIBRARIES = List of external libraries to be linked to
# this module
#
# It will also add the module include directory to the list of directories
# using include_directories
#
macro(geant4_define_module)
set(multiargs
HEADERS SOURCES GRANULAR_DEPENDENCIES GLOBAL_DEPENDENCIES LINK_LIBRARIES
HEADERS_EXCLUDE_FORMAT SOURCES_EXCLUDE_FORMAT)
cmake_parse_arguments(G4DEFMOD
""
"NAME"
"${multiargs}"
${ARGN}
)
set(G4MODULENAME ${G4DEFMOD_NAME})
get_filename_component(${G4MODULENAME}_BASEDIR ${CMAKE_CURRENT_LIST_FILE} PATH)
set(${G4MODULENAME}_SRCDIR ${${G4MODULENAME}_BASEDIR}/src)
set(${G4MODULENAME}_INCDIR ${${G4MODULENAME}_BASEDIR}/include)
# We now create absolute paths to the headers and sources,
# ignoring any already absolute paths
foreach(_HDR ${G4DEFMOD_HEADERS})
if(IS_ABSOLUTE ${_HDR})
list(APPEND ${G4MODULENAME}_HEADERS ${_HDR})
else()
list(APPEND ${G4MODULENAME}_HEADERS ${${G4MODULENAME}_INCDIR}/${_HDR})
endif()
endforeach()
foreach(_SRC ${G4DEFMOD_SOURCES})
if(IS_ABSOLUTE ${_SRC})
list(APPEND ${G4MODULENAME}_SOURCES ${_SRC})
else()
list(APPEND ${G4MODULENAME}_SOURCES ${${G4MODULENAME}_SRCDIR}/${_SRC})
endif()
endforeach()
exclude_from_format(
HEADERS ${G4DEFMOD_HEADERS_EXCLUDE_FORMAT}
SOURCES ${G4DEFMOD_SOURCES_EXCLUDE_FORMAT})
foreach(_LIB ${G4DEFMOD_GRANULAR_DEPENDENCIES})
list(APPEND ${G4MODULENAME}_GRANULAR_DEPENDENCIES ${_LIB})
endforeach()
foreach(_LIB ${G4DEFMOD_GLOBAL_DEPENDENCIES})
list(APPEND ${G4MODULENAME}_GLOBAL_DEPENDENCIES ${_LIB})
endforeach()
foreach(_LIB ${G4DEFMOD_LINK_LIBRARIES})
list(APPEND ${G4MODULENAME}_LINK_LIBRARIES ${_LIB})
endforeach()
endmacro()
#-----------------------------------------------------------------------
# macro geant4_add_compile_definitions(SOURCES <source1> ... <sourceN>
# COMPILE_DEFINITIONS <def1> ... <defN>
# )
# Add extra compile definitions to a specific list of sources
# in the current module. Macroized to handle the need to specify absolute paths.
# and *must* be called at the same level as geant4_define_module
#
macro(geant4_add_compile_definitions)
cmake_parse_arguments(G4ADDDEF
""
""
"SOURCES;COMPILE_DEFINITIONS"
${ARGN}
)
# We assume that the sources have been added at the level of a
# a sources.cmake, so are inside the src subdir of the sources.cmake
get_filename_component(_ACD_BASE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
# Now for each file, add the definitions
foreach(_acd_source ${G4ADDDEF_SOURCES})
# Extract any existing compile definitions
get_source_file_property(
_acd_existing_properties
${_ACD_BASE_PATH}/src/${_acd_source}
COMPILE_DEFINITIONS)
if(_acd_existing_properties)
set(_acd_new_defs ${_acd_existing_properties}
${G4ADDDEF_COMPILE_DEFINITIONS})
else()
set(_acd_new_defs ${G4ADDDEF_COMPILE_DEFINITIONS})
endif()
# quote compile defs because this must epand to space separated list
set_source_files_properties(${_ACD_BASE_PATH}/src/${_acd_source}
PROPERTIES COMPILE_DEFINITIONS "${_acd_new_defs}")
endforeach()
endmacro()
#-----------------------------------------------------------------------
#.rst:
# Library Declaration, Build and Install API
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# - Define useful macros for building and installing Geant4 library targets
#
# This file defines the following macros for Geant4 developers needing to
# add shared and static library targets.
#
# GEANT4_LIBRARY_TARGET - define standard Geant4 library targets
#
# The macro will take the name of the library and its sources, defining
# static and shared targets depending on the value of BUILD_SHARED_LIBS and
# BUILD_STATIC_LIBS. Install targets are also created.
#
# A custom compile definition "GEANT4_DEVELOPER_<CONFIG>" is set on
# each target using the target property COMPILE_DEFINITIONS_<CONFIG>
# target property
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# - GEANT4_LIBRARY_TARGET
# General build and install of a Geant4 library target
#
macro(geant4_library_target)
cmake_parse_arguments(G4LIBTARGET
""
"NAME" "SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
${ARGN}
)
geant4_format_target(NAME ${G4LIBTARGET_NAME}-format SOURCES ${G4LIBTARGET_SOURCES})
if(BUILD_SHARED_LIBS)
# Add the shared library target and link its dependencies
# - Common shared lib commands
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
target_compile_definitions(${G4LIBTARGET_NAME} PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES} ${G4LIBTARGET_LINK_LIBRARIES})
if(__sorted_link_libs)
list(SORT __sorted_link_libs)
endif()
target_link_libraries(${G4LIBTARGET_NAME} ${__sorted_link_libs})
# DLL support, portable to all platforms
# G4LIB_BUILD_DLL is public as despite the name it indicates the shared/archive mode
# and clients must apply it when linking to the shared libs. The global
# category handles the exact import/export statements
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC G4LIB_BUILD_DLL)
set_target_properties(${G4LIBTARGET_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Set the include directory usage requirements
target_include_directories(${G4LIBTARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
# This property is set to prevent concurrent builds of static and
# shared libs removing each others files.
set_target_properties(${G4LIBTARGET_NAME}
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# 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()
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME} ALIAS ${G4LIBTARGET_NAME})
# 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
install(TARGETS ${G4LIBTARGET_NAME}
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
#
# As above, but for static rather than shared library
if(BUILD_STATIC_LIBS)
# We have to distinguish the static from shared lib, so use -static in
# name. Link its dependencies, and ensure we actually link to the
# -static targets (We should strictly do this for the external
# libraries as well if we want a pure static build).
add_library(${G4LIBTARGET_NAME}-static STATIC ${G4LIBTARGET_SOURCES})
target_compile_definitions(${G4LIBTARGET_NAME}-static PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME}-static PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_include_directories(${G4LIBTARGET_NAME}-static PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
set(G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC )
foreach(_tgt ${G4LIBTARGET_GEANT4_LINK_LIBRARIES})
list(APPEND G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC ${_tgt}-static)
endforeach()
# If we are building both types of library and builtin clhep etc,
# we want to link shared->shared and static->static.
# Because externals like clhep appear in G4LIBTARGET_LINK_LIBRARIES,
# filter this list to replace shared builtins with their static variant
string(REGEX REPLACE
"(G4clhep|G4expat|G4zlib|G4ptl|G4geomUSolids)(;|$)" "\\1-static\\2"
G4LIBTARGET_LINK_LIBRARIES_STATIC
"${G4LIBTARGET_LINK_LIBRARIES}"
)
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC} ${G4LIBTARGET_LINK_LIBRARIES_STATIC})
if(__sorted_link_libs)
list(SORT __sorted_link_libs)
endif()
target_link_libraries(${G4LIBTARGET_NAME}-static PUBLIC ${__sorted_link_libs})
# But we can rename the output library to the correct name
# On WIN32 we *retain* the -static postfix to avoid name clashes
# with the DLL import lib.
if(NOT WIN32)
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES OUTPUT_NAME ${G4LIBTARGET_NAME})
endif()
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME}-static ALIAS ${G4LIBTARGET_NAME}-static)
install(TARGETS ${G4LIBTARGET_NAME}-static
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_HEADER_MODULE_TARGET
# Build and install for a header only Geant4 module.
#
macro(geant4_header_module_target)
CMAKE_PARSE_ARGUMENTS(G4HEADERMOD
""
"COMPONENT"
""
${ARGN}
)
# Only has one component, and we just have to pick out the headers
include(${G4HEADERMOD_COMPONENT})
# Header install?
install(FILES ${${G4MODULENAME}_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component so that the build tree
# config file can pick up all needed header paths
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${${G4MODULENAME}_INCDIR}")
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_GRANULAR_LIBRARY_TARGET
# Build and install for a Geant4 module (granular) library
#
macro(geant4_granular_library_target)
cmake_parse_arguments(G4GRANLIB
""
"COMPONENT"
""
${ARGN}
)
message(FATAL_ERROR "geant4_granular_library_target is no longer supported")
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_GLOBAL_LIBRARY_TARGET
# Build and install of a Geant4 category (global) library
#
macro(geant4_global_library_target)
cmake_parse_arguments(G4GLOBLIB
""
"NAME"
"COMPONENTS"
${ARGN}
)
# We loop over the component sources one at a time,
# appending properties as we go.
foreach(_comp ${G4GLOBLIB_COMPONENTS})
include(${_comp})
# In case we have a global lib with one component, ensure name gets set
if(NOT G4GLOBLIB_NAME)
set(G4GLOBLIB_NAME ${G4MODULENAME})
endif()
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_SOURCES ${${G4MODULENAME}_SOURCES})
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_HEADERS ${${G4MODULENAME}_HEADERS})
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES
${${G4MODULENAME}_GLOBAL_DEPENDENCIES})
list(APPEND ${G4GLOBLIB_NAME}_LINK_LIBRARIES
${${G4MODULENAME}_LINK_LIBRARIES})
list(APPEND ${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES ${${G4MODULENAME}_INCDIR})
endforeach()
# Reset directory scope include dirs so we enforce usage requirements
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
# Filter out duplicates/self in GLOBAL_DEPENDENCIES and LINK_LIBRARIES
if(${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES)
list(REMOVE_DUPLICATES ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES)
list(REMOVE_ITEM ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES ${G4GLOBLIB_NAME})
endif()
if(${G4GLOBLIB_NAME}_LINK_LIBRARIES)
list(REMOVE_DUPLICATES ${G4GLOBLIB_NAME}_LINK_LIBRARIES)
endif()
# Now add the library target
geant4_library_target(NAME ${G4GLOBLIB_NAME}
SOURCES
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
GEANT4_LINK_LIBRARIES
${${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES}
LINK_LIBRARIES
${${G4GLOBLIB_NAME}_LINK_LIBRARIES})
# Header install?
install(FILES ${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component. Only used so that
# other tools like GNUmake/pkg-config can be configured for the
# build tree
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS ${${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES})
endmacro()
+11 -150
View File
@@ -75,21 +75,6 @@
# If it is not installed, warn user that it will need installing
# manually in destination.
#
#
# Private API
# -----------
# function _geant4_dataproject(<name>
# PREFIX installdir
# SOURCE_DIR wheretounpack
# URL whattodownload
# URL_MD5 expectedMD5ofdownload
# TIMEOUT timeoutafter(seconds))
# Download, unpack and install a dataset for CMake < 2.8.2
# This largely replicates the functionality of ExternalProject
# so that CMake 2.6.4 can still be supported (It is also needed
# for CMake 2.8.{0,1} where ExternalProject does not provide MD5
# validation.
#
#-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - GLOBAL CMAKE VARIABLES
@@ -419,28 +404,17 @@ function(geant4_install_dataset _name _destination _timeout)
# - Dispatch to ExternalProject or our own implementation.
# Use of URL_MD5 *and* TIMEOUT require CMake 2.8.2 or higher.
if(${CMAKE_VERSION} VERSION_GREATER "2.8.1")
include(ExternalProject)
ExternalProject_Add(${_name}
PREFIX Externals/${_name}-${_ds_version}
SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}/${_ds_dir}
URL ${_ds_url}
URL_MD5 ${_ds_md5sum}
TIMEOUT ${_timeout}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
else()
_geant4_dataproject(${_name}
PREFIX Externals/${_name}-${_ds_version}
SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}
URL ${_ds_url}
URL_MD5 ${_ds_md5sum}
TIMEOUT ${_timeout}
)
endif()
include(ExternalProject)
ExternalProject_Add(${_name}
PREFIX Externals/${_name}-${_ds_version}
SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}/${_ds_dir}
URL ${_ds_url}
URL_MD5 ${_ds_md5sum}
TIMEOUT ${_timeout}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
# - Configure the dataset's build and install locations
geant4_set_dataset_property(${_name} BUILD_DIR "${PROJECT_BINARY_DIR}/data/${_ds_dir}")
geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}")
@@ -472,119 +446,6 @@ function(geant4_reuse_dataset _name _destination _ispresent)
geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}")
endfunction()
#-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - PRIVATE CMAKE API FOR DATASET HANDLING
#-----------------------------------------------------------------------
# function _geant4_dataproject(<name>
# PREFIX installdir
# SOURCE_DIR wheretounpack
# URL whattodownload
# URL_MD5 expectedMD5ofdownload
# TIMEOUT timeoutafter(seconds))
# Download, unpack and install a dataset for CMake < 2.8.2
# This largely replicates the functionality of ExternalProject
# so that CMake 2.6.4 can still be supported (It is also needed
# for CMake 2.8.{0,1} where ExternalProject does not provide MD5
# validation.
#
function(_geant4_dataproject _name)
# - Parse arguments and create any extra needed variables
set(oneValueArgs PREFIX SOURCE_DIR URL URL_MD5 TIMEOUT)
cmake_parse_arguments(_G4DATA "" "${oneValueArgs}" "" ${ARGN})
get_filename_component(_G4DATA_FILE ${_G4DATA_URL} NAME)
# - Write Download script
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Download.cmake "
message(STATUS \"downloading ${_G4DATA_URL}...\")
file(DOWNLOAD
${_G4DATA_URL}
\"${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
TIMEOUT ${_G4DATA_TIMEOUT}
STATUS _status)
# LOG _log) - LOG with TIMEOUT fails due to curl issue, prefer TIMEOUT
list(GET _status 0 _status_code)
list(GET _status 1 _status_msg)
if(NOT _status_code EQUAL 0)
message(FATAL_ERROR \"error: downloading ${_G4DATA_URL} failed
status_code : \${_status_code}
status_msg : \${_status_msg}
#log : \${_log}\"
)
endif()
")
# - Write Verify script
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Verify.cmake "
message(STATUS \"verifying ${_G4DATA_FILE} ...\")
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E md5sum \"${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
OUTPUT_VARIABLE ov
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _result_code
)
if(NOT _result_code EQUAL 0)
message(FATAL_ERROR \"error: computing md5sum of ${_G4DATA_FILE} failed\")
endif()
string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
string(TOLOWER \"\${md5_actual}\" md5_actual)
string(TOLOWER \"${_G4DATA_URL_MD5}\" md5)
if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\")
message(FATAL_ERROR \"error: md5sum of '${_G4DATA_FILE}' does not match expected value
md5_expected: \${md5}
md5_actual: \${md5_actual}
\")
endif()
message(STATUS \"verifying ${_G4DATA_FILE} ... done\")
")
# - Write Unpack script
if(${_G4DATA_FILE} MATCHES "(\\.|=)(tar\\.gz|zip)$")
else()
message(FATAL_ERROR "error: do not know how to extract '${_G4DATA_FILE}' -- file needs to be .tar.gz or zip")
endif()
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Unpack.cmake "
message(STATUS \"unpacking ${_G4DATA_FILE} ...\")
file(MAKE_DIRECTORY ${_G4DATA_SOURCE_DIR})
execute_process(COMMAND
\${CMAKE_COMMAND} -E tar xfz \"${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
WORKING_DIRECTORY ${_G4DATA_SOURCE_DIR}
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(STATUS \"extracting... [error clean up]\")
file(REMOVE_RECURSE \"${_G4DATA_SOURCE_DIR}\")
message(FATAL_ERROR \"error: extract of '${_G4DATA_FILE}' failed\")
endif()
message(STATUS \"unpacking ${_G4DATA_FILE} ... done\")
")
# - Add custom commands for each step, each depending on the last
foreach(_step Download Verify Unpack)
if(_last_step)
set(_deps DEPENDS ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_last_step}.stamp)
endif()
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.stamp
COMMENT "${_step} ${_name}"
COMMAND "${CMAKE_COMMAND}" -P ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.cmake
COMMAND "${CMAKE_COMMAND}" -E touch ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.stamp
VERBATIM
${_deps}
)
set(_last_step ${_step})
endforeach()
# - Add the main target which will run all the above steps
add_custom_target(${_name} ALL
COMMENT "Completed ${_name}"
DEPENDS ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_last_step}.stamp
VERBATIM
)
endfunction()
#-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - USER INTERFACE AND PROCESSING
#-----------------------------------------------------------------------
+137 -158
View File
@@ -35,65 +35,108 @@
# Specific UI/Vis options are also handled here.
#
#-----------------------------------------------------------------------
# Select options first because these are interdependent
#
# - Coin3D/So{XT,Win,Qt}
option(GEANT4_USE_INVENTOR "Build Geant4 OpenInventor Xt/Win Visualization Driver" OFF)
geant4_add_feature(GEANT4_USE_INVENTOR "Build OpenInventor Xt/Win Driver")
option(GEANT4_USE_INVENTOR_QT "Build Geant4 OpenInventor Qt Visualization Driver" OFF)
geant4_add_feature(GEANT4_USE_INVENTOR_QT "Build OpenInventor Qt Driver")
# GEANT4_USE_INVENTOR is a dual-purpose variable - it marks use of Xt/Win driver for
# user, and marks enablement of G4OpenInventor internally. Check that user-set options
# are consistent before setting *internal* value
if(GEANT4_USE_INVENTOR AND GEANT4_USE_INVENTOR_QT)
message(FATAL_ERROR "Only one of GEANT4_USE_INVENTOR and GEANT4_USE_INVENTOR_QT can be set ON, but both are ON.")
endif()
# User settings o.k., so mark that we're enabling G4OpenInventor
if(GEANT4_USE_INVENTOR_QT)
set(GEANT4_USE_INVENTOR ON)
endif()
# - Qt (may be required by Coin driver)
option(GEANT4_USE_QT "Build Geant4 with Qt support" OFF)
if(GEANT4_USE_INVENTOR_QT AND NOT GEANT4_USE_QT)
set(GEANT4_USE_QT ON CACHE BOOL "Build Geant4 with Qt support" FORCE)
message(STATUS "Forcing GEANT4_USE_QT to ON, required by GEANT4_USE_INVENTOR_QT")
endif()
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt support")
# - Unix only
if(UNIX)
# - Client/Server DAWN driver
# mark as advanced because user should know what they're doing here
option(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKDAWN)
# - Client/Server VRML driver
option(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKVRML)
# - Motif UI/Vis (may be required by Coin Vis driver)
option(GEANT4_USE_XM "Build Geant4 with Motif (X11) support" OFF)
if(GEANT4_USE_INVENTOR AND NOT GEANT4_USE_INVENTOR_QT AND NOT GEANT4_USE_XM)
set(GEANT4_USE_XM ON CACHE BOOL "Build Geant4 with Motif (X11) support" FORCE)
message(STATUS "Forcing GEANT4_USE_XM to ON, required by GEANT4_USE_INVENTOR")
endif()
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
# OpenGL/X11 Vis Driver
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support" OFF)
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
# RayTracer driver with X11 support
option(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support" OFF)
geant4_add_feature(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
endif()
# Windows only
if(WIN32)
option(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
endif()
#-----------------------------------------------------------------------
# Find dependencies
#
# Prefer Legacy GL when using CMake >= 3.10
set(OpenGL_GL_PREFERENCE "LEGACY")
#-----------------------------------------------------------------------
# Configure OpenInventor support
#
option(GEANT4_USE_INVENTOR "Build Geant4 OpenInventor Visualization Driver" OFF)
option(GEANT4_USE_INVENTOR_QT "Build Geant4 OpenInventor Qt Visualization Driver" OFF)
if(GEANT4_USE_INVENTOR_QT)
set(GEANT4_USE_INVENTOR ON)
set(GEANT4_USE_QT ON)
endif()
# - Coin plus So{Xt,Qt,Win}
if(GEANT4_USE_INVENTOR)
# Always need Inventor and OpenGL
find_package(Inventor REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Coin 4.0.0 REQUIRED)
geant4_save_package_variables(Inventor Coin_DIR)
# On UNIX, we also require Xm and X11 (inc. Xpm)...
if(UNIX)
if (GEANT4_USE_INVENTOR_QT)
if (NOT INVENTOR_SOQT_LIBRARY OR NOT INVENTOR_SOQT_INCLUDE_DIR)
message(FATAL_ERROR "Could not find SoQt library and/or headers")
endif()
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOQT_INCLUDE_DIR}")
else()
if(NOT INVENTOR_SOXT_LIBRARY OR NOT INVENTOR_SOXT_INCLUDE_DIR)
message(FATAL_ERROR "Could not find SoXt library and/or headers")
endif()
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOXT_INCLUDE_DIR}")
set(GEANT4_USE_XM ON)
find_package(Motif REQUIRED)
endif()
find_package(X11 REQUIRED)
if(NOT X11_Xpm_FOUND)
message(FATAL_ERROR "Could not find X11 Xpm headers and/or library (Required by GEANT4_USE_INVENTOR)")
if(GEANT4_USE_INVENTOR_QT)
find_package(SoQt 1.6.0 REQUIRED)
geant4_save_package_variables(Inventor SoQt_DIR)
else()
if(UNIX)
find_package(SoXt 1.4.0 REQUIRED)
geant4_save_package_variables(Inventor SoXt_DIR)
set(GEANT4_USE_INVENTOR_XT ON)
elseif(WIN32)
find_package(SoWin 1.4.0 REQUIRED)
geant4_save_package_variables(Inventor SoWin_DIR)
set(GEANT4_USE_INVENTOR_WIN ON)
endif()
endif()
geant4_add_feature(GEANT4_USE_INVENTOR "Build OpenInventor Driver")
endif()
#-----------------------------------------------------------------------
# Configure Qt Support if needed (CROSSPLATFORM).
#
option(GEANT4_USE_QT "Build Geant4 with Qt support" OFF)
# - Qt5
if(GEANT4_USE_QT)
# Find and configure Qt and OpenGL
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
set(QT_QTCORE_LIBRARY Qt5::Core Qt5::PrintSupport)
set(QT_QTGUI_LIBRARY Qt5::Gui Qt5::Widgets)
set(QT_OPENGL_LIBRARY Qt5::Gui Qt5::OpenGL)
@@ -101,90 +144,72 @@ if(GEANT4_USE_QT)
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
geant4_save_package_variables(Qt5 Qt5Core_DIR Qt5Gui_DIR Qt5Widgets_DIR Qt5OpenGL_DIR Qt5PrintSupport_DIR)
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
# Qt3D is only supported on 5.15 and above, but always on if available
set(QT3D_MINIMUM_VERSION 5.15.0)
set(GEANT4_USE_QT3D OFF)
if(Qt5Core_VERSION GREATER_EQUAL QT3D_MINIMUM_VERSION)
find_package(Qt53DCore ${QT3D_MINIMUM_VERSION} QUIET)
find_package(Qt53DExtras ${QT3D_MINIMUM_VERSION} QUIET)
find_package(Qt53DRender ${QT3D_MINIMUM_VERSION} QUIET)
if(Qt53DCore_FOUND AND Qt53DExtras_FOUND AND Qt53DRender_FOUND)
set(GEANT4_USE_QT3D ON)
geant4_save_package_variables(Qt5 Qt53DCore_DIR Qt53DExtras_DIR Qt53DRender_DIR)
geant4_add_feature(GEANT4_USE_QT3D "Build Geant4 Qt3D driver")
else()
set(_g4_qt53d_missing)
if(NOT Qt53DCore_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DCore")
endif()
if(NOT Qt53DExtras_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DExtras")
endif()
if(NOT Qt53DRender_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DRender")
endif()
message(STATUS "Disabling Geant4 Qt3D driver, missing Qt5 packages: ${_g4_qt53d_missing}")
endif()
endif()
# Variables for export to GNUmake
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX OUTPUT_VARIABLE G4QTHOME OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS OUTPUT_VARIABLE G4QTLIBPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# OpenGL part of Qt is in OpenGL component so mark the need to
# add OpenGL.
# - OpenGL
if(GEANT4_USE_INVENTOR
OR GEANT4_USE_QT
OR GEANT4_USE_OPENGL_X11
OR GEANT4_USE_XM
OR GEANT4_USE_OPENGL_WIN32)
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
# X11 drivers on macOS need XQuartzGL
if(APPLE AND (GEANT4_USE_INVENTOR_XT OR GEANT4_USE_OPENGL_X11 OR GEANT4_USE_XM))
find_package(XQuartzGL REQUIRED)
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY)
endif()
# Enable driver
set(GEANT4_USE_OPENGL ON)
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt support")
endif()
#-----------------------------------------------------------------------
# Configure Wt Support
#
if(GEANT4_USE_WT)
message(WARNING "Support for Wt in Geant4 is no longer available and may be removed in future releases")
endif()
set(GEANT4_USE_WT OFF)
#option(GEANT4_USE_WT "Build Geant4 with Wt4 support" OFF)
#mark_as_advanced(GEANT4_USE_WT)
#
#if(GEANT4_USE_WT)
# # Find and configure Wt and OpenGL
# find_package(Wt REQUIRED)
# find_package(OpenGL REQUIRED)
#
# geant4_save_package_variables(Wt Wt_INCLUDE_DIR Wt_LIBRARY_RELEASE Wt_LIBRARY_DEBUG Wt_HTTP_LIBRARY_RELEASE Wt_HTTP_LIBRARY_DEBUG)
# geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
#
# set(WT_DEFINITIONS "-DQT_NO_KEYWORDS")
#
# # WebGL part of Wt is in OpenGL component so mark the need to
# # add OpenGL.
# set(GEANT4_USE_OPENGL ON)
# geant4_add_feature(GEANT4_USE_WT "Build Geant4 with Wt support")
#endif()
#-----------------------------------------------------------------------
# UNIX PLATFORMS ONLY
#-----------------------------------------------------------------------
if(UNIX)
# - Support for Client/Server DAWN driver
# mark as advanced because user should know what they're doing here
option(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support" OFF)
#
# Possible headers checks for needed network parts?
#
geant4_add_feature(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKDAWN)
# - Support for Client/Server VRML driver
# mark as advanced because user should know what they're doing to use this
option(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKVRML)
# - Configure Xm support if requested
option(GEANT4_USE_XM "Build Geant4 with Motif (X11) support" OFF)
# - Configure OpenGL X11 support if requested
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support" OFF)
# - X11 Support for RayTracer driver
option(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support" OFF)
# -- Now configure needed X11, Motif and OpenGL packages
# We also have to be concerned with Inventor on UNIX, because
# that also needs the Xt configuration...
# - X11
if(GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11 OR GEANT4_USE_RAYTRACER_X11 OR GEANT4_USE_INVENTOR)
if(GEANT4_USE_OPENGL_X11
OR GEANT4_USE_RAYTRACER_X11
OR GEANT4_USE_XM
OR GEANT4_USE_INVENTOR_XT)
find_package(X11 REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
# Check for additional required X11 libraries
# - Xmu
if(NOT X11_Xmu_FOUND)
message(FATAL_ERROR "could not find X11 Xmu library and/or headers")
endif()
# - Xt
if(NOT X11_Xt_FOUND)
message(FATAL_ERROR "could not find X11 Xt library and/or headers")
endif()
@@ -201,60 +226,14 @@ if(UNIX)
X11_Xmu_INCLUDE_PATH
X11_Xmu_LIB
X11_Xt_INCLUDE_PATH
X11_Xt_LIB
)
# - If we got to this point, RayTracer is o.k., so add the feature
geant4_add_feature(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
X11_Xt_LIB)
endif()
#- OpenGL : we also do this for Inventor so that we pick up Mac X11 GL...
if(GEANT4_USE_INVENTOR OR GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11)
# - Find native GL first
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
# - If we're on Apple, also find the XQuartz GL libraries and append t.
if(APPLE)
find_package(XQuartzGL REQUIRED)
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY)
endif()
# Add feature for X11 GL
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
endif()
# - Add need for OpenGL in X11 case
if(GEANT4_USE_OPENGL_X11 OR GEANT4_USE_XM)
set(GEANT4_USE_OPENGL ON)
endif()
# - Motif last of all, then can add the feature
# - Motif
if(GEANT4_USE_XM)
find_package(Motif REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
geant4_save_package_variables(Motif MOTIF_INCLUDE_DIR MOTIF_LIBRARIES)
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
endif()
endif()
#-----------------------------------------------------------------------
# WINDOWS PLATFORMS ONLY
#-----------------------------------------------------------------------
if(WIN32)
# - OpenGL Win32...
option(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
if(GEANT4_USE_OPENGL_WIN32)
# Just need OpenGL and on Windows, this should be easy...
find_package(OpenGL REQUIRED)
# This is part of the G4OpenGL component, so mark it as needed
set(GEANT4_USE_OPENGL ON)
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
endif()
endif()
# - and we're done...
+13 -6
View File
@@ -61,7 +61,7 @@ if(GEANT4_USE_SYSTEM_CLHEP)
set(__system_clhep_mode " (granular)")
endif()
find_package(CLHEP 2.3.3.0 REQUIRED ${__g4_clhep_components} CONFIG)
find_package(CLHEP 2.4.4.0 REQUIRED ${__g4_clhep_components} CONFIG)
geant4_save_package_variables(CLHEP CLHEP_DIR)
else()
@@ -185,7 +185,7 @@ else()
set(GEANT4_USE_BUILTIN_PTL TRUE)
set(PTL_LIBRARIES G4ptl)
endif()
mark_as_advanced(GEANT4_USE_SYSTEM_PTL)
geant4_add_feature(GEANT4_USE_SYSTEM_PTL "Using system PTL library")
#-----------------------------------------------------------------------
@@ -237,12 +237,20 @@ option(GEANT4_USE_TIMEMORY "Build Geant4 with TiMemory support" ${_default_use_t
mark_as_advanced(GEANT4_USE_TIMEMORY)
if(GEANT4_USE_TIMEMORY)
set(_G4timemory_DEFAULT_COMPONENTS headers caliper papi gotcha gperftools-cpu vector)
# by default just use the library which will import all the components that it
# was built with but once can add more
if(BUILD_SHARED_LIBS)
set(_G4timemory_DEFAULT_COMPONENTS cxx shared OPTIONAL_COMPONENTS)
else()
set(_G4timemory_DEFAULT_COMPONENTS cxx static OPTIONAL_COMPONENTS)
endif()
set(G4timemory_COMPONENTS "${_G4timemory_DEFAULT_COMPONENTS}" CACHE STRING
"timemory INTERFACE libraries that activate various capabilities in toolkit")
set(G4timemory_VERSION 3.0)
set(G4timemory_VERSION 3.2)
set(timemory_FIND_COMPONENTS_INTERFACE geant4-timemory)
add_library(geant4-timemory INTERFACE)
find_package(timemory ${G4timemory_VERSION} REQUIRED COMPONENTS ${G4timemory_COMPONENTS})
install(TARGETS geant4-timemory EXPORT Geant4LibraryDepends)
set(timemory_LIBRARIES geant4-timemory)
geant4_save_package_variables(timemory timemory_DIR)
endif()
@@ -325,8 +333,7 @@ endif()
# - Geant4 USolids/VecGom setup
if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
# VecGeom's config file doesn't support versioning...
find_package(VecGeom REQUIRED)
find_package(VecGeom 1.1.8 REQUIRED)
# Shim until VecGeom supports config mode properly
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
# Backward Compatibility
@@ -1,12 +0,0 @@
# - Macros for organizing and specializing code in Geant4 modules
# - DEPRECATED: Functionality merged into G4DeveloperAPI/_OLD
# Retained as many modules still include it
# Simply forward to new module
# - Include guard
if(__GEANT4MACRODEFINEMODULE_INCLUDED)
return()
endif()
set(__GEANT4MACRODEFINEMODULE_INCLUDED YES)
include(G4DeveloperAPI)
+1 -10
View File
@@ -1,12 +1,3 @@
# - Define useful macros for building and installing Geant4 library targets
# - DEPRECATED: Functionality merged into G4DeveloperAPI/_OLD
# Retained as many modules still include it
# Simply forward to new module
# - Include Guard
if(__GEANT4MACROLIBRARYTARGETS_INCLUDED)
return()
endif()
set(__GEANT4MACROLIBRARYTARGETS_INCLUDED TRUE)
include(G4DeveloperAPI)
# Retained as a no-op as many modules still include it
+79 -46
View File
@@ -67,6 +67,8 @@
#
# smartstack (G4event library G4StackManager uses G4SmartTrackStack)
#
# php_as_hp (G4processes library ParticleHP built as HP)
#
# Optional Components
# -------------------
# gdml (GDML support)
@@ -143,13 +145,6 @@
#
#-----------------------------------------------------------------------
# Support CMake >= 3.8
cmake_policy(VERSION 3.8)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Geant4Config requires CMake 3.8 or newer")
endif()
include(CMakeFindDependencyMacro)
#-----------------------------------------------------------------------
# DEBUG : print out the variables passed via find_package arguments
#
@@ -166,6 +161,23 @@ if(Geant4_CONFIG_DEBUG)
message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}")
endif()
#-----------------------------------------------------------------------
# Check that consumers use the minimum needed CMake version
# Geant4 uses cxx_std_EP to define the standard it was built against
# 3.8 and above support EP=11,14,17. 3.12 and above add 20. We continue
# to support the earlier version whilst checking for consumers using 20
cmake_policy(VERSION 3.8...3.18)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.8 or newer")
endif()
if(("@GEANT4_BUILD_CXXSTD@" GREATER_EQUAL 20) AND (CMAKE_VERSION VERSION_LESS 3.12))
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.12 or newer")
endif()
# - Help find dependencies
include(CMakeFindDependencyMacro)
#-----------------------------------------------------------------------
# Locate ourselves, since all other config files should have been
# installed alongside us...
@@ -298,6 +310,9 @@ endif()
# - Smart track stack
set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
# - ParticleHP as HP
set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_AS_HP@)
# - TBB
set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)
if(Geant4_TBB_FOUND)
@@ -309,8 +324,12 @@ set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@)
if(Geant4_timemory_FOUND)
set(_geant4_use_timemory_library ON)
set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4")
set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@)
find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET COMPONENTS @G4timemory_COMPONENTS@)
if(NOT TARGET @timemory_FIND_COMPONENTS_INTERFACE@)
add_library(@timemory_FIND_COMPONENTS_INTERFACE@ INTERFACE IMPORTED)
set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@)
find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET
COMPONENTS @G4timemory_COMPONENTS@)
endif()
set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@)
endif()
@@ -415,6 +434,7 @@ endif()
# - Qt (UI and Vis!)
set(Geant4_qt_FOUND @GEANT4_USE_QT@)
set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@)
if(Geant4_qt_FOUND)
# Must always refind Qt5 to recreate imported targets. Because these
# are in the public interface, always need linking.
@@ -424,10 +444,19 @@ if(Geant4_qt_FOUND)
find_dependency(Qt5OpenGL REQUIRED)
find_dependency(Qt5PrintSupport REQUIRED)
if(Geant4_qt3d_FOUND)
find_dependency(Qt53DCore @QT3D_MINIMUM_VERSION@ REQUIRED)
find_dependency(Qt53DExtras @QT3D_MINIMUM_VERSION@ REQUIRED)
find_dependency(Qt53DRender @QT3D_MINIMUM_VERSION@ REQUIRED)
endif()
# Also require OpenGL
find_dependency(OpenGL)
if(("qt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
# Qt must be activated both directly and for OpenInventor
if(("qt" IN_LIST Geant4_FIND_COMPONENTS)
OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_QT
@@ -435,25 +464,11 @@ if(Geant4_qt_FOUND)
-DG4VIS_USE_OPENGLQT
)
set(_geant4_use_opengl_library ON)
# Qt3D is always on if available
set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
endif()
endif()
# - Wt (UI and Vis!)
#set(Geant4_wt_FOUND @GEANT4_USE_WT@)
#if(Geant4_wt_FOUND)
# find_dependency(Wt)
# find_dependency(OpenGL)
# if(("wt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
# list(APPEND
# Geant4_DEFINITIONS
# -DG4INTY_USE_WT
# -DG4UI_USE_WT
# -DG4VIS_USE_OPENGLWT
# )
# set(_geant4_use_opengl_library ON)
# endif()
#endif()
# - Motif (UI and Vis!)
set(Geant4_motif_FOUND @GEANT4_USE_XM@)
if(Geant4_motif_FOUND)
@@ -461,12 +476,16 @@ if(Geant4_motif_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(Motif)
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
find_dependency(OpenGL)
if(APPLE)
find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif()
if(("motif" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
# Motif can be activated both directly and for OpenInventor
if(("motif" IN_LIST Geant4_FIND_COMPONENTS)
OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_XT
@@ -482,9 +501,10 @@ set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
if(Geant4_vis_opengl_x11_FOUND)
find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(OpenGL)
if(APPLE)
find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif()
if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
@@ -515,26 +535,31 @@ endif()
set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
if(Geant4_vis_openinventor_FOUND)
find_dependency(Coin)
if(Geant4_vis_openinventor_qt_FOUND)
# Qt dependency handled by Geant4_vis_qt_FOUND earlier,
# always ON if Inventor_QT is
find_dependency(SoQt)
else()
if(WIN32)
find_dependency(SoWin)
else()
# Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier,
# always ON if Inventor/Xt is.
find_dependency(SoXt)
endif()
endif()
if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
if(UNIX AND NOT WIN32)
if(Geant4_vis_openinventor_qt_FOUND)
list(APPEND Geant4_DEFINITIONS
-DG4VIS_USE_OI
-DG4VIS_USE_OIQT
)
if(Geant4_vis_openinventor_qt_FOUND)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIQT)
else()
if(WIN32)
list(APPEND Geant4_DEFINITIONS -G4INTY_USE_WIN32 -DG4VIS_USE_OI -DG4VIS_USE_OIWIN32)
else()
list(APPEND Geant4_DEFINITIONS
-DG4INTY_USE_XT
-DG4VIS_USE_OI
-DG4VIS_USE_OIX
)
list(APPEND Geant4_DEFINITIONS -DG4INTY_USE_XT -DG4VIS_USE_OI -DG4VIS_USE_OIX)
endif()
elseif(WIN32)
list(APPEND Geant4_DEFINITIONS
-G4INTY_USE_WIN32
-DG4VIS_USE_OI
-DG4VIS_USE_OIWIN32
)
endif()
set(_geant4_use_inventor_library ON)
@@ -601,6 +626,14 @@ if(_geant4_use_opengl_library)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL)
endif()
# - Qt3D if it's requested.
if(_geant4_use_qt3D_library)
list(APPEND _geant4_internal_libraries
Geant4::G4visQt3D${_geant4_lib_use_suffix}
)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_QT3D)
endif()
# - G4OpenInventor if it's requested.
if(_geant4_use_inventor_library)
list(APPEND _geant4_internal_libraries
+17 -4
View File
@@ -8,7 +8,7 @@
#-----------------------------------------------------------------------
# Determine location of this script.
# NB, we don't always use the result of this calculation, but it does not
# hurt to do it. Only possible error is if too long a chain of symbolic
# hurt to do it. Only possible error is if too long a chain of symbolic
# links are used to point to the physical script.
#
# Resolve symbolic links to script - we should end up with a physical file
@@ -32,8 +32,8 @@ while [ "x`readlink $script`" != "x" ] ; do
fi
done
# If we still have a relative path, then it must be relative to the
# calling dir. NB we don't attempt to resolve directory symbolic
# If we still have a relative path, then it must be relative to the
# calling dir. NB we don't attempt to resolve directory symbolic
# links or remove '.' or '..'
if [ ${script##/} = ${script##~} ] ; then
script="$calldir/$script"
@@ -102,6 +102,10 @@ if test "x${have_smartstack}" = "xyes" ; then
cflags="-DG4_USESMARTSTACK ${cflags}"
fi
# - ParticleHP was built as HP. Pure feature
have_php_as_hp="@G4_BUILTWITH_PHP_AS_HP@"
feature_list="${feature_list} php_as_hp[${have_php_as_hp}]"
# - Includes and Libs
for g4incdir in ${includedirs} ; do
cflags="${cflags} -I${g4incdir}"
@@ -200,6 +204,12 @@ if test "x${have_qt}" = "xyes" ; then
vis_cflags="${vis_cflags} \
-DG4INTY_USE_QT -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT @G4_QT_CFLAGS@"
if test "x${qt_version}" \< "5.15.0" ; then
vis_libs="-lG4visQt3D ${vis_libs}"
libs="-lG4visQt3D ${libs}"
vis_cflags="${vis_cflags} -DG4UI_USE_QT3D"
fi
geant4_uses_opengl="yes"
fi
@@ -395,7 +405,7 @@ install_datasets()
# Unpack bundle
echo "+ untar ${dataset_file}"
${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file}
${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file}
tar_status="$?"
if [ "$tar_status" != "0" ] ; then
echo "- untar of '${dataset_file}' failed : tar error $?"
@@ -601,6 +611,9 @@ while test $# -gt 0 ; do
openinventor)
echo ${have_openinventor}
;;
php_as_hp)
echo ${have_php_as_hp}
;;
*)
echo "no"
;;