Skip to content

Commit

Permalink
Import Geant4 10.0.2 source tree
Browse files Browse the repository at this point in the history
  • Loading branch information
gcosmo committed Jun 10, 2016
1 parent 1251ac7 commit 412b899
Show file tree
Hide file tree
Showing 441 changed files with 47,373 additions and 44,573 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# 21st September 2010 Ben Morgan
#
# $Id: CMakeLists.txt 79108 2014-02-17 09:54:05Z gcosmo $
# $Id: CMakeLists.txt 82139 2014-06-11 10:58:09Z gcosmo $
#

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -51,10 +51,10 @@ set(CMAKE_MODULE_PATH
# See the documentation in each of these modules for further details.
#
# - Versioning. We do this here for now
set(${PROJECT_NAME}_VERSION "10.0.1")
set(${PROJECT_NAME}_VERSION "10.0.2")
set(${PROJECT_NAME}_VERSION_MAJOR "10")
set(${PROJECT_NAME}_VERSION_MINOR "0")
set(${PROJECT_NAME}_VERSION_PATCH "1")
set(${PROJECT_NAME}_VERSION_PATCH "2")

# - Provide dependent options as these are needed for some Geant4 features
include(CMakeDependentOption)
Expand Down
394 changes: 394 additions & 0 deletions ReleaseNotes/Patch4.10.0-2.txt

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions cmake/History
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,44 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].

----------------------------------------------------------

06th June 2014 - Ben Morgan (cmake-V09-06-49)
- Templates/geant4-config.in : Add zlib and g3tog4 to list of features
that --has-feature recognizes and can query (Patch from Ivana
Hrivnacova)

27th May 2014 - Ben Morgan (cmake-V09-06-48)
- Modules/Geant4MakeRules_cxx.cmake : Factor -ftls-model flag
out of GEANT4_MULTITHREADED_CXX_FLAGS and provide function
supplying available thread local storage model flag arguments.
Addresses JIRA DEV-142
- Modules/Geant4LibraryBuildOptions.cmake : Provide advanced option
to select thread local storage model when building multithreaded.
Default to supported initial-exec model. Addresses JIRA DEV-142.

26th May 2014 - Ben Morgan
- Modules/Geant4MakeRules_cxx.cmake : Add -DG4FPE_DEBUG to GNU/Clang
flags for Debug build mode. Added following discussion with Gunter
Folger to help developers diagnose FPE problems.

20th March 2014 - Ben Morgan (cmake-V09-06-47)
- Templates/Geant4Config.cmake.in : Fixes by Witold Pokorski for correct
static archive flags on Clang and syntax fixes for GNU.

6th March 2014 - Ben Morgan
- Modules/Geant4Config.cmake.in : When static libraries are used,
wrap G4physicslists library with flags suitable to import whole
archive. Implemented for GNU/Clang/Intel compilers. Other compilers
require further checks on flags and how to apply to single library.
This functionality is needed to support global registration of
factories.

5th March 2014 - Ben Morgan
- Modules/Geant4MacroLibraryTargets.cmake : Fixup usage of shared/static
builtin libraries. Ensure that shared builtins do not get linked to
static.
- Templates/Geant4Config.cmake.in : Add new component 'static' allowing
user to select static Geant4 libraries if they are available.

18th February 2014 - Ben Morgan (cmake-V09-06-46)
- Modules/Geant4ConfigureConfigScript.cmake : Export use of builtin
zlib or otherwise to geant4-config (Bugfix #1572).
Expand Down
17 changes: 17 additions & 0 deletions cmake/Modules/Geant4LibraryBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ endif()
# OFF by default. Switching on will enable multithreading, adding the
# G4MULTITHREADED definition globally and appending the relevant
# compiler flags to CMAKE_CXX_FLAGS
# Enabling the option allows advanced users to further select the
# thread local storage model if GNU/Clang/Intel compiler is used.
option(GEANT4_BUILD_MULTITHREADED "Enable multithreading in Geant4" OFF)

if(WIN32)
Expand All @@ -57,6 +59,21 @@ if(GEANT4_BUILD_MULTITHREADED)
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)
enum_option(GEANT4_BUILD_TLS_MODEL
DOC "Build libraries with Thread Local Storage model"
VALUES ${TLSMODEL_IS_AVAILABLE}
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}")
endif()

# Set Defs/Compiler Flags
add_definitions(-DG4MULTITHREADED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}")
endif()
Expand Down
36 changes: 23 additions & 13 deletions cmake/Modules/Geant4MacroLibraryTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ MACRO(GEANT4_LIBRARY_TARGET)
# but then remove the archive from the LINK_INTERFACE.
target_link_libraries(${G4LIBTARGET_NAME}
${_archive}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})

set_target_properties(${G4LIBTARGET_NAME}
Expand All @@ -109,15 +109,15 @@ MACRO(GEANT4_LIBRARY_TARGET)
else()
# - We build a Shared library in the usual fashion...
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
target_link_libraries(${G4LIBTARGET_NAME}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})
endif()

