Skip to content

Commit 412b899

Browse files
committed
Import Geant4 10.0.2 source tree
1 parent 1251ac7 commit 412b899

File tree

441 files changed

+47373
-44573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

441 files changed

+47373
-44573
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# 21st September 2010 Ben Morgan
55
#
6-
# $Id: CMakeLists.txt 79108 2014-02-17 09:54:05Z gcosmo $
6+
# $Id: CMakeLists.txt 82139 2014-06-11 10:58:09Z gcosmo $
77
#
88

99
#------------------------------------------------------------------------------
@@ -51,10 +51,10 @@ set(CMAKE_MODULE_PATH
5151
# See the documentation in each of these modules for further details.
5252
#
5353
# - Versioning. We do this here for now
54-
set(${PROJECT_NAME}_VERSION "10.0.1")
54+
set(${PROJECT_NAME}_VERSION "10.0.2")
5555
set(${PROJECT_NAME}_VERSION_MAJOR "10")
5656
set(${PROJECT_NAME}_VERSION_MINOR "0")
57-
set(${PROJECT_NAME}_VERSION_PATCH "1")
57+
set(${PROJECT_NAME}_VERSION_PATCH "2")
5858

5959
# - Provide dependent options as these are needed for some Geant4 features
6060
include(CMakeDependentOption)

ReleaseNotes/Patch4.10.0-2.txt

Lines changed: 394 additions & 0 deletions
Large diffs are not rendered by default.

cmake/History

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,44 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
3131

3232
----------------------------------------------------------
3333

34+
06th June 2014 - Ben Morgan (cmake-V09-06-49)
35+
- Templates/geant4-config.in : Add zlib and g3tog4 to list of features
36+
that --has-feature recognizes and can query (Patch from Ivana
37+
Hrivnacova)
38+
39+
27th May 2014 - Ben Morgan (cmake-V09-06-48)
40+
- Modules/Geant4MakeRules_cxx.cmake : Factor -ftls-model flag
41+
out of GEANT4_MULTITHREADED_CXX_FLAGS and provide function
42+
supplying available thread local storage model flag arguments.
43+
Addresses JIRA DEV-142
44+
- Modules/Geant4LibraryBuildOptions.cmake : Provide advanced option
45+
to select thread local storage model when building multithreaded.
46+
Default to supported initial-exec model. Addresses JIRA DEV-142.
47+
48+
26th May 2014 - Ben Morgan
49+
- Modules/Geant4MakeRules_cxx.cmake : Add -DG4FPE_DEBUG to GNU/Clang
50+
flags for Debug build mode. Added following discussion with Gunter
51+
Folger to help developers diagnose FPE problems.
52+
53+
20th March 2014 - Ben Morgan (cmake-V09-06-47)
54+
- Templates/Geant4Config.cmake.in : Fixes by Witold Pokorski for correct
55+
static archive flags on Clang and syntax fixes for GNU.
56+
57+
6th March 2014 - Ben Morgan
58+
- Modules/Geant4Config.cmake.in : When static libraries are used,
59+
wrap G4physicslists library with flags suitable to import whole
60+
archive. Implemented for GNU/Clang/Intel compilers. Other compilers
61+
require further checks on flags and how to apply to single library.
62+
This functionality is needed to support global registration of
63+
factories.
64+
65+
5th March 2014 - Ben Morgan
66+
- Modules/Geant4MacroLibraryTargets.cmake : Fixup usage of shared/static
67+
builtin libraries. Ensure that shared builtins do not get linked to
68+
static.
69+
- Templates/Geant4Config.cmake.in : Add new component 'static' allowing
70+
user to select static Geant4 libraries if they are available.
71+
3472
18th February 2014 - Ben Morgan (cmake-V09-06-46)
3573
- Modules/Geant4ConfigureConfigScript.cmake : Export use of builtin
3674
zlib or otherwise to geant4-config (Bugfix #1572).

cmake/Modules/Geant4LibraryBuildOptions.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ endif()
3636
# OFF by default. Switching on will enable multithreading, adding the
3737
# G4MULTITHREADED definition globally and appending the relevant
3838
# compiler flags to CMAKE_CXX_FLAGS
39+
# Enabling the option allows advanced users to further select the
40+
# thread local storage model if GNU/Clang/Intel compiler is used.
3941
option(GEANT4_BUILD_MULTITHREADED "Enable multithreading in Geant4" OFF)
4042

4143
if(WIN32)
@@ -57,6 +59,21 @@ if(GEANT4_BUILD_MULTITHREADED)
5759
message(WARNING "GEANT4_BUILD_MULTITHREADED IS NOT SUPPORTED on Win32. This option should only be activated by developers")
5860
endif()
5961

62+
# - Allow advanced users to select the thread local storage model,
63+
# if the compiler supports it, defaulting to that recommended by Geant4
64+
if(TLSMODEL_IS_AVAILABLE)
65+
enum_option(GEANT4_BUILD_TLS_MODEL
66+
DOC "Build libraries with Thread Local Storage model"
67+
VALUES ${TLSMODEL_IS_AVAILABLE}
68+
CASE_INSENSITIVE
69+
)
70+
mark_as_advanced(GEANT4_BUILD_TLS_MODEL)
71+
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building with TLS model '${GEANT4_BUILD_TLS_MODEL}'")
72+
73+
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_FLAGS}")
74+
endif()
75+
76+
# Set Defs/Compiler Flags
6077
add_definitions(-DG4MULTITHREADED)
6178
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}")
6279
endif()

