Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
+12 -36
View File
@@ -217,14 +217,9 @@ set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTI
# - ``GEANT4_BUILD_MULTITHREADED`` (Default: ``OFF``)
#
# If set to ``ON``, compile Geant4 with support for multithreading.
# At present, this is only supported on Unix platforms.
# On Win32, this option requires use of static libraries only
#
option(GEANT4_BUILD_MULTITHREADED "Enable multithreading in Geant4" OFF)
if(WIN32)
mark_as_advanced(GEANT4_BUILD_MULTITHREADED)
endif()
geant4_add_feature(GEANT4_BUILD_MULTITHREADED "Build multithread enabled libraries")
#.rst:
@@ -233,8 +228,10 @@ geant4_add_feature(GEANT4_BUILD_MULTITHREADED "Build multithread enabled librari
# If ``GEANT4_BUILD_MULTITHREADED`` is ``ON`` and a GNU/Clang/Intel
# compiler is being used, then this option may be used to choose the
# Thread Local Storage model. A default of ``initial-exec`` is used
# to provide optimize performance for applications directly linking
# to the Geant4 libraries
# to provide optimal performance for applications directly linking
# to the Geant4 libraries. The dummy ``auto`` model may be selected
# to leave model selection to the compiler, with no additional flag(s)
# passed to the compiler.
#
if(GEANT4_BUILD_MULTITHREADED)
# - Need Thread Local Storage support (POSIX)
@@ -245,12 +242,6 @@ if(GEANT4_BUILD_MULTITHREADED)
endif()
endif()
# - Emit warning on Windows - message will format oddly on CMake prior
# to 2.8, but still print
if(WIN32)
message(WARNING "GEANT4_BUILD_MULTITHREADED IS NOT SUPPORTED on Win32. This option should only be activated by developers")
endif()
# - Allow advanced users to select the thread local storage model,
# if the compiler supports it, defaulting to that recommended by Geant4
if(TLSMODEL_IS_AVAILABLE)
@@ -260,9 +251,14 @@ if(GEANT4_BUILD_MULTITHREADED)
CASE_INSENSITIVE
)
mark_as_advanced(GEANT4_BUILD_TLS_MODEL)
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building with TLS model '${GEANT4_BUILD_TLS_MODEL}'")
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_FLAGS}")
if(GEANT4_BUILD_TLS_MODEL STREQUAL "auto")
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building without explicit TLS model")
else()
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building with TLS model '${GEANT4_BUILD_TLS_MODEL}'")
endif()
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_TLSMODEL_FLAGS}")
endif()
# Set Defs/Compiler Flags
@@ -349,8 +345,6 @@ endif()
# Library Mode and Link Options
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
#.rst:
# - ``BUILD_SHARED_LIBS`` (Default: ``ON``)
#
# - Build shared libraries (`.so` on Unix, `.dylib` on macOS, `.dll/.lib` on Windows)
@@ -378,24 +372,6 @@ if(GEANT4_BUILD_GRANULAR_LIBS)
message(FATAL_ERROR " Granular libraries are no longer supported!")
endif()
# On WIN32, we need to build the genwindef application to create export
# def files for building DLLs.
# We only use it as a helper application at the moment so we exclude it from
# the ALL target.
# TODO: We could move this section into the Geant4MacroLibraryTargets.cmake
# if it can be protected so that the genwindef target wouldn't be defined
# more than once... Put it here for now...
# TODO: Investigate use of CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS from CMake 3.4
# and/or other forms of symbol visibility
if(WIN32)
# Assume the sources are co-located
get_filename_component(_genwindef_src_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
add_executable(genwindef EXCLUDE_FROM_ALL
${_genwindef_src_dir}/genwindef/genwindef.cpp
${_genwindef_src_dir}/genwindef/LibSymbolInfo.h
${_genwindef_src_dir}/genwindef/LibSymbolInfo.cpp)
endif()
#------------------------------------------------------------------------
#.rst:
# Build Output Directories
+13 -50
View File
@@ -42,6 +42,7 @@ endif()
# - Needed CMake modules
include(CMakeParseArguments)
include(G4WindowsDLLSupport)
#-----------------------------------------------------------------------
#.rst:
@@ -246,60 +247,23 @@ macro(geant4_library_target)
if(BUILD_SHARED_LIBS)
# Add the shared library target and link its dependencies
# WIN32 first
if(WIN32)
# We have to generate the def export file from an archive library.
# This is a temporary separate from a real archive library, and
# even though it's static, we need to mark that it will have
# DLL symbols via the G4LIB_BUILD_DLL macro
add_library(_${G4LIBTARGET_NAME}-archive STATIC EXCLUDE_FROM_ALL ${G4LIBTARGET_SOURCES})
set(_archive _${G4LIBTARGET_NAME}-archive)
target_compile_features(${_archive} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_compile_definitions(${_archive} PUBLIC -DG4LIB_BUILD_DLL)
# - Add the config specific compile definitions
geant4_compile_definitions_config(${_archive})
# - Create the .def file for this library
# Use generator expressions to get path to per-mode lib and
# older CMAKE_CFG_INTDIR variable to set name of per-mode def
# file (Needed as generator expressions cannot be used in argument
# to OUTPUT...
add_custom_command(OUTPUT _${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def
COMMAND genwindef -o _${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def -l ${G4LIBTARGET_NAME} $<TARGET_FILE:${_archive}>
DEPENDS ${_archive} genwindef)
# - Now we can build the DLL
# We create it from a dummy empty C++ file plus the def file.
# Also set the public compile definition on it so that clients
# will set correct macro automatically.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/_${G4LIBTARGET_NAME}.cpp
"// empty _${G4LIBTARGET_NAME}.cpp\n")
add_library(${G4LIBTARGET_NAME} SHARED _${G4LIBTARGET_NAME}.cpp
_${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def)
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC -DG4LIB_BUILD_DLL)
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
# - Link the DLL.
# We link it to the archive, and the supplied libraries,
# but then remove the archive from the LINK_INTERFACE.
target_link_libraries(${G4LIBTARGET_NAME}
${_archive}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})
set_target_properties(${G4LIBTARGET_NAME}
PROPERTIES INTERFACE_LINK_LIBRARIES "${G4LIBTARGET_GEANT4_LINK_LIBRARIES};${G4LIBTARGET_LINK_LIBRARIES}")
# WIN32/CMake<3.4 workaround
if(WIN32 AND (CMAKE_VERSION VERSION_LESS 3.4))
__geant4_add_dll_old(${ARGV})
else()
# - We build a Shared library in the usual fashion...
# - Common shared lib commands
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_link_libraries(${G4LIBTARGET_NAME}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})
# 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)
endif()
# This property is set to prevent concurrent builds of static and
@@ -365,9 +329,8 @@ macro(geant4_library_target)
${G4LIBTARGET_LINK_LIBRARIES_STATIC})
# But we can rename the output library to the correct name
# On WIN32 we *retain* the -static postfix because otherwise
# we'll conflict with the .lib from the DLL build...
# We could also install differently...
# 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})
+116
View File
@@ -0,0 +1,116 @@
#.rst:
# G4WindowsDLLSupport
# -------------------
#
# Provides functions needed to support builds of DLLs both pre and post
# CMake 3.4. This version introduced the WINDOWS_EXPORT_ALL_SYMBOLS
# property, removing the need for the shipped `genwindef` program.
#
# With Geant4 10.4 and below having a minimum version requirement of
# CMake 3.3, we need to provide both so that patches can be applied
# to these versions without requiring clients to bump their CMake version.
#
#-----------------------------------------------------------------
# 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.
#
#-----------------------------------------------------------------
if(NOT __G4WINDOWSDLLSUPPORT_INCLUDED)
set(__G4WINDOWSDLLSUPPORT_INCLUDED)
else()
return()
endif()
# On WIN32, we need to build the genwindef application to create export
# def files for building DLLs.
# We only use it as a helper application at the moment so we exclude it from
# the ALL target.
if(WIN32)
# Assume the sources are co-located
get_filename_component(_genwindef_src_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
add_executable(genwindef EXCLUDE_FROM_ALL
${_genwindef_src_dir}/genwindef/genwindef.cpp
${_genwindef_src_dir}/genwindef/LibSymbolInfo.h
${_genwindef_src_dir}/genwindef/LibSymbolInfo.cpp)
endif()
#.rst:
# Macro for supporting DLL build on CMake < 3.4
macro(__geant4_add_dll_old)
# It's an error to call this on non-WIN32 platforms
if(NOT WIN32)
message(FATAL_ERROR "__geant4_add_dll_old is not callable on non-Windows platforms!")
endif()
# - Takes same args as geant4_library_target for compatibility
cmake_parse_arguments(__G4ADDOLDDLL
""
"NAME" "SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
${ARGN}
)
# We have to generate the def export file from an archive library.
# This is a temporary separate from a real archive library, and
# even though it's static, we need to mark that it will have
# DLL symbols via the G4LIB_BUILD_DLL macro
add_library(_${__G4ADDOLDDLL_NAME}-archive STATIC EXCLUDE_FROM_ALL ${__G4ADDOLDDLL_SOURCES})
set(_archive _${__G4ADDOLDDLL_NAME}-archive)
target_compile_features(${_archive} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_compile_definitions(${_archive} PUBLIC -DG4LIB_BUILD_DLL)
# - Add the config specific compile definitions
geant4_compile_definitions_config(${_archive})
# - Create the .def file for this library
# Use generator expressions to get path to per-mode lib and
# older CMAKE_CFG_INTDIR variable to set name of per-mode def
# file (Needed as generator expressions cannot be used in argument
# to OUTPUT...
add_custom_command(OUTPUT _${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def
COMMAND genwindef -o _${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def -l ${__G4ADDOLDDLL_NAME} $<TARGET_FILE:${_archive}>
DEPENDS ${_archive} genwindef)
# - Now we can build the DLL
# We create it from a dummy empty C++ file plus the def file.
# Also set the public compile definition on it so that clients
# will set correct macro automatically.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/_${__G4ADDOLDDLL_NAME}.cpp
"// empty _${__G4ADDOLDDLL_NAME}.cpp\n")
add_library(${__G4ADDOLDDLL_NAME} SHARED _${__G4ADDOLDDLL_NAME}.cpp
_${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def)
target_compile_definitions(${__G4ADDOLDDLL_NAME} PUBLIC -DG4LIB_BUILD_DLL)
target_compile_features(${__G4ADDOLDDLL_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
# - Link the DLL.
# We link it to the archive, and the supplied libraries,
# but then remove the archive from the LINK_INTERFACE.
target_link_libraries(${__G4ADDOLDDLL_NAME}
${_archive}
${__G4ADDOLDDLL_GEANT4_LINK_LIBRARIES}
${__G4ADDOLDDLL_LINK_LIBRARIES})
set_target_properties(${__G4ADDOLDDLL_NAME}
PROPERTIES INTERFACE_LINK_LIBRARIES "${__G4ADDOLDDLL_GEANT4_LINK_LIBRARIES};${__G4ADDOLDDLL_LINK_LIBRARIES}")
endmacro()
+4 -4
View File
@@ -18,11 +18,11 @@ geant4_add_dataset(
# - Low energy electromagnetics
geant4_add_dataset(
NAME G4EMLOW
VERSION 7.3
VERSION 7.4
FILENAME G4EMLOW
EXTENSION tar.gz
ENVVAR G4LEDATA
MD5SUM 0446e7f53af993343956e5d3900157b8
MD5SUM a4443411b1a8782640b6eec691e7c25f
)
# - Photon evaporation
@@ -48,11 +48,11 @@ geant4_add_dataset(
# - Neutron XS
geant4_add_dataset(
NAME G4NEUTRONXS
VERSION 1.4
VERSION 2.0
FILENAME G4NEUTRONXS
EXTENSION tar.gz
ENVVAR G4NEUTRONXSDATA
MD5SUM 665a12771267e3b31a08c622ba1238a7
MD5SUM c3af588c26522f289ec60dcb7c847ade
)
# - PII
+8 -4
View File
@@ -7,16 +7,20 @@
#-----------------------------------------------------------------------
# function __configure_tls_models()
# Set available thread local storage models. Valid for GNU,
# Clang and Intel compilers.
# Clang and Intel compilers. Adds an additional "auto"
# dummy model to indicate that no flag should be added.
#
function(__configure_tls_models)
# available models, default first
set(_TLSMODELS initial-exec local-exec global-dynamic local-dynamic)
foreach(_s ${_TLSMODELS})
set(${_s}_TLSMODEL_FLAGS "-ftls-model=${_s}" PARENT_SCOPE)
endforeach()
list(APPEND _TLSMODELS auto)
set(auto_TLSMODEL_FLAGS "" PARENT_SCOPE)
set(TLSMODEL_IS_AVAILABLE ${_TLSMODELS} PARENT_SCOPE)
foreach(_s ${_TLSMODELS})
set(${_s}_FLAGS "-ftls-model=${_s}" PARENT_SCOPE)
endforeach()
endfunction()
#-----------------------------------------------------------------------
@@ -191,6 +191,32 @@ endif()
GEANT4_ADD_FEATURE(GEANT4_USE_GDML "Building Geant4 with GDML support")
#-----------------------------------------------------------------------
# Optional Support for TiMemory -- cross-language timing and memory
# easily installed via:
# "pip install timemory" and pointing TiMemory_DIR to
# <install-prefix>/share/cmake/TiMemory
# e.g. -DTiMemory_DIR=/usr/local/share/cmake/TiMemory
# for /usr/local/bin/pip
#
if(TiMemory_DIR)
set(_default_use_timemory ON)
else()
set(_default_use_timemory OFF)
endif()
option(GEANT4_USE_TIMEMORY "Build Geant4 with TiMemory support"
${_default_use_timemory}
)
if(GEANT4_USE_TIMEMORY)
find_package(TiMemory REQUIRED)
# definition that enables macros
add_definitions(-DGEANT4_USE_TIMEMORY)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_TIMEMORY "Building Geant4 with TiMemory support")
#-----------------------------------------------------------------------
# Optional support for G3TOG4 convertion interface.
# We do not build the rztog4 application.
@@ -226,6 +252,7 @@ set(GEANT4_USOLIDS_SHAPES
POLYCONE
POLYHEDRA
SPHERE
TESSELLATEDSOLID
TET
TRAP
TRD