Skip to content

Commit 6aa23be

Browse files
committed
Import Geant4 10.5.0.beta source tree
1 parent fe81a77 commit 6aa23be

File tree

1,581 files changed

+114929
-74399
lines changed

Some content is hidden

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

1,581 files changed

+114929
-74399
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# 21st September 2010 Ben Morgan
55
#
6-
# $Id: CMakeLists.txt 110078 2018-05-15 10:04:54Z gcosmo $
6+
# $Id: CMakeLists.txt 110849 2018-06-20 06:36:08Z gcosmo $
77
#
88

99
#-----------------------------------------------------------------------
@@ -37,8 +37,8 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
3737
# the same form.
3838
project(Geant4)
3939
set(${PROJECT_NAME}_VERSION_MAJOR 10)
40-
set(${PROJECT_NAME}_VERSION_MINOR 4)
41-
set(${PROJECT_NAME}_VERSION_PATCH 2)
40+
set(${PROJECT_NAME}_VERSION_MINOR 5)
41+
set(${PROJECT_NAME}_VERSION_PATCH 0)
4242
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")
4343

4444
# - Prepend our own CMake Modules to the search path

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
The Geant4 Collaboration:
2-
http://geant4.cern.ch/collaboration/members.shtml
2+
http://cern.ch/geant4/collaboration/members

README.md

-1
This file was deleted.

ReleaseNotes/Beta4.10.5-1.txt

+952
Large diffs are not rendered by default.

cmake/History

+58-6
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,77 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
3131

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

34-
23rd May 2018 - Gunter Folger (cmake-V10-03-54)
34+
19th June 2018 - Gunter Folger (cmake-V10-04-14)
35+
- Templates/geant4_validate_sources.cmake.in, revert addition of .c and .h
36+
Skip checking sources for zlib
37+
(.c and .h match far too many other files)
38+
- Switch to G4EMLOW7.4
39+
40+
14th June 2018 - Gunter Folger (cmake-V10-04-13)
41+
- Templates/geant4_validate_sources.cmake.in: add C sources and headers
42+
43+
8th June 2018 - Ben Morgan (cmake-V10-04-12)
44+
- Add "auto" dummy Thread Local Storage model
45+
Per request from CERN, when "auto" is used,
46+
no explicit compiler flag to select the TLS model is
47+
set. Record this in Geant4Config.cmake and geant4-config
48+
as unset/empty variables.
49+
50+
6th Jun 2018 - Jonathan Madsen (cmake-V10-04-11)
51+
- Addition of TiMemory as an optional package
52+
53+
23rd May 2018 - Ben Morgan (cmake-V10-04-10)
54+
- Remove CMake warning about building MT DLLs on Windows, as
55+
these are now supported.
56+
57+
23rd May 2018 - Gunter Folger (cmake-V10-04-09)
3558
- Update Geant4DatasetDefinitions to use G4RealSurface 2.1.1
3659
patched version bringing back data lost in 2.1
3760

38-
26th February 2018 - Ben Morgan (cmake-V10-03-53, 52)
61+
14st May 2018 - Gunter Folger (cmake-V10-04-08)
62+
- Update Geant4DatasetDefinitions to use G4NEUTRONXS 2.0
63+
64+
21st March 2018 - Ben Morgan (cmake-V10-04-07)
65+
- G4BuildSettings.cmake: Allow Windows MT builds to use DLLs, but warn.
66+
67+
26th February 2018 - Ben Morgan (cmake-V10-04-06)
3968
- Geant4InstallData.cmake, Geant4CTest.cmake: Update URL for downloads
4069
to "cern.ch/geant4-data" as the correct alias to new EOS area, seperate
41-
from main website. Superceeds cmake-V10-03-51.
70+
from main website.
4271

43-
26th February 2018 - Ben Morgan (cmake-V10-03-51)
72+
26th February 2018 - Ben Morgan (cmake-V10-04-05)
4473
- Geant4InstallData.cmake, Geant4CTest.cmake: Update URL for downloads
4574
to "cern.ch/geant4" as the correct alias.
4675

