Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+102 -9
View File
@@ -27,28 +27,121 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
19th March 2021 - Gunter Folger (cmake-V10-06-52)
21 June 2021 - Julia Yarba (cmake-V10-07-28)
- Clean cmake/Modules/FindPythia8.cmake
(remove trailing whitespaces)
18 June 2021 - Julia Yarba (cmake-V10-07-27)
- Add cmake/Modules/FindPythia8.cmake
- Update cmake/Modules/G4ConfigureCMakeHelpers.cmake
8 June 2021 - Gunter Folger (cmake-V10-07-26)
- Switch to G4EMLOW 7.17
03 June 2021 - Ben Morgan (cmake-V10-07-25)
- Remove explicit setting of PTL_ cmake options.
- Add GEANT4_USE_PTL_LOCKS option to forward to internal PTL
as PTL_USE_LOCKS.
27 May 2021 - Ben Morgan (cmake-V10-07-24)
- Implement build/test script in Python to check for cycles in the
declared source module dependency graph.
25 May 2021 - Jonathan Madsen (cmake-V10-07-23)
- External PTL requires v2.0.0
25 May 2021 - Ben Morgan (cmake-V10-07-22)
- Clarify use of Freetype for both analysis and visualization
- Remove use of no longer required imported target shim for build
24 May 2021 - Ben Morgan (cmake-V10-07-21)
- Bump minimum CMake version to 3.12
22 May 2021 - Ben Morgan (cmake-V10-07-20)
- Qualify geant4_add_feature descriptions with "G4_" to distinguish them from
CMake property descriptions.
18 May 2021 - Ben Morgan (cmake-V10-07-19)
- Require C++17 as minimum standard to compile Geant4
- Allow compilation against C++23 with CMake 3.20 and newer
- Check for filesystem support in native or extension (GNU/Clang) libraries
15 May 2021 - Jonathan Madsen (cmake-V10-07-18)
- Set GEANT4_BUILD_BUILTIN_BACKTRACE to ON by default so novice
and intermediate users can, by default, get valuable information
on segmentation faults. Projects with their own signal handlers
can configure with this option off, set G4BACKTRACE="none" in
the environment, create their signal handlers after G4RunManager
gets created, or add `G4BackTrace::DefaultSignals() = std::set<int>{};`
before G4RunManager gets created.
10 May 2021 - John Allison (cmake-V10-07-17)
- With vis-V10-07-03, incorporating visman-V10-07-06 and vis_toolsg-V10-07-00.
Introduce a new vis driver, TOOLSSG (Guy Barrand).
o Four (mutually exclusive) options:
. TOOLSSG_X11_GLES
. TOOLSSG_WINDOWS_GLES
. TOOLSSG_XT_GLES
. TOOLSSG_QT_GLES
7 May 2021 - Gunter Folger (cmake-V10-07-16)
- Switch to G4EMLOW 7.16
4th May 2021 - Ben Morgan (cmake-V10-07-15)
- Remove obsolete -stdlib flag for AppleClang
3 May 2021 - Gunter Folger (cmake-V10-07-14)
- Switch to G4EMLOW 7.15
28 April 2021 - Ben Morgan (cmake-V10-07-13)
- Preliminary support for sanitizers
22 March 2021 - Alberto Ribon (cmake-V10-07-12)
- Modules/G4BuildSettings.cmake : removed deprecated PHP_AS_HP
environmental variable.
19th March 2021 - Gunter Folger (cmake-V10-07-11)
- Update to older G4TENDL 1.3.2, 1.4 has problems.
30th January 2021 - Gunter Folger (cmake-V10-06-51)
- Update to patched dataset G4PARTICLEXS 3.1.1 as provided by Vladimir I.
18 March 2021 - Ben Morgan (cmake-V10-07-10)
- Check for unparsed arguments in G4DeveloperAPI functions to
provide better validation against typos/etc in use
22nd January 2021 - Ben Morgan (cmake-V10-06-50)
09 March 2021 - John Allison (cmake-V10-07-09)
- Remove all references to Wt.
23 February 2021 - Ben Morgan (cmake-V10-07-08)
- Store PUBLIC/PRIVATE/INTERFACE module usage requirements explicitly
18th February 2021 - Ben Morgan (cmake-V10-07-07)
- Add G4tools target to CMake/GNUmake configuration following its
migration from analysis to externals categories.
4th February 2021 - Igor Semeniouk (cmake-V10-07-06)
- geant4.bat prototype
- hint to run geant4-config on windows
30th January 2021 - Gunter Folger (cmake-V10-07-05)
- Update to patched dataset G4PARTICLEXS 3.1.1 as provided by Vladimir I.
22nd January 2021 - Ben Morgan (cmake-V10-07-04)
- Update for GitHub PR #17: Provide same fix for MacPorts
- Address Bugzilla #2303: Fail configuration if Qt is enabled with CMake < 3.9
15th January 2021 - Ben Morgan (cmake-V10-06-49)
15th January 2021 - Ben Morgan (cmake-V10-07-03)
- Apply GitHub PR #17 from Florian Uhlig: Fix installation
error with Homebrew X11/GL.
error with Homebrew X11/GL.
11th January 2021 - Ben Morgan (cmake-V10-06-48)
11th January 2021 - Ben Morgan (cmake-V10-07-02)
- Apply GitHub PR #16 from andriish: Fix configure/build with
system PTL 1.0.0.
14th December 2020 - Ben Morgan (cmake-V10-06-47)
5th January 2010 - Gunter Folger (cmake-V10-07-01)
- Update to dataset G4EMLOW 7.14 as provided by Sebastien
8th November 2020 - Ben Morgan (cmake-V10-07-00)
- Install/Use builtin PTL CMake scripts from PTL subdirectory
alongside Geant4Config.cmake
+24
View File
@@ -0,0 +1,24 @@
# Locate Pythia8 library
# in a directory defined via PYTHIA8 environment variable
#
# Defines:
# PYTHIA8_FOUND
# PYTHIA8_LIBRARIES
# PYTHIA8_INCLUDES
find_library(PYTHIA8_LIBRARY NAMES pythia8
HINTS $ENV{PYTHIA8} $ENV{PYTHIA8}/lib)
set(PYTHIA8_LIBRARIES ${PYTHIA8_LIBRARY})
#message(STATUS PYTHIA8_LIBRARIES ${PYTHIA8_LIBRARIES} )
find_path( PYTHIA8_INCLUDES Pythia8/Pythia.h
HINTS $ENV{PYTHIA8} $ENV{PYTHIA8}/include $ENV{PYTHIA8}/include/Pythia8 )
set(PYTHIA8_INCLUDES ${PYTHIA8_INCLUDES})
# handle the QUIETLY and REQUIRED arguments and set PYTHIA8_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pythia8 DEFAULT_MSG PYTHIA8_LIBRARIES)
mark_as_advanced(PYTHIA8_FOUND PYTHIA8_LIBRARIES PYTHIA8_INCLUDES)
-144
View File
@@ -1,144 +0,0 @@
# Find Wt includes and libraries
#
# This script sets the following variables:
#
# Wt_INCLUDE_DIR
# Wt_LIBRARIES - Release libraries
# Wt_FOUND - True if release libraries found
# WT_FOUND - True if release libraries found
# Wt_DEBUG_LIBRARIES - Debug libraries
# Wt_DEBUG_FOUND - True if debug libraries found
#
# To direct the script to a particular Wt installation, use the
# standard cmake variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH
#
# To use this script to find Wt, when using the new style for include files:
# #include <Wt/WLineEdit>
# #include <Wt/Ext/LineEdit>
# #include <Wt/Chart/WPieChart>
#
# include the following CMake snippet in your project:
#
# FIND_PACKAGE( Wt REQUIRED )
# INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} )
# TARGET_LINK_LIBRARIES( yourexe
# ${Wt_DEBUG_LIBRARY} # or {Wt_LIBRARY}
# ${Wt_HTTP_DEBUG_LIBRARY} # or {Wt_HTTP_LIBRARY}
# ${Wt_EXT_DEBUG_LIBRARY} # or {Wt_EXT_LIBRARY}
# )
#
# To use this script to find Wt, when using the old include style:
# #include <WLineEdit>
# #include <Ext/LineEdit>
# #include <Chart/WPieChart>
# style of include files, change the INCLUDE_DIRECTORIES statement to:
# INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} ${Wt_INCLUDE_DIR}/Wt )
#
#
#
#
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
#
# Modifications Copyright (c) 2013, Ben Morgan, <Ben.Morgan@warwick.ac.uk>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
find_path(Wt_INCLUDE_DIR NAMES Wt/WObject PATHS ENV PATH PATH_SUFFIXES include wt )
include(SelectLibraryConfigurations)
find_library( Wt_LIBRARY_RELEASE NAMES wt PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_LIBRARY_DEBUG NAMES wtd PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt)
find_library( Wt_EXT_LIBRARY_RELEASE NAMES wtext PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_EXT_LIBRARY_DEBUG NAMES wtextd PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_EXT)
find_library( Wt_HTTP_LIBRARY_RELEASE NAMES wthttp PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_HTTP_LIBRARY_DEBUG NAMES wthttpd PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_HTTP)
find_library( Wt_FCGI_LIBRARY_RELEASE NAMES wtfcgi PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_FCGI_LIBRARY_DEBUG NAMES wtfcgid PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_FCGI)
find_library( Wt_DBO_LIBRARY_RELEASE NAMES wtdbo PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_DBO_LIBRARY_DEBUG NAMES wtdbod PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_DBO)
find_library( Wt_DBOSQLITE3_LIBRARY_RELEASE NAMES wtdbosqlite3 PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_DBOSQLITE3_LIBRARY_DEBUG NAMES wtdbosqlite3d PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_DBOSQLITE3)
find_library( Wt_DBOPOSTGRES_LIBRARY_RELEASE NAMES wtdbopostgres PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
find_library( Wt_DBOPOSTGRES_LIBRARY_DEBUG NAMES wtdbopostgresd PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
select_library_configurations(Wt_DBOPOSTGRES)
# Need at least Boost signals...
find_package(Boost REQUIRED signals)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Wt REQUIRED_VARS Wt_INCLUDE_DIR Wt_LIBRARY)
# - Create imported targets as needed by Geant4
if(Wt_FOUND)
# Main library
if(NOT TARGET Wt::Wt)
add_library(Wt::Wt UNKNOWN IMPORTED)
set_target_properties(Wt::Wt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Wt_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "Boost::signals;Boost::headers")
if(Wt_LIBRARY_RELEASE)
set_property(TARGET Wt::Wt APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Wt::Wt PROPERTIES
IMPORTED_LOCATION_RELEASE "${Wt_LIBRARY_RELEASE}")
endif()
if(Wt_LIBRARY_DEBUG)
set_property(TARGET Wt::Wt APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Wt::Wt PROPERTIES
IMPORTED_LOCATION_DEBUG "${Wt_LIBRARY_DEBUG}")
endif()
if(NOT Wt_LIBRARY_RELEASE AND NOT Wt_LIBRARY_DEBUG)
set_property(TARGET Wt::Wt APPEND PROPERTY
IMPORTED_LOCATION "${Wt_LIBRARY}")
endif()
endif()
# Components
foreach(__wt_target HTTP)
if(NOT TARGET Wt::${__wt_target})
add_library(Wt::${__wt_target} UNKNOWN IMPORTED)
set_target_properties(Wt::${__wt_target} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Wt_INCLUDE_DIR}")
if(Wt_${__wt_target}_LIBRARY_RELEASE)
set_property(TARGET Wt::${__wt_target} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Wt::${__wt_target} PROPERTIES
IMPORTED_LOCATION_RELEASE "${Wt_${__wt_target}_LIBRARY_RELEASE}")
endif()
if(Wt_${__wt_target}_LIBRARY_DEBUG)
set_property(TARGET Wt::${__wt_target} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Wt::${__wt_target} PROPERTIES
IMPORTED_LOCATION_DEBUG "${Wt_${__wt_target}_LIBRARY_DEBUG}")
endif()
if(NOT Wt_${__wt_target}_LIBRARY_RELEASE AND NOT Wt_${__wt_target}_LIBRARY_DEBUG)
set_property(TARGET Wt::${__wt_target} APPEND PROPERTY
IMPORTED_LOCATION "${Wt_${__wt_target}_LIBRARY}")
endif()
endif()
endforeach()
endif()
+97 -49
View File
@@ -156,70 +156,126 @@ endif() #NOT WIN32
#
#.rst
# - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, 20)
# - ``CMAKE_CXX_STANDARD`` (Allowed values: 17, 20, 23)
# - ``GEANT4_BUILD_CXXSTD`` (DEPRECATED)
#
# - 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)
if(MSVC)
set(__g4_default_cxxstd 17)
# - C++23 awareness is only available from CMake 3.20 onwards
set(__g4_default_cxxstd 17 20)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
list(APPEND __g4_default_cxxstd 23)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
list(APPEND __g4_default_cxxstd 20)
if(GEANT4_BUILD_CXXSTD)
message(WARNING
"The GEANT4_BUILD_CXXSTD argument is deprecated.\n"
"Please use CMAKE_CXX_STANDARD to set the required C++ Standard. "
"The value supplied will be used to set CMAKE_CXX_STANDARD, but this behaviour will "
"be removed in future releases.")
set(CMAKE_CXX_STANDARD ${GEANT4_BUILD_CXXSTD})
endif()
enum_option(GEANT4_BUILD_CXXSTD
enum_option(CMAKE_CXX_STANDARD
DOC "C++ Standard to compile against"
VALUES ${__g4_default_cxxstd}
CASE_INSENSITIVE
)
string(REGEX REPLACE "^c\\+\\+" "" GEANT4_BUILD_CXXSTD "${GEANT4_BUILD_CXXSTD}")
mark_as_advanced(GEANT4_BUILD_CXXSTD)
geant4_add_feature(GEANT4_BUILD_CXXSTD "Compiling against C++ Standard '${GEANT4_BUILD_CXXSTD}'")
mark_as_advanced(CMAKE_CXX_STANDARD)
geant4_add_feature(CMAKE_CXX_STANDARD "Compiling against C++ Standard '${CMAKE_CXX_STANDARD}'")
# 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.
# Setup required CXX variables: must not use vendor extensions, must require standard
# Set convenience variable for compile features to use
set(CMAKE_CXX_EXTENSIONS OFF)
set(GEANT4_TARGET_COMPILE_FEATURES
cxx_alias_templates
cxx_auto_type
cxx_delegating_constructors
cxx_enum_forward_declarations
cxx_explicit_conversions
cxx_final
cxx_lambdas
cxx_nullptr
cxx_override
cxx_range_for
cxx_strong_enums
cxx_uniform_initialization
cxx_std_${GEANT4_BUILD_CXXSTD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(GEANT4_TARGET_COMPILE_FEATURES cxx_std_${CMAKE_CXX_STANDARD})
# 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
# Emit early fatal error if we don't have a record of the requested 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}"))
if(NOT ("${CMAKE_CXX_COMPILE_FEATURES}" MATCHES "cxx_std_${CMAKE_CXX_STANDARD}"))
message(FATAL_ERROR
"Geant4 requested compilation using C++ standard '${GEANT4_BUILD_CXXSTD}' using compiler\n"
"Geant4 requested compilation using C++ standard '${CMAKE_CXX_STANDARD}' with 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
# e.g. Smart pointers are a library implementation feature
# and provide workarounds if needed
# - Check for Language/Standard Library Implementation Features
#
# - A very dumb wrapper round try_compile to give simple reporting
function(check_cxx_feature _flag _bindir _src)
try_compile(${_flag} ${_bindir} ${_src} ${ARGN})
# Can be simplified after 3.17 with CHECK_PASS/FAIL
set(__preamble "Checking C++ feature ${_flag} -")
if(${_flag})
message(STATUS "${__preamble} Success")
else()
message(STATUS "${__preamble} Failed")
endif()
endfunction()
# - Filesystem may be experimental/filesystem, and in stdc++fs (GCC/libstdc++), c++fs (Clang/libc++)
# G4global will provide this as a PUBLIC dependency, if required
# - native stdlib (nothing needed)
# - GNU: stdc++fs
# - Clang: c++fs
check_cxx_feature(CXXSTDLIB_FILESYSTEM_NATIVE
${PROJECT_BINARY_DIR}/cxx_filesystem/native
${PROJECT_SOURCE_DIR}/cmake/Modules/check_cxx_filesystem.cc)
if(NOT CXXSTDLIB_FILESYSTEM_NATIVE)
# GNU libstdc++fs
check_cxx_feature(CXXSTDLIB_FILESYSTEM_STDCXXFS
${PROJECT_BINARY_DIR}/cxx_filesystem/stdc++fs
${PROJECT_SOURCE_DIR}/cmake/Modules/check_cxx_filesystem.cc
LINK_LIBRARIES stdc++fs)
# LLVM libc++fs
check_cxx_feature(CXXSTDLIB_FILESYSTEM_CXXFS
${PROJECT_BINARY_DIR}/cxx_filesystem/c++fs
${PROJECT_SOURCE_DIR}/cmake/Modules/check_cxx_filesystem.cc
LINK_LIBRARIES c++fs)
endif()
# Derive name of library to link to
# Default is native...
if(CXXSTDLIB_FILESYSTEM_NATIVE)
set(GEANT4_CXX_FILESYSTEM_LIBRARY )
elseif(CXXSTDLIB_FILESYSTEM_STDCXXFS)
set(GEANT4_CXX_FILESYSTEM_LIBRARY "stdc++fs")
elseif(CXXSTDLIB_FILESYSTEM_CXXFS)
set(GEANT4_CXX_FILESYSTEM_LIBRARY "c++fs")
else()
message(FATAL_ERROR "No support for C++ filesystem found for compiler '${CMAKE_CXX_COMPILER_ID}', '${CMAKE_CXX_COMPILER_VERSION}'")
endif()
# Hold any appropriate compile flag(s) in variable for later export to
# non-cmake config files
set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTION}")
set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}")
#.rst:
# - ``GEANT4_BUILD_SANITIZER`` (Allowed values: none address thread undefined)
#
# - Build libraries with instrumentation of the given sanitizer
# - Only for GNU/Clang at the moment
# - VS 2019 16.9 supports asan: https://devblogs.microsoft.com/cppblog/address-sanitizer-for-msvc-now-generally-available/)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|.*Clang")
enum_option(GEANT4_BUILD_SANITIZER
DOC "Build libraries with sanitizer instrumentation"
VALUES none address thread undefined
CASE_INSENSITIVE)
mark_as_advanced(GEANT4_BUILD_SANITIZER)
if(NOT (GEANT4_BUILD_SANITIZER STREQUAL "none"))
# Add flags - longer term, make compile/link options
# frame pointer flag to get more meaningful stack traces
# May need others for better/reliable output
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=${GEANT4_BUILD_SANITIZER}")
geant4_add_feature(GEANT4_BUILD_SANITIZER "Compiling/linking with sanitizer '${GEANT4_BUILD_SANITIZER}'")
endif()
endif()
#-----------------------------------------------------------------------
# Multithreading
#-----------------------------------------------------------------------
@@ -278,19 +334,11 @@ endif()
# Physics
#-----------------------------------------------------------------------
#.rst:
# - ``GEANT4_BUILD_PHP_AS_HP`` (Default: OFF, ON if ``PHP_AS_HP`` set in environment)
# - ``GEANT4_BUILD_PHP_AS_HP`` (Default: OFF)
#
# - 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")
@@ -332,7 +380,7 @@ mark_as_advanced(GEANT4_BUILD_VERBOSE_CODE)
if(UNIX)
option(GEANT4_BUILD_BUILTIN_BACKTRACE
"Enable automatic G4Backtrace signal handling in G4RunManager. Switch off for applications implementing their own signal handling"
OFF)
ON)
mark_as_advanced(GEANT4_BUILD_BUILTIN_BACKTRACE)
endif()
+15
View File
@@ -112,6 +112,21 @@ add_custom_target(validate_sources
COMMENT "Validating Geant4 Module Source Lists"
)
#.rst:
# A custom ``validate_no_module_cycles`` is declared if Python3.9 is available.
# This runs the geant4_check_module_cycles Python script to check that the
# source module dependency graph has no cycles. It will fail if any cycles
# are found, listing the first found to stderr.
find_package(Python3 3.9 QUIET COMPONENTS Interpreter)
if(Python3_FOUND)
add_custom_target(validate_no_module_cycles
COMMAND Python3::Interpreter
${PROJECT_SOURCE_DIR}/cmake/Modules/geant4_check_module_cycles.py
-f ${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt
COMMENT "Checking for cycles in declared source module dependencies"
)
endif()
#-----------------------------------------------------------------------
#.rst:
# General Installation Settings
+4 -2
View File
@@ -135,7 +135,9 @@ function(geant4_add_feature _var _description)
set_property(GLOBAL APPEND PROPERTY GEANT4_DISABLED_FEATURES ${_var})
endif()
set_property(GLOBAL PROPERTY ${_var}_DESCRIPTION "${_description}")
# Property name qualified by "G4" prefix so we can provide seperate
# descriptions for CMake builtins we might expose (e.g. CXX_STANDARD)
set_property(GLOBAL PROPERTY G4_${_var}_DESCRIPTION "${_description}")
endfunction()
#-----------------------------------------------------------------------
@@ -149,7 +151,7 @@ function(geant4_print_enabled_features)
foreach(_feature ${_enabledFeatures})
set(_currentFeatureText "${_currentFeatureText}\n${_feature}")
get_property(_desc GLOBAL PROPERTY ${_feature}_DESCRIPTION)
get_property(_desc GLOBAL PROPERTY G4_${_feature}_DESCRIPTION)
if(_desc)
set(_currentFeatureText "${_currentFeatureText}: ${_desc}")
+2 -1
View File
@@ -168,6 +168,7 @@ configure_file(
COPYONLY
)
# Required for CMake clients between 3.8 and 3.10
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/G4FreetypeShim.cmake
${PROJECT_BINARY_DIR}/G4FreetypeShim.cmake
@@ -199,7 +200,7 @@ configure_file(
)
foreach(_mod AIDA HepMC Pythia6 StatTest TBB XQuartzGL)
foreach(_mod AIDA HepMC Pythia6 Pythia8 StatTest TBB XQuartzGL)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/Find${_mod}.cmake
${PROJECT_BINARY_DIR}/Modules/Find${_mod}.cmake
+177 -67
View File
@@ -152,6 +152,12 @@ macro(_g4tc_shell_setup SHELL_FAMILY)
set(GEANT4_TC_SHELL_FAMILY "C shell")
set(GEANT4_TC_UNSET_COMMAND "unsetenv")
set(GEANT4_TC_SHELL_EXTENSION ".csh")
elseif(${SHELL_FAMILY} STREQUAL "cmd")
#the variable GEANT4_TC_SHELL_PROGRAM is not used in .bat generation
set(GEANT4_TC_SHELL_PROGRAM "cmd.exe")
set(GEANT4_TC_SHELL_FAMILY "Windows cmd.exe")
set(GEANT4_TC_UNSET_COMMAND "set")
set(GEANT4_TC_SHELL_EXTENSION ".bat")
else()
message(FATAL_ERROR "Unsupported shell '${SHELL_FAMILY}'")
endif()
@@ -250,6 +256,22 @@ set ${LOCATION_VARIABLE}=\"`cd \${g4sls_sourced_dir} > /dev/null ; pwd`\"
# For C-shell, set the values of the guard variables
set(GEANT4_TC_IF_SELFLOCATED "" PARENT_SCOPE)
set(GEANT4_TC_ENDIF_SELFLOCATED "" PARENT_SCOPE)
elseif(${SHELL_FAMILY} STREQUAL "cmd")
set(${TEMPLATE_NAME}
"set ${LOCATION_VARIABLE}=
rem Self locate script when sourced
for /F %%i in (\"%0\") do set BINDIR=%%~dpi
set BINDIR=%BINDIR:~0,-1%
set ${LOCATION_VARIABLE}=%BINDIR%
rem unset temparary variable
set BINDIR=
"
PARENT_SCOPE
)
# Set the values of the guard variables
set(GEANT4_TC_IF_SELFLOCATED "" PARENT_SCOPE)
set(GEANT4_TC_ENDIF_SELFLOCATED "" PARENT_SCOPE)
endif()
endfunction()
@@ -269,6 +291,11 @@ function(_g4tc_setenv_command TEMPLATE_NAME SHELL_FAMILY VARIABLE_NAME VARIABLE_
"setenv ${VARIABLE_NAME} ${VARIABLE_VALUE}"
PARENT_SCOPE
)
elseif(${SHELL_FAMILY} STREQUAL "cmd")
set(${TEMPLATE_NAME}
"set ${VARIABLE_NAME}=${VARIABLE_VALUE}"
PARENT_SCOPE
)
endif()
endfunction()
@@ -301,6 +328,17 @@ endif
"
PARENT_SCOPE
)
# -- cmd.exe block
elseif(${SHELL_FAMILY} STREQUAL "cmd")
# Again, this is verbatim so final output is formatted correctly
set(${TEMPLATE_NAME}
"
IF NOT DEFINED ${VARIABLE_NAME} (
set ${VARIABLE_NAME}=${VARIABLE_VALUE}
)
"
PARENT_SCOPE
)
endif()
endfunction()
@@ -338,6 +376,17 @@ endif
"
PARENT_SCOPE
)
# -- cmd.exe block
elseif(${SHELL_FAMILY} STREQUAL "cmd")
# Assime verible name passed hire
set(${TEMPLATE_NAME}
"
set ${PATH_VARIABLE}=%${APPEND_VARIABLE}%;%${PATH_VARIABLE}%
set ${APPEND_VARIABLE}=
"
PARENT_SCOPE
)
endif()
endfunction()
@@ -375,6 +424,17 @@ endif
"
PARENT_SCOPE
)
# -- cmd.exe block
elseif(${SHELL_FAMILY} STREQUAL "cmd")
# Assime verible name passed hire
set(${TEMPLATE_NAME}
"
set ${PATH_VARIABLE}=%${PATH_VARIABLE}%;%${APPEND_VARIABLE}%
set ${APPEND_VARIABLE}=
"
PARENT_SCOPE
)
endif()
endfunction()
@@ -862,9 +922,14 @@ file(RELATIVE_PATH
)
set(TOOLS_FONT_PATH "\"`cd \$geant4_envbindir/${G4ENV_BINDIR_TO_DATADIR}/fonts > /dev/null ; pwd`\"")
# list of shells
set(shells_list bourne;cshell)
if(WIN32)
list(APPEND shells_list cmd)
endif()
# - Configure for each shell
foreach(_shell bourne;cshell)
foreach(_shell IN LISTS shells_list)
# Setup the shell
_g4tc_shell_setup(${_shell})
@@ -878,88 +943,133 @@ foreach(_shell bourne;cshell)
geant4_envbindir
)
# Set path, which should be where the script itself is installed
_g4tc_prepend_path(GEANT4_ENV_BINPATH_SETUP
${_shell}
PATH
"\"\$geant4_envbindir\""
)
# Set library path, based on relative paths between bindir and libdir
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
_g4tc_prepend_path(GEANT4_ENV_LIBPATH_SETUP
if(NOT ${_shell} STREQUAL cmd)
# Set path, which should be where the script itself is installed
_g4tc_prepend_path(GEANT4_ENV_BINPATH_SETUP
${_shell}
LD_LIBRARY_PATH
"\"`cd $geant4_envbindir/${G4ENV_BINDIR_TO_LIBDIR} > /dev/null ; pwd`\""
PATH
"\"\$geant4_envbindir\""
)
endif()
# Third party lib paths
# - CLHEP, if system
set(GEANT4_TC_CLHEP_LIB_PATH_SETUP "# - Builtin CLHEP used")
if(GEANT4_USE_SYSTEM_CLHEP)
# Handle granular vs singular cases
if(GEANT4_USE_SYSTEM_CLHEP_GRANULAR)
get_target_property(_CLHEP_LIB_DIR CLHEP::Vector LOCATION)
else()
get_target_property(_CLHEP_LIB_DIR CLHEP::CLHEP LOCATION)
endif()
get_filename_component(_CLHEP_LIB_DIR "${_CLHEP_LIB_DIR}" REALPATH)
get_filename_component(_CLHEP_LIB_DIR "${_CLHEP_LIB_DIR}" DIRECTORY)
# Set library path, based on relative paths between bindir and libdir
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
_g4tc_append_path(GEANT4_TC_CLHEP_LIB_PATH_SETUP
_g4tc_prepend_path(GEANT4_ENV_LIBPATH_SETUP
${_shell}
LD_LIBRARY_PATH
"${_CLHEP_LIB_DIR}"
"\"`cd $geant4_envbindir/${G4ENV_BINDIR_TO_LIBDIR} > /dev/null ; pwd`\""
)
else()
set(GEANT4_TC_CLHEP_LIB_PATH_SETUP "# System CLHEP in use, no configuration required")
endif()
endif()
# - XercesC
set(GEANT4_TC_XERCESC_LIB_PATH_SETUP "# GDML SUPPORT NOT AVAILABLE")
if(GEANT4_USE_GDML)
get_filename_component(_XERCESC_LIB_DIR "${XercesC_LIBRARY}" REALPATH)
get_filename_component(_XERCESC_LIB_DIR "${XercesC_LIBRARY}" DIRECTORY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
_g4tc_append_path(GEANT4_TC_XERCESC_LIB_PATH_SETUP
${_shell}
LD_LIBRARY_PATH
"${_XERCESC_LIB_DIR}"
)
else()
set(GEANT4_TC_XERCESC_LIB_PATH_SETUP "# GDML Supported, no configuration of Xerces-C required")
# Third party lib paths
# - CLHEP, if system
set(GEANT4_TC_CLHEP_LIB_PATH_SETUP "# - Builtin CLHEP used")
if(GEANT4_USE_SYSTEM_CLHEP)
# Handle granular vs singular cases
if(GEANT4_USE_SYSTEM_CLHEP_GRANULAR)
get_target_property(_CLHEP_LIB_DIR CLHEP::Vector LOCATION)
else()
get_target_property(_CLHEP_LIB_DIR CLHEP::CLHEP LOCATION)
endif()
get_filename_component(_CLHEP_LIB_DIR "${_CLHEP_LIB_DIR}" REALPATH)
get_filename_component(_CLHEP_LIB_DIR "${_CLHEP_LIB_DIR}" DIRECTORY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
_g4tc_append_path(GEANT4_TC_CLHEP_LIB_PATH_SETUP
${_shell}
LD_LIBRARY_PATH
"${_CLHEP_LIB_DIR}"
)
else()
set(GEANT4_TC_CLHEP_LIB_PATH_SETUP "# System CLHEP in use, no configuration required")
endif()
endif()
# - XercesC
set(GEANT4_TC_XERCESC_LIB_PATH_SETUP "# GDML SUPPORT NOT AVAILABLE")
if(GEANT4_USE_GDML)
get_filename_component(_XERCESC_LIB_DIR "${XercesC_LIBRARY}" REALPATH)
get_filename_component(_XERCESC_LIB_DIR "${XercesC_LIBRARY}" DIRECTORY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
_g4tc_append_path(GEANT4_TC_XERCESC_LIB_PATH_SETUP
${_shell}
LD_LIBRARY_PATH
"${_XERCESC_LIB_DIR}"
)
else()
set(GEANT4_TC_XERCESC_LIB_PATH_SETUP "# GDML Supported, no configuration of Xerces-C required")
endif()
endif()
endif()
# - Set data paths
set(GEANT4_ENV_DATASETS )
foreach(_ds ${GEANT4_EXPORTED_DATASETS})
_g4tc_setenv_command(_dssetenvcmd ${_shell} ${${_ds}_ENVVAR} ${${_ds}_PATH})
set(GEANT4_ENV_DATASETS "${GEANT4_ENV_DATASETS}${_dssetenvcmd}\n")
endforeach()
# - Set data paths
set(GEANT4_ENV_DATASETS )
foreach(_ds ${GEANT4_EXPORTED_DATASETS})
_g4tc_setenv_command(_dssetenvcmd ${_shell} ${${_ds}_ENVVAR} ${${_ds}_PATH})
set(GEANT4_ENV_DATASETS "${GEANT4_ENV_DATASETS}${_dssetenvcmd}\n")
endforeach()
# - Set Font Path
set(GEANT4_ENV_TOOLS_FONT_PATH "# FREETYPE SUPPORT NOT AVAILABLE")
if(GEANT4_USE_FREETYPE)
_g4tc_append_path(GEANT4_ENV_TOOLS_FONT_PATH
${_shell}
TOOLS_FONT_PATH
"${TOOLS_FONT_PATH}"
# - Set Font Path
set(GEANT4_ENV_TOOLS_FONT_PATH "# FREETYPE SUPPORT NOT AVAILABLE")
if(GEANT4_USE_FREETYPE)
_g4tc_append_path(GEANT4_ENV_TOOLS_FONT_PATH
${_shell}
TOOLS_FONT_PATH
"${TOOLS_FONT_PATH}"
)
endif()
# Configure the file
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-env-skeleton.in
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
@ONLY
)
else()
# message(STATUS "bat skeleton")
# Set path, which should be where the script itself is installed
# the varible synax differnt
_g4tc_prepend_path(GEANT4_ENV_BINPATH_SETUP
${_shell}
PATH
"geant4_envbindir"
)
## Set library path, based on relative paths between bindir and libdir
#if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# _g4tc_prepend_path(GEANT4_ENV_LIBPATH_SETUP
# ${_shell}
# LD_LIBRARY_PATH
# "\"`cd $geant4_envbindir/${G4ENV_BINDIR_TO_LIBDIR} > /dev/null ; pwd`\""
# )
# endif()
# Third party lib paths
# - CLHEP, if system
set(GEANT4_TC_CLHEP_LIB_PATH_SETUP "rem no configuration required")
# - XercesC
set(GEANT4_TC_XERCESC_LIB_PATH_SETUP "rem no configuration required")
# - Set data paths
set(GEANT4_ENV_DATASETS )
foreach(_ds ${GEANT4_EXPORTED_DATASETS})
file(TO_NATIVE_PATH ${${_ds}_PATH} _native_path)
_g4tc_setenv_command(_dssetenvcmd ${_shell} ${${_ds}_ENVVAR} ${_native_path})
set(GEANT4_ENV_DATASETS "${GEANT4_ENV_DATASETS}${_dssetenvcmd}\n")
endforeach()
# - Set Font Path
set(GEANT4_ENV_TOOLS_FONT_PATH "rem no configuration required")
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-bat-skeleton.in
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
@ONLY
)
endif()
# Configure the file
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-env-skeleton.in
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
@ONLY
)
# Install it to the required location
install(FILES
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
+40 -43
View File
@@ -104,11 +104,17 @@ endfunction()
#-----------------------------------------------------------------------
# Only create script if we have a global library build...
#
if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
#if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
if(NOT GEANT4_BUILD_GRANULAR_LIBS)
# Get implicit search paths
get_system_include_dirs(_cxx_compiler_dirs)
# Setup variables needed for expansion in configuration file
# - C++ Filesystem, if needed
if(GEANT4_CXX_FILESYSTEM_LIBRARY)
set(G4_LINK_CXX_FILESYSTEM "-l${GEANT4_CXX_FILESYSTEM_LIBRARY}")
endif()
# - Static libs
if(BUILD_STATIC_LIBS)
set(G4_BUILTWITH_STATICLIBS "yes")
@@ -255,20 +261,6 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_QT "no")
endif()
# - Wt
#if(GEANT4_USE_WT)
# set(G4_BUILTWITH_WT "yes")
# set(G4_WT_INCLUDE_DIRS ${Wt_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
# set(G4_WT_CFLAGS )
# foreach(_dir ${G4_WT_INCLUDE_DIRS})
# set(G4_WT_CFLAGS "${G4_WT_CFLAGS} -I${_dir}")
# endforeach()
#else()
# set(G4_BUILTWITH_WT "no")
#endif()
# - Motif
if(GEANT4_USE_XM)
set(G4_BUILTWITH_MOTIF "yes")
@@ -337,34 +329,20 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
geant4_export_datasets(BUILD GEANT4_CONFIG_DATASET_DESCRIPTIONS)
# Configure the build tree script
# If we're on CMake 2.8 and above, we try to use file(COPY) to create an
# executable script
# Not sure if version check is o.k., but I'll be shocked if we ever see
# a CMake 2.7 in the wild...
if(${CMAKE_VERSION} VERSION_GREATER 2.7)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config.in
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/geant4-config
@ONLY
)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config.in
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/geant4-config
@ONLY
)
file(COPY
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/geant4-config
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
else()
# Changing permissions is awkward, so just configure and document
# that you have to do 'sh geant4-config' in this case.
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config.in
${PROJECT_BINARY_DIR}/geant4-config
@ONLY
)
endif()
file(COPY
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/geant4-config
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# - Install Tree
# Much easier :-)
@@ -407,5 +385,24 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
WORLD_READ WORLD_EXECUTE
COMPONENT Development
)
endif()
# Win32 helper file geant4-config.cmd
if(WIN32)
# No configuration just a copy
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config-cmd.in
${PROJECT_BINARY_DIR}/InstallTreeFiles/geant4-config.cmd
@ONLY
)
# Install helper
install(FILES ${PROJECT_BINARY_DIR}/InstallTreeFiles/geant4-config.cmd
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
COMPONENT Development
)
endif()
endif()
+2 -2
View File
@@ -18,11 +18,11 @@ geant4_add_dataset(
# - Low energy electromagnetics
geant4_add_dataset(
NAME G4EMLOW
VERSION 7.13
VERSION 7.17
FILENAME G4EMLOW
EXTENSION tar.gz
ENVVAR G4LEDATA
MD5SUM 55922521aa331655a0494cdf8f9a70e8
MD5SUM 7cc8360a78fe6d501cdf34a945e71a25
)
# - Photon evaporation
+86 -35
View File
@@ -85,6 +85,7 @@ function(geant4_add_module _name)
"PUBLIC_HEADERS;SOURCES"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4ADDMOD geant4_add_module)
# - Check required directory structure at definition point
# Headers always
@@ -151,14 +152,14 @@ function(geant4_module_include_directories _module)
"PUBLIC;PRIVATE;INTERFACE"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4MODINCDIR geant4_module_include_directories)
foreach(_dir ${G4MODINCDIR_PUBLIC})
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_dir})
geant4_set_module_property(${_module} APPEND PROPERTY INCLUDE_DIRECTORIES ${_dir})
geant4_set_module_property(${_module} APPEND PROPERTY PUBLIC_INCLUDE_DIRECTORIES ${_dir})
endforeach()
foreach(_dir ${G4MODINCDIR_PRIVATE})
geant4_set_module_property(${_module} APPEND PROPERTY INCLUDE_DIRECTORIES ${_dir})
geant4_set_module_property(${_module} APPEND PROPERTY PRIVATE_INCLUDE_DIRECTORIES ${_dir})
endforeach()
foreach(_dir ${G4MODINCDIR_INTERFACE})
@@ -187,13 +188,14 @@ function(geant4_module_link_libraries _module)
"PUBLIC;PRIVATE;INTERFACE"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4MODLINKLIB geant4_module_link_libraries)
foreach(_lib ${G4MODLINKLIB_PUBLIC})
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY LINK_LIBRARIES ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY PUBLIC_LINK_LIBRARIES ${_lib})
endforeach()
foreach(_lib ${G4MODLINKLIB_PRIVATE})
geant4_set_module_property(${_module} APPEND PROPERTY LINK_LIBRARIES ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY PRIVATE_LINK_LIBRARIES ${_lib})
endforeach()
foreach(_dir ${G4MODLINKLIB_INTERFACE})
@@ -231,14 +233,14 @@ function(geant4_module_compile_definitions _module)
"PUBLIC;PRIVATE;INTERFACE"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4MODCOMPILEDEF geant4_module_compile_definitions)
foreach(_lib ${G4MODCOMPILEDEF_PUBLIC})
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY COMPILE_DEFINITIONS ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY PUBLIC_COMPILE_DEFINITIONS ${_lib})
endforeach()
foreach(_lib ${G4MODCOMPILEDEF_PRIVATE})
geant4_set_module_property(${_module} APPEND PROPERTY COMPILE_DEFINITIONS ${_lib})
geant4_set_module_property(${_module} APPEND PROPERTY PRIVATE_COMPILE_DEFINITIONS ${_lib})
endforeach()
foreach(_dir ${G4MODCOMPILEDEF_INTERFACE})
@@ -297,12 +299,15 @@ endfunction()
# * ``PUBLIC_HEADERS``
# * ``PRIVATE_HEADERS``
# * ``SOURCES``
# * ``PRIVATE_COMPILE_DEFINITIONS``
# * ``PUBLIC_COMPILE_DEFINITIONS``
# * ``INTERFACE_COMPILE_DEFINITIONS``
# * ``COMPILE_DEFINITIONS``
# * ``PRIVATE_INCLUDE_DIRECTORIES``
# * ``PUBLIC_INCLUDE_DIRECTORIES``
# * ``INTERFACE_INCLUDE_DIRECTORIES``
# * ``INCLUDE_DIRECTORIES``
# * ``PRIVATE_LINK_LIBRARIES``
# * ``PUBLIC_LINK_LIBRARIES``
# * ``INTERFACE_LINK_LIBRARIES``
# * ``LINK_LIBRARIES``
# * ``PARENT_TARGET``
# * ``CMAKE_LIST_FILE``
# * ``GLOBAL_DEPENDENCIES``
@@ -352,14 +357,15 @@ endfunction()
# emitted.
#
function(geant4_set_module_property _module)
__geant4_module_assert_exists(${_module})
cmake_parse_arguments(G4SMP
"APPEND;APPEND_STRING"
""
"PROPERTY"
${ARGN}
)
# module must exist!
__geant4_module_assert_exists(${_module})
__geant4_assert_no_unparsed_arguments(G4SMP geant4_set_module_property)
# Append/Append_string are mutually exclusive
if(G4SMP_APPEND AND G4SMP_APPEND_STRING)
@@ -490,6 +496,19 @@ function(geant4_compose_targets)
endif()
endforeach()
# - For each module, write out files for
# 1. module -> used modules adjacency list for detecting module-module cycles
file(WRITE "${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt" "# Geant4 Module - Module Adjacencies\n")
foreach(__module ${__g4definedmodules})
# Adjacency list - take all dependencies
geant4_get_module_property(__publicdeps ${__module} PUBLIC_LINK_LIBRARIES)
geant4_get_module_property(__privatedeps ${__module} PRIVATE_LINK_LIBRARIES)
geant4_get_module_property(__interfacedeps ${__module} INTERFACE_LINK_LIBRARIES)
set(__alldeps_l ${__publicdeps} ${__privatedeps} ${__interfacedeps})
list(JOIN __alldeps_l " " __alldeps)
file(APPEND "${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt" "${__module} ${__alldeps}\n")
endforeach()
# 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
@@ -563,6 +582,7 @@ function(geant4_define_module)
"HEADERS;SOURCES;GRANULAR_DEPENDENCIES;GLOBAL_DEPENDENCIES;LINK_LIBRARIES;HEADERS_EXCLUDE_FORMAT;SOURCES_EXCLUDE_FORMAT"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4DEFMOD geant4_define_module)
# HEADERS -> PUBLIC_HEADERS
# SOURCES -> SOURCES
# Don't support clang-formatting yet.
@@ -613,6 +633,7 @@ function(geant4_global_library_target)
"COMPONENTS"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4GLOBLIB geant4_global_library_target)
# Because components are sources.cmake files, must know currently defined modules
# so we can pick up the newly defined ones
@@ -671,6 +692,8 @@ function(geant4_library_target)
"SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4GLOBLIB geant4_library_target)
# Currently a hack to get G4clhep to build, so an error if used elsewhere
if(NOT (${G4GLOBLIB_NAME} MATCHES "G4clhep|G4expat"))
message(FATAL_ERROR "geant4_library_target called for '${G4GLOBLIB_NAME}' in '${CMAKE_CURRENT_LIST_DIR}'")
@@ -740,6 +763,7 @@ macro(geant4_add_compile_definitions)
"SOURCES;COMPILE_DEFINITIONS"
${ARGN}
)
__geant4_assert_no_unparsed_arguments(G4ADDDEF geant4_add_compile_definitions)
# 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
@@ -776,6 +800,29 @@ endmacro()
# module and library functions. They should never be used directly
# in developer-level scripts.
#-----------------------------------------------------------------------
#.rst:
# .. cmake:command:: __geant4_assert_no_unparsed_arguments
#
# .. code-block:: cmake
#
# __geant4_assert_no_unparsed_arguments(<prefix> <function>)
#
# Emit a ``FATAL_ERROR`` if ``<prefix>_UNPARSED_ARGUMENTS`` is non-empty
# in ``<function>``
#
# This is a macro intended for use in G4DeveloperAPI functions that cannot
# have unparsed arguments to validate their input.
#
# From CMake 3.17, the ``<function>`` argument is no longer required and
# ``CMAKE_CURRENT_FUNCTION`` can be used
#
macro(__geant4_assert_no_unparsed_arguments _prefix _function)
if(${_prefix}_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${_function} called with unparsed arguments: '${${_prefix}_UNPARSED_ARGUMENTS}'")
endif()
endmacro()
#-----------------------------------------------------------------------
#.rst:
# .. cmake:command:: __geant4_module_assert_exists
@@ -829,7 +876,7 @@ endmacro()
# This is used internally by the property get/set functions.
#
function(__geant4_module_validate_property _property)
if(NOT (${_property} MATCHES "PUBLIC_HEADERS|PRIVATE_HEADERS|SOURCES|INTERFACE_COMPILE_DEFINITIONS|COMPILE_DEFINITIONS|INTERFACE_INCLUDE_DIRECTORIES|INCLUDE_DIRECTORIES|INTERFACE_LINK_LIBRARIES|LINK_LIBRARIES|PARENT_TARGET|CMAKE_LIST_FILE|GLOBAL_DEPENDENCIES"))
if(NOT (${_property} MATCHES "PUBLIC_HEADERS|PRIVATE_HEADERS|SOURCES|PRIVATE_COMPILE_DEFINITIONS|PUBLIC_COMPILE_DEFINITIONS|INTERFACE_COMPILE_DEFINITIONS|PRIVATE_INCLUDE_DIRECTORIES|PUBLIC_INCLUDE_DIRECTORIES|INTERFACE_INCLUDE_DIRECTORIES|PRIVATE_LINK_LIBRARIES|PUBLIC_LINK_LIBRARIES|INTERFACE_LINK_LIBRARIES|PARENT_TARGET|CMAKE_LIST_FILE|GLOBAL_DEPENDENCIES"))
message(FATAL_ERROR "Undefined property '${_property}'")
endif()
endfunction()
@@ -918,16 +965,16 @@ function(__geant4_add_library _name _type)
target_sources(${_target_name} PRIVATE ${_headers} ${_srcs} ${_cmakescript})
# - Process usage properties
# Include dirs and compile definitions can be handled together
# Include dirs, compile definitions and libraries can be handled together
# Important to note that these promote PUBLIC/PRIVATE/INTERFACE
# from module level to library level. I.e. other modules in the
# library can see each other's PRIVATE include paths/compile defs.
# The only known way to fully wall things off is OBJECT libs,
# but then run into issues mentioned at start - linking and
# use in IDEs.
# use in IDEs (though newer CMake versions should resolve these)
# This "promotion" is probably correct though - interfaces are
# at physical library level rather than module, and in Geant4
# all files must have globally unique names (no nested hedaers
# all files must have globally unique names (no nested headers
# nor namespaces). Also, DLL export symbols may need this
# behaviour (esp. ALLOC_EXPORT).
# Only really an issue if header names/definitions aren't
@@ -937,15 +984,17 @@ function(__geant4_add_library _name _type)
# "Module" level really means "Source file" level, so same
# sets of rules should apply (i.e. can't specify inc dirs
# at source level).
foreach(_prop IN ITEMS INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES COMPILE_DEFINITIONS INTERFACE_COMPILE_DEFINITIONS)
geant4_get_module_property(_value ${__g4mod} ${_prop})
set_property(TARGET ${_target_name} APPEND PROPERTY ${_prop} ${_value})
endforeach()
foreach(_prop IN ITEMS PRIVATE PUBLIC INTERFACE)
geant4_get_module_property(_incdirs ${__g4mod} ${_prop}_INCLUDE_DIRECTORIES)
target_include_directories(${_target_name} ${_prop} ${_incdirs})
# Link libraries
foreach(_link_prop IN ITEMS LINK_LIBRARIES INTERFACE_LINK_LIBRARIES)
geant4_get_module_property(_linklibs ${__g4mod} ${_link_prop})
geant4_get_module_property(_defs ${__g4mod} ${_prop}_COMPILE_DEFINITIONS)
target_compile_definitions(${_target_name} ${_prop} ${_defs})
# Target linking requires additional processing to resolve
geant4_get_module_property(_linklibs ${__g4mod} ${_prop}_LINK_LIBRARIES)
geant4_resolve_link_libraries(_linklibs)
# Remove self-linking
if(_linklibs)
list(REMOVE_ITEM _linklibs ${_name})
@@ -966,17 +1015,17 @@ function(__geant4_add_library _name _type)
set(_linklibs ${_g4linklibs})
endif()
set_property(TARGET ${_target_name} APPEND PROPERTY ${_link_prop} ${_linklibs})
# Temp workaround for modules needing Qt. We use AUTOMOC, but can't yet set
# it on a per module basis. However, only have three modules that require
# moc-ing, so hard code for now.
# TODO: likely need an additional "module target properties" to hold things
# that can be passed to set_target_properties
if(__g4mod MATCHES "G4UIbasic|G4OpenGL|G4OpenInventor" AND GEANT4_USE_QT)
set_target_properties(${_target_name} PROPERTIES AUTOMOC ON)
endif()
target_link_libraries(${_target_name} ${_prop} ${_linklibs})
endforeach()
# Temp workaround for modules needing Qt. We use AUTOMOC, but can't yet set
# it on a per module basis. However, only have three modules that require
# moc-ing, so hard code for now.
# TODO: likely need an additional "module target properties" to hold things
# that can be passed to set_target_properties
if(__g4mod MATCHES "G4UIbasic|G4OpenGL|G4OpenInventor" AND GEANT4_USE_QT)
set_target_properties(${_target_name} PROPERTIES AUTOMOC ON)
endif()
endforeach()
# - Use stored total list of sources to create format target for one mode only
@@ -985,6 +1034,8 @@ function(__geant4_add_library _name _type)
endif()
# - Postprocess target properties to remove duplicates
# NB: This makes the assumption that there is no order dependence here (and any is considered a bug!)
# CMake will handle static link ordering internally
foreach(_link_prop IN ITEMS LINK_LIBRARIES INTERFACE_LINK_LIBRARIES INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES COMPILE_DEFINITIONS INTERFACE_COMPILE_DEFINITIONS)
get_target_property(__g4lib_link_libs ${_target_name} ${_link_prop})
if(__g4lib_link_libs)
+18 -6
View File
@@ -12,7 +12,6 @@
# UI category : Built on supported platforms when Third Party
# library(libraries) available
# G4UIQt : UNIX, WIN32 (Requires : Qt5)
# G4UIWt : Web (Requires : Wt) DEPRECATED
# G4UIXm : UNIX
#
# Vis Category: Always built on supported platforms
@@ -95,12 +94,30 @@ if(UNIX)
# 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")
# ToolsSG X11/GLES driver
option(GEANT4_USE_TOOLSSG_X11_GLES "Build Geant4 ToolsSG driver with X11/GLES support" OFF)
geant4_add_feature(GEANT4_USE_TOOLSSG_X11_GLES "Build Geant4 ToolsSG driver with X11/GLES support")
# ToolsSG Xt/GLES driver
option(GEANT4_USE_TOOLSSG_XT_GLES "Build Geant4 ToolsSG driver with Xt/GLES support" OFF)
geant4_add_feature(GEANT4_USE_TOOLSSG_XT_GLES "Build Geant4 ToolsSG driver with Xt/GLES support")
# ToolsSG Qt/GLES driver
option(GEANT4_USE_TOOLSSG_QT_GLES "Build Geant4 ToolsSG driver with Qt/GLES support" OFF)
geant4_add_feature(GEANT4_USE_TOOLSSG_QT_GLES "Build Geant4 ToolsSG driver with Qt/GLES 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")
# ToolsSG Windows/GLES driver
option(GEANT4_USE_TOOLSSG_WINDOWS_GLES "Build Geant4 ToolsSG driver with Windows/GLES support" OFF)
geant4_add_feature(GEANT4_USE_TOOLSSG_WINDOWS_GLES "Build Geant4 ToolsSG driver with Windows/GLES support")
endif()
#-----------------------------------------------------------------------
@@ -132,11 +149,6 @@ endif()
# - Qt5
if(GEANT4_USE_QT)
# Must have CMake > 3.8 to support automoc (Bugzilla 2303)
if(CMAKE_VERSION VERSION_LESS 3.9)
message(FATAL_ERROR "GEANT4_USE_QT requires CMake 3.9 or newer to support automatic MOC for UI/Vis libraries")
endif()
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
-5
View File
@@ -46,11 +46,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} -Qunused-arguments -DGL_SILENCE_DEPRECATION")
endif()
# Though it should be the default, always use libc++ with AppleClang
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} -stdlib=libc++")
endif()
# Extra Geant4 modes
# - Debug_FPE: Core Debug mode plus FPE)
set(CMAKE_CXX_FLAGS_DEBUG_FPE_INIT "${CMAKE_CXX_FLAGS_DEBUG_INIT} -DG4FPE_DEBUG")
+8 -8
View File
@@ -16,7 +16,7 @@
# G3TOG4 - UNIX only
# USOLIDS - Allow use of VecGeom classes in geometry, and must find
# external VecGeom install
# FREETYPE - For analysis module, find external FreeType install
# FREETYPE - For analysis/vis modules, find external FreeType install
#-----------------------------------------------------------------------
# CLHEP
@@ -175,12 +175,11 @@ geant4_add_feature(GEANT4_USE_TBB "Enable (optional) use of TBB as a tasking bac
# Rely on PTL::PTL imported target (since CMake 3.1)
option(GEANT4_USE_SYSTEM_PTL "Use system zlib library" OFF)
if(GEANT4_USE_SYSTEM_PTL)
find_package(PTL REQUIRED)
find_package(PTL 2.0.0 REQUIRED)
# Backward compatibility for sources.cmake using the variable
set(PTL_LIBRARIES PTL::ptl)
geant4_save_package_variables(PTL PTL_DIR)
else()
set(PTL_USE_TBB ${GEANT4_USE_TBB})
set(PTL_FOUND TRUE)
set(GEANT4_USE_BUILTIN_PTL TRUE)
set(PTL_LIBRARIES G4ptl)
@@ -188,6 +187,10 @@ endif()
mark_as_advanced(GEANT4_USE_SYSTEM_PTL)
geant4_add_feature(GEANT4_USE_SYSTEM_PTL "Using system PTL library")
# Internal PTL offers adding locks in task queues to help debugging
cmake_dependent_option(GEANT4_USE_PTL_LOCKS "Enable mutex locking in PTL task subqueues" OFF "NOT GEANT4_USE_SYSTEM_PTL" OFF)
mark_as_advanced(GEANT4_USE_PTL_LOCKS)
#-----------------------------------------------------------------------
# Optional Support for GDML - requires Xerces-C package
# Relies on XercesC::XercesC imported target (since CMake 3.5)
@@ -363,14 +366,11 @@ endif()
#-----------------------------------------------------------------------
# Optional support for Freetype - Requires external Freetype install
#
option(GEANT4_USE_FREETYPE "Build Geant4 analysis library with Freetype support" OFF)
option(GEANT4_USE_FREETYPE "Build Geant4 Analysis/Visualization with Freetype support" OFF)
mark_as_advanced(GEANT4_USE_FREETYPE)
if(GEANT4_USE_FREETYPE)
find_package(Freetype REQUIRED)
# Shim only needed until we require CMake >= 3.10
include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake")
geant4_save_package_variables(Freetype
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
@@ -378,7 +378,7 @@ if(GEANT4_USE_FREETYPE)
FREETYPE_LIBRARY_RELEASE)
endif()
geant4_add_feature(GEANT4_USE_FREETYPE "Building Geant4 analysis library with Freetype support")
geant4_add_feature(GEANT4_USE_FREETYPE "Building Geant4 Analysis/Visualization with Freetype support")
#-----------------------------------------------------------------------
# Optional support for HDF5
+15
View File
@@ -0,0 +1,15 @@
// Check that trivial use of <filesystem> works
// - https://en.cppreference.com/w/cpp/filesystem
#include <iostream>
#if __has_include( <filesystem>)
# include <filesystem>
namespace fs = std::filesystem;
#elif __has_include( <experimental/filesystem>)
# include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
int main( int argc, char* argv[] ) {
fs::path p{ argv[0] };
std::cout << p << ", " << fs::canonical( p ) << std::endl;
}
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Check Geant4's module dependency graph for cycles
Geant4 organises source code into "Modules", with each Module being a
directory containing headers and sources in `include/` and `src/`
subdirectories respectively. One or more Modules are grouped/compiled
into the actual libraries.
CMake will raise errors if there are circular dependencies between
shared libraries (cycles are allowed between static libraries). However,
CMake cannot detect cycles between Modules directly, are these are a
Geant4 construct. Whilst cycles between modules that get added to the
same library are technically o.k., they still indicate either:
- A bad design/organisation of code
- A mistake in the declared dependencies for a module(s)
To help developers and CI pick module cycles, Geant4's CMake scripts
write out the declared module dependencies in a text file as an Adjacency
List graph. This comprises one line per module, with the first column
being the module name, and any remaining columns being the modules the
first one "depends on", i.e. uses code from.
This program reads that file and uses Python's graphlib module to try
topologically sorting this graph. Failure to sort indicates a cycle, and
this will be printed to stdout and a non-zero return code emitted on exit.
"""
import argparse
import graphlib
import sys
if __name__ == "__main__":
# Parse command line to get file to load
parser = argparse.ArgumentParser(
description=str(__doc__), formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument(
"-f",
"--file",
required=True,
metavar="FILE",
help="file to read adjacency list from",
)
parser.add_argument(
"-v",
"--verbose",
action="store_true",
help="print topologically sorted list of modules",
)
args = parser.parse_args()
try:
# 1. Try and construct graph from input adjancey list file
adjList = {}
with open(args.file) as f:
for line in f:
if not line.strip().startswith("#"):
nodes = line.rstrip("\n").split(" ")
adjList[nodes[0]] = nodes[1:]
if not adjList:
print(f"warning: graph read from '{args.file}' is empty")
# NB also possible with networkx, but requires pip install:
# G = nx.read_adjlist(args.file, create_using=nx.DiGraph)
# cycles = nx.find_cycle(G, orientation='original')
# Topo sort throws cycle error if one occurs during prepare
ts = graphlib.TopologicalSorter(adjList)
ts.prepare()
# Verbose print of nodes in topological order
# NB: This uses the full graphlib interface in case we want to
# print out nodes grouped by level in the graph.
if args.verbose:
while ts.is_active():
nodes = ts.get_ready()
for n in nodes:
print(n)
ts.done(*nodes)
print(f"pass: No cycles detected in graph defined in '{args.file}'")
except OSError as err:
print(f"OS error: {err}")
sys.exit(1)
except graphlib.CycleError as err:
print(
f"error: cycles detected in input graph from '{args.file}':",
file=sys.stderr,
)
cycle = " <- ".join(err.args[1])
print(f"cycle: {cycle}", file=sys.stderr)
sys.exit(1)
+99 -8
View File
@@ -89,6 +89,11 @@
# vis_raytracer_x11 (RayTracer visualization with X11 interface)
# vis_openinventor (OpenInventor visualization)
#
# vis_toolssg_x11_gles (ToolsSG visualization with X11 windowing and GLES rendering)
# vis_toolssg_xt_gles (ToolsSG visualization with Xt windowing and GLES rendering)
# vis_toolssg_qt_gles (ToolsSG visualization with Qt windowing and GLES rendering)
# vis_toolssg_windows_gles (ToolsSG visualization with Windows windowing and GLES rendering)
#
# In addition, two 'shorthand' components are defined to help activate all
# available User Interface and Visualization drivers:
#
@@ -164,15 +169,19 @@ 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
# 3.8 and above support EP=17. 3.12 and above add 20. 3.20 and above add 23.
# 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")
if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) AND (CMAKE_VERSION VERSION_LESS 3.20))
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.20 or newer (for C++23 support)")
endif()
if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) AND (CMAKE_VERSION VERSION_LESS 3.12))
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.12 or newer (for C++20 support)")
endif()
# - Help find dependencies
@@ -191,7 +200,7 @@ get_filename_component(_geant4_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH)
@GEANT4_COMPILER_FLAG_HINTS@
# - Provide variable indicating C++ Standard we were compiled against
set(Geant4_CXXSTD "c++@GEANT4_BUILD_CXXSTD@")
set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
#-----------------------------------------------------------------------
# Set the base compile definitions required to use Geant4 if the variable
@@ -456,14 +465,17 @@ if(Geant4_qt_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 ("vis_toolssg_qt_gles" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_QT
-DG4UI_USE_QT
-DG4VIS_USE_OPENGLQT
#-DG4VIS_USE_TOOLSSG_QT_GLES
)
set(_geant4_use_opengl_library ON)
#set(_geant4_use_toolssg_library ON)
# Qt3D is always on if available
set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
endif()
@@ -485,6 +497,7 @@ if(Geant4_motif_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 ("vis_toolssg_xt_gles" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
@@ -566,6 +579,72 @@ if(Geant4_vis_openinventor_FOUND)
endif()
endif()
# - ToolsSG X11/GLES
set(Geant4_vis_toolssg_x11_gles_FOUND @GEANT4_USE_TOOLSSG_X11_GLES@)
if(Geant4_vis_toolssg_x11_gles_FOUND)
find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
if(APPLE)
find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif()
if(("vis_toolssg_x11_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4VIS_USE_TOOLSSG_X11_GLES
)
set(_geant4_use_toolssg_library ON)
endif()
endif()
# - ToolsSG Windows/GLES
set(Geant4_vis_toolssg_windows_gles_FOUND @GEANT4_USE_TOOLSSG_WINDOWS_GLES@)
if(Geant4_vis_toolssg_windows_gles_FOUND)
find_dependency(OpenGL)
if(("vis_toolssg_windows_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4VIS_USE_TOOLSSG_WINDOWS_GLES
)
set(_geant4_use_toolssg_library ON)
endif()
endif()
# - ToolsSG Xt/GLES
set(Geant4_vis_toolssg_xt_gles_FOUND @GEANT4_USE_TOOLSSG_XT_GLES@)
if(Geant4_vis_toolssg_xt_gles_FOUND)
find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
if(APPLE)
find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif()
if(("vis_toolssg_xt_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4VIS_USE_TOOLSSG_XT_GLES
)
set(_geant4_use_toolssg_library ON)
endif()
endif()
# - ToolsSG Qt/GLES
set(Geant4_vis_toolssg_qt_gles_FOUND @GEANT4_USE_TOOLSSG_QT_GLES@)
if(Geant4_vis_toolssg_qt_gles_FOUND)
find_dependency(OpenGL)
if(("vis_toolssg_qt_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4VIS_USE_TOOLSSG_QT_GLES
)
set(_geant4_use_toolssg_library ON)
endif()
endif()
# Reset any OpenGL Preference
set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
@@ -641,6 +720,14 @@ if(_geant4_use_inventor_library)
)
endif()
# - G4ToolsSG if it's requested.
if(_geant4_use_toolssg_library)
list(APPEND _geant4_internal_libraries
Geant4::G4ToolsSG${_geant4_lib_use_suffix}
)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG)
endif()
# - G3toG4 if it's requested
if(_geant4_use_g3tog4_library)
set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
@@ -708,6 +795,7 @@ list(APPEND _geant4_internal_libraries
Geant4::G4graphics_reps${_geant4_lib_use_suffix}
Geant4::G4intercoms${_geant4_lib_use_suffix}
Geant4::G4global${_geant4_lib_use_suffix}
Geant4::G4tools${_geant4_lib_use_suffix}
)
# - Any externals built by Geant4
@@ -759,7 +847,7 @@ set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake")
list(REMOVE_AT CMAKE_MODULE_PATH 0)
#-----------------------------------------------------------------------
# Finally, check FOUNDness of required components.
# Check FOUNDness of required components.
foreach(_comp ${Geant4_FIND_COMPONENTS})
if(NOT Geant4_${_comp}_FOUND)
if(Geant4_FIND_REQUIRED_${_comp})
@@ -769,5 +857,8 @@ foreach(_comp ${Geant4_FIND_COMPONENTS})
endif()
endforeach()
# And we should be done...
#-----------------------------------------------------------------------
# Reporting via FindPackageHandleStandardArgs "CONFIG_MODE" to give a better message on being found
include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)
+44
View File
@@ -0,0 +1,44 @@
@echo off
rem -----------------------------------------------------------------------
rem @GEANT4_TC_SHELL_FAMILY@ environment setup script for Geant4 @Geant4_VERSION@
rem
rem This script will configure your environment so that any Geant4 supplied
rem tools, libraries and data are available in your PATH, library paths etc.
rem Data libraries will only be setup if they were installed as part of the
rem Geant4 installation.
rem
rem Source this script to perform the setup.
rem
rem This script is autogenerated by CMake DO NOT EDIT
rem
rem -----------------------------------------------------------------------
rem Locate directory of self
rem
@GEANT4_ENV_SELFLOCATE_COMMAND@
@GEANT4_TC_IF_SELFLOCATED@
rem -----------------------------------------------------------------------
rem Setup Geant4 binary and library paths...
rem
@GEANT4_ENV_BINPATH_SETUP@
@GEANT4_ENV_LIBPATH_SETUP@
rem -----------------------------------------------------------------------
rem Setup Third-party binary and library paths...
rem - CLHEP
@GEANT4_TC_CLHEP_LIB_PATH_SETUP@
rem - XercesC
@GEANT4_TC_XERCESC_LIB_PATH_SETUP@
rem -----------------------------------------------------------------------
rem Resource file paths
rem - Datasets
@GEANT4_ENV_DATASETS@
rem - Fonts for Freetype
@GEANT4_ENV_TOOLS_FONT_PATH@
rem ----------------------------------------------------------------------
@GEANT4_TC_ENDIF_SELFLOCATED@
+8
View File
@@ -0,0 +1,8 @@
@echo off
rem
rem Self locate script when sourced
setlocal
for /F %%i in ("%~dp0.") do set BINDIR=%%~fi
pushd %BINDIR%
sh geant4-config %*
popd
+5 -18
View File
@@ -76,7 +76,7 @@ cflags="@CMAKE_CXX_FLAGS@ @GEANT4_CXXSTD_FLAGS@"
feature_list=""
# - CXX Standard
geant4_cxx_std="c++@GEANT4_BUILD_CXXSTD@"
geant4_cxx_std="@CMAKE_CXX_STANDARD@"
# - static libs
have_staticlibs="@G4_BUILTWITH_STATICLIBS@"
@@ -129,7 +129,9 @@ libs="-lG4interfaces \
-lG4materials \
-lG4graphics_reps \
-lG4intercoms \
-lG4global"
-lG4global \
-lG4tools \
@G4_LINK_CXX_FILESYSTEM@"
#-----------------------------------------------------------------------
# - Extra optional features that were enabled.
@@ -204,7 +206,7 @@ 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
if test "x${qt_version}" \< "5.15.0" ; then
vis_libs="-lG4visQt3D ${vis_libs}"
libs="-lG4visQt3D ${libs}"
vis_cflags="${vis_cflags} -DG4UI_USE_QT3D"
@@ -324,33 +326,18 @@ install_datasets()
exit 1
fi
if test ! -x "${G4CURL}" ; then
echo "- error: curl '${G4CURL}' is not executable"
exit 1
fi
G4OPENSSL=$(which openssl)
if test "x${G4OPENSSL}" = "x" ; then
echo "- error: no openssl executable found"
exit 1
fi
if test ! -x "${G4OPENSSL}" ; then
echo "- error: openssl '${G4OPENSSL}' is not executable"
exit 1
fi
G4TAR=$(which tar)
if test "x${G4TAR}" = "x" ; then
echo "- error: no tar executable found"
exit 1
fi
if test ! -x "${G4TAR}" ; then
echo "- error: tar '${G4TAR}' is not executable"
exit 1
fi
datasets_to_install=''
for ds in ${dataset_list} ; do
dataset_path=$(echo $ds | cut -d "|" -f3)
@@ -33,13 +33,6 @@ set(GEANT4_FALSEPOSITIVE_SOURCES
# - Xaw is deprecated...
G4UIXaw.hh
G4UIXaw.cc
# - OpenGL Wt not yet supported....
G4OpenGLImmediateWt.hh
G4OpenGLImmediateWtViewer.hh
G4OpenGLWtViewer.hh
G4OpenGLImmediateWt.cc
G4OpenGLImmediateWtViewer.cc
G4OpenGLWtViewer.cc
# - VRML has icc files in the src/ directory. These are only used
# internally but validate_sources assumes icc files will be in
# include/