# This property is set to prevent concurrent builds of static and
# This property is set to prevent concurrent builds of static and
# shared libs removing each others files.
set_target_properties(${G4LIBTARGET_NAME}
set_target_properties(${G4LIBTARGET_NAME}
PROPERTIES CLEAN_DIRECT_OUTPUT 1)

# Set the INSTALL_NAME_DIR of the library to its final installation
Expand Down Expand Up @@ -159,16 +159,26 @@ MACRO(GEANT4_LIBRARY_TARGET)
list(APPEND G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC ${_tgt}-static)
endforeach()

target_link_libraries(${G4LIBTARGET_NAME}-static
# 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)(;|$)" "\\1-static\\2"
G4LIBTARGET_LINK_LIBRARIES_STATIC
"${G4LIBTARGET_LINK_LIBRARIES}"
)

target_link_libraries(${G4LIBTARGET_NAME}-static
${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC}
${G4LIBTARGET_LINK_LIBRARIES})
${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...
if(NOT WIN32)
set_target_properties(${G4LIBTARGET_NAME}-static
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES OUTPUT_NAME ${G4LIBTARGET_NAME})
endif()

Expand Down Expand Up @@ -288,13 +298,13 @@ MACRO(GEANT4_GLOBAL_LIBRARY_TARGET)
endif()

# Now add the library target
GEANT4_LIBRARY_TARGET(NAME ${G4GLOBLIB_NAME}
SOURCES
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
GEANT4_LIBRARY_TARGET(NAME ${G4GLOBLIB_NAME}
SOURCES
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
GEANT4_LINK_LIBRARIES
GEANT4_LINK_LIBRARIES
${${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES}
LINK_LIBRARIES
LINK_LIBRARIES
${${G4GLOBLIB_NAME}_LINK_LIBRARIES})

# Header install?
Expand Down
22 changes: 19 additions & 3 deletions cmake/Modules/Geant4MakeRules_cxx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ function(__configure_cxxstd_intel)
endforeach()
endfunction()

#-----------------------------------------------------------------------
# function __configure_tls_models()
# Set available thread local storage models. Valid for GNU,
# Clang and Intel compilers.
#
function(__configure_tls_models)
# available models, default first
set(_TLSMODELS initial-exec local-exec global-dynamic local-dynamic)

set(TLSMODEL_IS_AVAILABLE ${_TLSMODELS} PARENT_SCOPE)
foreach(_s ${_TLSMODELS})
set(${_s}_FLAGS "-ftls-model=${_s}" PARENT_SCOPE)
endforeach()
endfunction()

#-----------------------------------------------------------------------
# DEFAULT FLAG SETTING
Expand All @@ -133,7 +147,7 @@ endfunction()
# NB: At present, only identifies clang correctly on CMake > 2.8.1
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS_INIT "-W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g -DG4FPE_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
Expand All @@ -158,7 +172,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

# - Multithreading
set(GEANT4_MULTITHREADED_CXX_FLAGS "-ftls-model=initial-exec -pthread")
__configure_tls_models()
set(GEANT4_MULTITHREADED_CXX_FLAGS "-pthread")
endif()


Expand Down Expand Up @@ -202,7 +217,8 @@ if(CMAKE_CXX_COMPILER MATCHES "icpc.*|icc.*")
__configure_cxxstd_intel()

# - Multithreading
set(GEANT4_MULTITHREADED_CXX_FLAGS "-ftls-model=initial-exec -pthread")
__configure_tls_models()
set(GEANT4_MULTITHREADED_CXX_FLAGS "-pthread")

# Linker flags
set(CMAKE_EXE_LINKER_FLAGS "-i-dynamic -limf")
Expand Down
65 changes: 52 additions & 13 deletions cmake/Templates/Geant4Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,23 @@
# then the module will issue a FATAL_ERROR if this build of Geant4 does
# not have the requested component(s).
#
# The list of components available generally corresponds to the optional
# extras that Geant4 can be built with and are:
#
# multithreaded (Libraries built with multithreading support)
#
# The components available generally correspond to configurations of
# the Geant4 libraries or optional extras that Geant4 can be built with.
#
# Library Configuration
# ---------------------
# static (Static libraries available. Using this component
# when static libraries are available will result in
# Geant4_LIBRARIES being populated with the static
# versions of the Geant4 libraries. It does not
# guarantee the use of static third party libraries.)
# multithreaded (Libraries have multithreading support. Using this
# component will add the compiler definitions needed
# to activate multithread mode to Geant4_DEFINITIONS,
# if the libraries support it.)
#
# Optional Components
# -------------------
# gdml (GDML support)
# g3tog4 (Geant3 geometry call list reader library)
#
Expand Down Expand Up @@ -74,7 +86,7 @@
# argument is set. This is because these options do not depend on specific
# components being available.
#
# You can also query Geant4's use, or otherwise, of its builtin versions
# You can also query whether the Geant4 found uses the builtin versions
# of CLHEP, ZLIB and Expat after calling find_package via the variables
#
# Geant4_builtin_clhep_FOUND (TRUE if Geant4 built with internal CLHEP)
Expand All @@ -91,13 +103,13 @@
# system APIs as required, and you should use these to ensure you compile
# and link against the same API version.
#
# Environment variables for and directory paths to physics datasets
# Environment variables for, and directory paths to, physics datasets
# used by some Geant4 physics processes may be determined from the
# variables
#
# Geant4_DATASETS (List of dataset names known to Geant4)
# Geant4_DATASET_<NAME>_ENVVAR (Name of environment variable used by
# Geant4 to query for path to dataset
# Geant4 to obtain path to dataset
# <NAME>)
# Geant4_DATASET_<NAME>_PATH (Path to dataset <NAME>. NB this may
# point to a non-existent path if Geant4
Expand Down Expand Up @@ -440,19 +452,24 @@ endif()

#-----------------------------------------------------------------------
# Now perform final configuration of libraries...
# We provide FOUND variables for shared and static but for now we don't
# allow users to choose - we prefer shared if available, and fallback to
# static otherwise
#
# We provide FOUND variables for presence of shared and static
# User can supply "static" component to force use of static libraries, if
# available.
set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)
set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)

# - Default setting : shared if available, static otherwise
if(Geant4_shared_FOUND)
set(_geant4_lib_use_suffix "")
else()
set(_geant4_lib_use_suffix "-static")
endif()

if(Geant4_FIND_REQUIRED_static AND Geant4_static_FOUND)
set(_geant4_lib_use_suffix "-static")
list(REMOVE_ITEM Geant4_FIND_COMPONENTS static)
endif()

# The list of libraries probably should be autogenerated, but we hard code
# for now. We don't have to divide the list of shared libraries, but we
# do so for consistency with the way we'll need to do it for static.
Expand Down Expand Up @@ -487,6 +504,28 @@ if(_geant4_use_g3tog4_library)
set(_geant4_g3tog4_library G3toG4${_geant4_lib_use_suffix})
endif()

# - Factory registration mechanism in physics_lists requires whole
# archive to be linked when using static libs, so requires wrapping
# with suitable compiler dependent flags
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
if(_geant4_lib_use_suffix STREQUAL "-static")
# - Use CMAKE_CXX_COMPILER_ID, which should be reliable enough...
# Though the GNU/Clang/Intel compilers/linkers *should* use identical
# flags,keep their sections separate until behaviour confirmed
#
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(_geant4_physicslists_library -Wl,-force_load G4physicslists${_geant4_lib_use_suffix})
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
else()
# Needs determination of other compiler options.
# NB: MSVC has /OPT:NOREF, but may apply globally...
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
endif()
endif()

# - 'Kernel' libraries
list(APPEND _geant4_internal_libraries
G4vis_management${_geant4_lib_use_suffix}
Expand All @@ -497,7 +536,7 @@ list(APPEND _geant4_internal_libraries
G4analysis${_geant4_lib_use_suffix}
G4error_propagation${_geant4_lib_use_suffix}
G4readout${_geant4_lib_use_suffix}
G4physicslists${_geant4_lib_use_suffix}
${_geant4_physicslists_library}
G4run${_geant4_lib_use_suffix}
G4event${_geant4_lib_use_suffix}
G4tracking${_geant4_lib_use_suffix}
Expand Down
6 changes: 6 additions & 0 deletions cmake/Templates/geant4-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,18 @@ while test $# -gt 0 ; do
expat)
echo ${have_expat}
;;
zlib)
echo ${have_zlib}
;;
gdml)
echo ${have_gdml}
;;
usolids)
echo ${have_usolids}
;;
g3tog4)
echo ${have_g3tog4}
;;
qt)
echo ${have_qt}
;;
Expand Down
16 changes: 15 additions & 1 deletion config/History
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
svn log $Id: History 79120 2014-02-18 14:50:37Z gcosmo $
svn log $Id: History 81424 2014-05-28 13:21:06Z gcosmo $
-------------------------------------------------------------------

=========================================================
Expand All @@ -16,6 +16,20 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------

4th April 2014 Gabriele Cosmo (config-V09-06-19)
- Force loading of symbols for templated libraries in physics_lists modules
only for global libraries. Granular libraries not supporting physics_lists
factories.

27th March 2014 Gabriele Cosmo
- Replaced old win32def tool for extracting symbols definitions for
DLLs build on Windows with genwindef used also in CMake.

24th March 2014 Gabriele Cosmo
- Force loading of symbols for templated libraries in physics_lists modules.
Defined LDFLAGS for Linux and Darwin targets.
Modified binmake.gmk accordingly.

17th January 2014 Gabriele Cosmo (config-V09-06-18)
- Fixed setting of -fPIC also for Darwin targets.

Expand Down
Loading

0 comments on commit 412b899

Please sign in to comment.