47-
26th February 2018 - Ben Morgan (cmake-V10-03-50)
76+
26th February 2018 - Ben Morgan (cmake-V10-04-04)
4877
- G4BuildSettings.cmake: Add 17/c++17 to C++ standards against which
4978
Geant4 can be compiled. Will require a minimum CMake version of
5079
3.8 to enable, but this is not checked.
5180

52-
8th December 2017 - Ben Morgan
81+
20th February 2018 - Ben Morgan (cmake-V10-04-03)
82+
- Initial configuration support for MT on Windows
83+
- Modules/G4BuildSettings.cmake: Remove restrictions and warnings on enabling
84+
MT on Windows. Add restriction on building MT DLLs, emitting a fatal error
85+
if this combination is selcted, and report needed settings to enable
86+
static MT libraries.
87+
88+
18th January 2018 - Ben Morgan (cmake-V10-04-02)
89+
- Support use of WINDOWS_EXPORT_ALL_SYMBOLS for DLL builds with cmake >=3.4
90+
retaining old capability for CMake 3.3.
91+
- Modules/G4WindowsDLLSupport.cmake: New module to hold old DLL support.
92+
Create old `genwindef` support program, moved from G4BuildSettings.
93+
Implement `__geant4_add_dll_old` macro which expands to the pre cmake 3.4
94+
use of `genwindef` to export symbols and create DLL.
95+
- Modules/G4DeveloperAPI_OLD.cmake: Include G4WindowsDLLSupport module, and
96+
use functionality to create DLL when CMake is <3.4. Otherwise, use
97+
new WINDOWS_EXPORT_ALL_SYMBOLS property when building a shared library.
98+
99+
11th January 2018 - Gabriele Cosmo (cmake-V10-04-01)
100+
- Modules/Geant4OptionalComponents.cmake: add TESSELLATEDSOLID flag to enable
101+
wrapping of G4TessellatedSolid in GEANT4_USOLIDS_SHAPES.
102+
Coworks with tag geom-specific-V10-04-03.
103+
104+
8th December 2017 - Ben Morgan (cmake-V10-04-00)
53105
- Templates/UseGeant4_internal.cmake: When running test driver directly,
54106
make it run in WORKING_DIRECTORY if this is supplied.
55107

cmake/Modules/G4BuildSettings.cmake

+12-36
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,9 @@ set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTI
217217
# - ``GEANT4_BUILD_MULTITHREADED`` (Default: ``OFF``)
218218
#
219219
# If set to ``ON``, compile Geant4 with support for multithreading.
220-
# At present, this is only supported on Unix platforms.
220+
# On Win32, this option requires use of static libraries only
221221
#
222222
option(GEANT4_BUILD_MULTITHREADED "Enable multithreading in Geant4" OFF)
223-
224-
if(WIN32)
225-
mark_as_advanced(GEANT4_BUILD_MULTITHREADED)
226-
endif()
227-
228223
geant4_add_feature(GEANT4_BUILD_MULTITHREADED "Build multithread enabled libraries")
229224