cmake/Modules/Geant4MacroLibraryTargets.cmake

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ MACRO(GEANT4_LIBRARY_TARGET)
100100
# but then remove the archive from the LINK_INTERFACE.
101101
target_link_libraries(${G4LIBTARGET_NAME}
102102
${_archive}
103-
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
103+
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
104104
${G4LIBTARGET_LINK_LIBRARIES})
105105

106106
set_target_properties(${G4LIBTARGET_NAME}
@@ -109,15 +109,15 @@ MACRO(GEANT4_LIBRARY_TARGET)
109109
else()
110110
# - We build a Shared library in the usual fashion...
111111
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
112-
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
112+
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
113113
target_link_libraries(${G4LIBTARGET_NAME}
114-
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
114+
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
115115
${G4LIBTARGET_LINK_LIBRARIES})
116116
endif()
117117

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

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

162-
target_link_libraries(${G4LIBTARGET_NAME}-static
162+
# If we are building both types of library and builtin clhep etc,
163+
# we want to link shared->shared and static->static.
164+
# Because externals like clhep appear in G4LIBTARGET_LINK_LIBRARIES,
165+
# filter this list to replace shared builtins with their static variant
166+
string(REGEX REPLACE
167+
"(G4clhep|G4expat|G4zlib)(;|$)" "\\1-static\\2"
168+
G4LIBTARGET_LINK_LIBRARIES_STATIC
169+
"${G4LIBTARGET_LINK_LIBRARIES}"
170+
)
171+
172+
target_link_libraries(${G4LIBTARGET_NAME}-static
163173
${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC}
164-
${G4LIBTARGET_LINK_LIBRARIES})
174+
${G4LIBTARGET_LINK_LIBRARIES_STATIC})
165175

166176
# But we can rename the output library to the correct name
167177
# On WIN32 we *retain* the -static postfix because otherwise
168178
# we'll conflict with the .lib from the DLL build...
169179
# We could also install differently...
170180
if(NOT WIN32)
171-
set_target_properties(${G4LIBTARGET_NAME}-static
181+
set_target_properties(${G4LIBTARGET_NAME}-static
172182
PROPERTIES OUTPUT_NAME ${G4LIBTARGET_NAME})
173183
endif()
174184

@@ -288,13 +298,13 @@ MACRO(GEANT4_GLOBAL_LIBRARY_TARGET)
288298
endif()
289299

290300
# Now add the library target
291-
GEANT4_LIBRARY_TARGET(NAME ${G4GLOBLIB_NAME}
292-
SOURCES
293-
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
301+
GEANT4_LIBRARY_TARGET(NAME ${G4GLOBLIB_NAME}
302+
SOURCES
303+
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
294304
${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
295-
GEANT4_LINK_LIBRARIES
305+
GEANT4_LINK_LIBRARIES
296306
${${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES}
297-
LINK_LIBRARIES
307+
LINK_LIBRARIES
298308
${${G4GLOBLIB_NAME}_LINK_LIBRARIES})
299309

300310
# Header install?

cmake/Modules/Geant4MakeRules_cxx.cmake

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ function(__configure_cxxstd_intel)
125125
endforeach()
126126
endfunction()
127127

128+
#-----------------------------------------------------------------------
129+
# function __configure_tls_models()
130+
# Set available thread local storage models. Valid for GNU,
131+
# Clang and Intel compilers.
132+
#
133+
function(__configure_tls_models)
134+
# available models, default first
135+
set(_TLSMODELS initial-exec local-exec global-dynamic local-dynamic)
136+
137+
set(TLSMODEL_IS_AVAILABLE ${_TLSMODELS} PARENT_SCOPE)
138+
foreach(_s ${_TLSMODELS})
139+
set(${_s}_FLAGS "-ftls-model=${_s}" PARENT_SCOPE)
140+
endforeach()
141+
endfunction()
128142

129143
#-----------------------------------------------------------------------
130144
# DEFAULT FLAG SETTING
@@ -133,7 +147,7 @@ endfunction()
133147
# NB: At present, only identifies clang correctly on CMake > 2.8.1
134148
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
135149
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")
136-
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
150+
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g -DG4FPE_DEBUG")
137151
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
138152
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
139153
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
@@ -158,7 +172,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
158172
endif()
159173

160174
# - Multithreading
161-
set(GEANT4_MULTITHREADED_CXX_FLAGS "-ftls-model=initial-exec -pthread")
175+
__configure_tls_models()
176+
set(GEANT4_MULTITHREADED_CXX_FLAGS "-pthread")
162177
endif()
163178

164179

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

204219
# - Multithreading
205-
set(GEANT4_MULTITHREADED_CXX_FLAGS "-ftls-model=initial-exec -pthread")
220+
__configure_tls_models()
221+
set(GEANT4_MULTITHREADED_CXX_FLAGS "-pthread")
206222

207223
# Linker flags
208224
set(CMAKE_EXE_LINKER_FLAGS "-i-dynamic -limf")

cmake/Templates/Geant4Config.cmake.in

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@
4242
# then the module will issue a FATAL_ERROR if this build of Geant4 does
4343
# not have the requested component(s).
4444
#
45-
# The list of components available generally corresponds to the optional
46-
# extras that Geant4 can be built with and are:
47-
#
48-
# multithreaded (Libraries built with multithreading support)
49-
#
45+
# The components available generally correspond to configurations of
46+
# the Geant4 libraries or optional extras that Geant4 can be built with.
47+
#
48+
# Library Configuration
49+
# ---------------------
50+
# static (Static libraries available. Using this component
51+
# when static libraries are available will result in
52+
# Geant4_LIBRARIES being populated with the static
53+
# versions of the Geant4 libraries. It does not
54+
# guarantee the use of static third party libraries.)
55+
# multithreaded (Libraries have multithreading support. Using this
56+
# component will add the compiler definitions needed
57+
# to activate multithread mode to Geant4_DEFINITIONS,
58+
# if the libraries support it.)
59+
#
60+
# Optional Components
61+
# -------------------
5062
# gdml (GDML support)
5163
# g3tog4 (Geant3 geometry call list reader library)
5264
#
@@ -74,7 +86,7 @@
7486
# argument is set. This is because these options do not depend on specific
7587
# components being available.
7688
#
77-
# You can also query Geant4's use, or otherwise, of its builtin versions
89+
# You can also query whether the Geant4 found uses the builtin versions
7890
# of CLHEP, ZLIB and Expat after calling find_package via the variables
7991
#
8092
# Geant4_builtin_clhep_FOUND (TRUE if Geant4 built with internal CLHEP)
@@ -91,13 +103,13 @@
91103
# system APIs as required, and you should use these to ensure you compile
92104
# and link against the same API version.
93105
#
94-
# Environment variables for and directory paths to physics datasets
106+
# Environment variables for, and directory paths to, physics datasets
95107
# used by some Geant4 physics processes may be determined from the
96108
# variables
97109
#
98110
# Geant4_DATASETS (List of dataset names known to Geant4)
99111
# Geant4_DATASET_<NAME>_ENVVAR (Name of environment variable used by
100-
# Geant4 to query for path to dataset
112+
# Geant4 to obtain path to dataset
101113
# <NAME>)
102114
# Geant4_DATASET_<NAME>_PATH (Path to dataset <NAME>. NB this may
103115
# point to a non-existent path if Geant4
@@ -440,19 +452,24 @@ endif()
440452

441453
#-----------------------------------------------------------------------
442454
# Now perform final configuration of libraries...
443-
# We provide FOUND variables for shared and static but for now we don't
444-
# allow users to choose - we prefer shared if available, and fallback to
445-
# static otherwise
446-
#
455+
# We provide FOUND variables for presence of shared and static
456+
# User can supply "static" component to force use of static libraries, if
457+
# available.
447458
set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)
448459
set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)
449460

461+
# - Default setting : shared if available, static otherwise
450462
if(Geant4_shared_FOUND)
451463
set(_geant4_lib_use_suffix "")
452464
else()
453465
set(_geant4_lib_use_suffix "-static")
454466
endif()
455467

468+
if(Geant4_FIND_REQUIRED_static AND Geant4_static_FOUND)
469+
set(_geant4_lib_use_suffix "-static")
470+
list(REMOVE_ITEM Geant4_FIND_COMPONENTS static)
471+
endif()
472+
456473
# The list of libraries probably should be autogenerated, but we hard code
457474
# for now. We don't have to divide the list of shared libraries, but we
458475
# do so for consistency with the way we'll need to do it for static.
@@ -487,6 +504,28 @@ if(_geant4_use_g3tog4_library)
487504
set(_geant4_g3tog4_library G3toG4${_geant4_lib_use_suffix})
488505
endif()
489506

507+
# - Factory registration mechanism in physics_lists requires whole
508+
# archive to be linked when using static libs, so requires wrapping
509+
# with suitable compiler dependent flags
510+
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
511+
if(_geant4_lib_use_suffix STREQUAL "-static")
512+
# - Use CMAKE_CXX_COMPILER_ID, which should be reliable enough...
513+
# Though the GNU/Clang/Intel compilers/linkers *should* use identical
514+
# flags,keep their sections separate until behaviour confirmed
515+
#
516+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
517+
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
518+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
519+
set(_geant4_physicslists_library -Wl,-force_load G4physicslists${_geant4_lib_use_suffix})
520+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
521+
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
522+
else()
523+
# Needs determination of other compiler options.
524+
# NB: MSVC has /OPT:NOREF, but may apply globally...
525+
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
526+
endif()
527+
endif()
528+
490529
# - 'Kernel' libraries
491530
list(APPEND _geant4_internal_libraries
492531
G4vis_management${_geant4_lib_use_suffix}
@@ -497,7 +536,7 @@ list(APPEND _geant4_internal_libraries
497536
G4analysis${_geant4_lib_use_suffix}
498537
G4error_propagation${_geant4_lib_use_suffix}
499538
G4readout${_geant4_lib_use_suffix}
500-
G4physicslists${_geant4_lib_use_suffix}
539+
${_geant4_physicslists_library}
501540
G4run${_geant4_lib_use_suffix}
502541
G4event${_geant4_lib_use_suffix}
503542
G4tracking${_geant4_lib_use_suffix}

cmake/Templates/geant4-config.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,18 @@ while test $# -gt 0 ; do
526526
expat)
527527
echo ${have_expat}
528528
;;
529+
zlib)
530+
echo ${have_zlib}
531+
;;
529532
gdml)
530533
echo ${have_gdml}
531534
;;
532535
usolids)
533536
echo ${have_usolids}
534537
;;
538+
g3tog4)
539+
echo ${have_g3tog4}
540+
;;
535541
qt)
536542
echo ${have_qt}
537543
;;

config/History

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
svn log $Id: History 79120 2014-02-18 14:50:37Z gcosmo $
1+
svn log $Id: History 81424 2014-05-28 13:21:06Z gcosmo $
22
-------------------------------------------------------------------
33

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

19+
4th April 2014 Gabriele Cosmo (config-V09-06-19)
20+
- Force loading of symbols for templated libraries in physics_lists modules
21+
only for global libraries. Granular libraries not supporting physics_lists
22+
factories.
23+
24+
27th March 2014 Gabriele Cosmo
25+
- Replaced old win32def tool for extracting symbols definitions for
26+
DLLs build on Windows with genwindef used also in CMake.
27+
28+
24th March 2014 Gabriele Cosmo
29+
- Force loading of symbols for templated libraries in physics_lists modules.
30+
Defined LDFLAGS for Linux and Darwin targets.
31+
Modified binmake.gmk accordingly.
32+
1933
17th January 2014 Gabriele Cosmo (config-V09-06-18)
2034
- Fixed setting of -fPIC also for Darwin targets.
2135

0 commit comments

Comments
 (0)