230225
#.rst:
@@ -233,8 +228,10 @@ geant4_add_feature(GEANT4_BUILD_MULTITHREADED "Build multithread enabled librari
233228
# If ``GEANT4_BUILD_MULTITHREADED`` is ``ON`` and a GNU/Clang/Intel
234229
# compiler is being used, then this option may be used to choose the
235230
# Thread Local Storage model. A default of ``initial-exec`` is used
236-
# to provide optimize performance for applications directly linking
237-
# to the Geant4 libraries
231+
# to provide optimal performance for applications directly linking
232+
# to the Geant4 libraries. The dummy ``auto`` model may be selected
233+
# to leave model selection to the compiler, with no additional flag(s)
234+
# passed to the compiler.
238235
#
239236
if(GEANT4_BUILD_MULTITHREADED)
240237
# - Need Thread Local Storage support (POSIX)
@@ -245,12 +242,6 @@ if(GEANT4_BUILD_MULTITHREADED)
245242
endif()
246243
endif()
247244

248-
# - Emit warning on Windows - message will format oddly on CMake prior
249-
# to 2.8, but still print
250-
if(WIN32)
251-
message(WARNING "GEANT4_BUILD_MULTITHREADED IS NOT SUPPORTED on Win32. This option should only be activated by developers")
252-
endif()
253-
254245
# - Allow advanced users to select the thread local storage model,
255246
# if the compiler supports it, defaulting to that recommended by Geant4
256247
if(TLSMODEL_IS_AVAILABLE)
@@ -260,9 +251,14 @@ if(GEANT4_BUILD_MULTITHREADED)
260251
CASE_INSENSITIVE
261252
)
262253
mark_as_advanced(GEANT4_BUILD_TLS_MODEL)
263-
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building with TLS model '${GEANT4_BUILD_TLS_MODEL}'")
264254

265-
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_FLAGS}")
255+
if(GEANT4_BUILD_TLS_MODEL STREQUAL "auto")
256+
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building without explicit TLS model")
257+
else()
258+
geant4_add_feature(GEANT4_BUILD_TLS_MODEL "Building with TLS model '${GEANT4_BUILD_TLS_MODEL}'")
259+
endif()
260+
261+
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_TLSMODEL_FLAGS}")
266262
endif()
267263

268264
# Set Defs/Compiler Flags
@@ -349,8 +345,6 @@ endif()
349345
# Library Mode and Link Options
350346
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
351347
#
352-
353-
#.rst:
354348
# - ``BUILD_SHARED_LIBS`` (Default: ``ON``)
355349
#
356350
# - Build shared libraries (`.so` on Unix, `.dylib` on macOS, `.dll/.lib` on Windows)
@@ -378,24 +372,6 @@ if(GEANT4_BUILD_GRANULAR_LIBS)
378372
message(FATAL_ERROR " Granular libraries are no longer supported!")
379373
endif()
380374

381-
# On WIN32, we need to build the genwindef application to create export
382-
# def files for building DLLs.
383-
# We only use it as a helper application at the moment so we exclude it from
384-
# the ALL target.
385-
# TODO: We could move this section into the Geant4MacroLibraryTargets.cmake
386-
# if it can be protected so that the genwindef target wouldn't be defined
387-
# more than once... Put it here for now...
388-
# TODO: Investigate use of CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS from CMake 3.4
389-
# and/or other forms of symbol visibility
390-
if(WIN32)
391-
# Assume the sources are co-located
392-
get_filename_component(_genwindef_src_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
393-
add_executable(genwindef EXCLUDE_FROM_ALL
394-
${_genwindef_src_dir}/genwindef/genwindef.cpp
395-
${_genwindef_src_dir}/genwindef/LibSymbolInfo.h
396-
${_genwindef_src_dir}/genwindef/LibSymbolInfo.cpp)
397-
endif()
398-
399375
#------------------------------------------------------------------------
400376
#.rst:
401377
# Build Output Directories

cmake/Modules/G4DeveloperAPI_OLD.cmake

+13-50
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ endif()
4242

4343
# - Needed CMake modules
4444
include(CMakeParseArguments)
45+
include(G4WindowsDLLSupport)
4546

4647
#-----------------------------------------------------------------------
4748
#.rst:
@@ -246,60 +247,23 @@ macro(geant4_library_target)
246247

247248
if(BUILD_SHARED_LIBS)
248249
# Add the shared library target and link its dependencies
249-
# WIN32 first
250-
if(WIN32)
251-
# We have to generate the def export file from an archive library.
252-
# This is a temporary separate from a real archive library, and
253-
# even though it's static, we need to mark that it will have
254-
# DLL symbols via the G4LIB_BUILD_DLL macro
255-
add_library(_${G4LIBTARGET_NAME}-archive STATIC EXCLUDE_FROM_ALL ${G4LIBTARGET_SOURCES})
256-
set(_archive _${G4LIBTARGET_NAME}-archive)
257-
target_compile_features(${_archive} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
258-
target_compile_definitions(${_archive} PUBLIC -DG4LIB_BUILD_DLL)
259-
260-
# - Add the config specific compile definitions
261-
geant4_compile_definitions_config(${_archive})
262-
263-
# - Create the .def file for this library
264-
# Use generator expressions to get path to per-mode lib and
265-
# older CMAKE_CFG_INTDIR variable to set name of per-mode def
266-
# file (Needed as generator expressions cannot be used in argument
267-
# to OUTPUT...
268-
add_custom_command(OUTPUT _${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def
269-
COMMAND genwindef -o _${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def -l ${G4LIBTARGET_NAME} $<TARGET_FILE:${_archive}>
270-
DEPENDS ${_archive} genwindef)
271-
272-
# - Now we can build the DLL
273-
# We create it from a dummy empty C++ file plus the def file.
274-
# Also set the public compile definition on it so that clients
275-
# will set correct macro automatically.
276-
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/_${G4LIBTARGET_NAME}.cpp
277-
"// empty _${G4LIBTARGET_NAME}.cpp\n")
278-
279-
add_library(${G4LIBTARGET_NAME} SHARED _${G4LIBTARGET_NAME}.cpp
280-
_${G4LIBTARGET_NAME}-${CMAKE_CFG_INTDIR}.def)
281-
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC -DG4LIB_BUILD_DLL)
282-
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
283-
284-
# - Link the DLL.
285-
# We link it to the archive, and the supplied libraries,
286-
# but then remove the archive from the LINK_INTERFACE.
287-
target_link_libraries(${G4LIBTARGET_NAME}
288-
${_archive}
289-
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
290-
${G4LIBTARGET_LINK_LIBRARIES})
291-
292-
set_target_properties(${G4LIBTARGET_NAME}
293-
PROPERTIES INTERFACE_LINK_LIBRARIES "${G4LIBTARGET_GEANT4_LINK_LIBRARIES};${G4LIBTARGET_LINK_LIBRARIES}")
294-
250+
# WIN32/CMake<3.4 workaround
251+
if(WIN32 AND (CMAKE_VERSION VERSION_LESS 3.4))
252+
__geant4_add_dll_old(${ARGV})
295253
else()
296-
# - We build a Shared library in the usual fashion...
254+
# - Common shared lib commands
297255
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
298256
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
299257
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
300258
target_link_libraries(${G4LIBTARGET_NAME}
301259
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
302260
${G4LIBTARGET_LINK_LIBRARIES})
261+
# DLL support, portable to all platforms
262+
# G4LIB_BUILD_DLL is public as despite the name it indicates the shared/archive mode
263+
# and clients must apply it when linking to the shared libs. The global
264+
# category handles the exact import/export statements
265+
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC G4LIB_BUILD_DLL)
266+
set_target_properties(${G4LIBTARGET_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
303267
endif()
304268

305269
# This property is set to prevent concurrent builds of static and
@@ -365,9 +329,8 @@ macro(geant4_library_target)
365329
${G4LIBTARGET_LINK_LIBRARIES_STATIC})
366330

367331
# But we can rename the output library to the correct name
368-
# On WIN32 we *retain* the -static postfix because otherwise
369-
# we'll conflict with the .lib from the DLL build...
370-
# We could also install differently...
332+
# On WIN32 we *retain* the -static postfix to avoid name clashes
333+
# with the DLL import lib.
371334
if(NOT WIN32)
372335
set_target_properties(${G4LIBTARGET_NAME}-static
373336
PROPERTIES OUTPUT_NAME ${G4LIBTARGET_NAME})

0 commit comments

Comments
 (0)