Import Geant4 11.2.0.beta source tree
This commit is contained in:
+70
-3
@@ -5,21 +5,88 @@ which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
## 2023-06-21 Ben Morgan (cmake-V11-01-21)
|
||||
- Remobe obsolete and confusing GEANT4_BUILD_TESTS option and configuration
|
||||
|
||||
## 2023-02-06 Ben Morgan (cmake-V11-00-53)
|
||||
## 2023-06-14 Gunter Folger (cmake-V11-01-20)
|
||||
- Update to use G4EMLOW 8.4, as provoded by Vladimir
|
||||
|
||||
## 2023-05-31 Ben Morgan (cmake-V11-01-19)
|
||||
- Require Qt5 >= 5.9 if Qt5 support is selected
|
||||
- Version chosen as current system version on oldest support OS (CentOS7)
|
||||
|
||||
## 2023-05-29 Guy Barrand (cmake-V11-01-18)
|
||||
- Templates/Geant4Config.cmake.inm Modules/G4InterfaceOptions.cmake: handle the TOOLSSG_[X11,XT,WINDOWS,QT]_ZB vis drivers.
|
||||
|
||||
## 2023-05-23 Ben Morgan (cmake-V11-01-17)
|
||||
- Add capabilities to geant4_module_check.py:
|
||||
- Given a module, print list of modules that depend on it
|
||||
- Print all modules sorted in descending order of the number of modules using them
|
||||
- Show which headers from linked modules are included by a module in its
|
||||
usage requirements output
|
||||
|
||||
## 2023-05-12 Ben Morgan (cmake-V11-01-16)
|
||||
- Make linking a source code module to a final Geant4 library a cmake-time error
|
||||
- Fixes #161
|
||||
|
||||
## 2023-05-10 Ben Morgan (cmake-V11-01-15)
|
||||
- Update config scripts for split of G4persistency library
|
||||
|
||||
## 2023-05-10 Gunter Folger (cmake-V11-01-14)
|
||||
- Update to use G4INCL 1.1
|
||||
|
||||
## 2023-04-28 Ben Morgan (cmake-V11-01-13)
|
||||
- Export VTK_DIR and QtX_DIR to package cache to assist in refinding both.
|
||||
|
||||
## 2023-04-27 Ben Morgan (cmake-V11-01-12)
|
||||
- Find and refind Qt6OpenGLWidgets module in Qt6 for use by Qt/OpenGL consumers.
|
||||
|
||||
## 2023-04-26 Ben Morgan (cmake-V11-01-11)
|
||||
- Support finding and use of Qt6 on request for beta testing.
|
||||
|
||||
## 2023-04-02 Ben Morgan (cmake-V11-01-10)
|
||||
- No longer link to QtPrintSupport, which is not used in the toolkit.
|
||||
|
||||
## 2023-03-28 Gunter Folger (cmake-V11-01-09)
|
||||
- Update to use G4ABLA 3.3
|
||||
|
||||
## 2023-03-22 Ben Morgan (cmake-V11-01-08)
|
||||
- Remove setting of -D flags in Geant4Config to enable vis drivers. Libraries
|
||||
now export compile definitions for what they support to move to a "use on link"
|
||||
model.
|
||||
|
||||
## 2023-02-16 Gunter Folger (cmake-V11-01-07)
|
||||
- Update to use G4EMLOW 8.3
|
||||
|
||||
## 2023-02-13 Stewart Boogert (cmake-V11-01-06)
|
||||
- streamlined VTK cmake components.
|
||||
|
||||
## 2023-02-06 Ben Morgan (cmake-V11-01-05)
|
||||
- Remove no longer required G4VecGeomShim module.
|
||||
- VecGeom supports/supplies full imported targets since 1.1.18
|
||||
- Use of VECGEOM_LIBRARIES variable required to allow build against CUDA-enabled VecGeom
|
||||
|
||||
## 2023-01-18 Ben Morgan (cmake-V11-00-52)
|
||||
## 2023-01-30 Ben Morgan (cmake-V11-01-04)
|
||||
- Update Qt MOC application for G4UIimplementation in place of G4UIbasic/G4UIcommon
|
||||
|
||||
## 2023-01-25 Ben Morgan (cmake-V11-01-03)
|
||||
- Initial support for declaring headers of a source code module private.
|
||||
- Headers declared private are not installed
|
||||
- geant4_module_check reports an inconsistency if a private header is used
|
||||
non-privately
|
||||
|
||||
## 2023-01-18 Ben Morgan (cmake-V11-01-02)
|
||||
- Fix configuration/use of G4ToolsSG in geant4-config
|
||||
- Addresses issue reported on [Geant4 Forum](https://geant4-forum.web.cern.ch/t/missing-g4toolssg-in-geant4-config-in-pre-compiled-geant4-11-1-for-linux/9738)
|
||||
|
||||
## 2023-01-09 Ben Morgan (cmake-V11-00-51)
|
||||
## 2023-01-09 Ben Morgan (cmake-V11-01-01)
|
||||
- Use PROJECT_ or Geant4_ scoped _SOURCE/BINARY_DIR variables in place of CMAKE_
|
||||
scope version to ease use of Geant4 as a CMake subproject.
|
||||
- Fixes [GitHub PR #52](https://github.com/Geant4/geant4/pull/52)
|
||||
|
||||
## 2022-12-20 Gunter Folger (cmake-V11-01-00)
|
||||
- Use new dataset G4ABLA 3.2
|
||||
|
||||
## 2022-12-05 Ben Morgan (cmake-V11-00-50)
|
||||
- Revert VecGeom minimum version to 1.2.0 due to issues with 1.2.1 reported by
|
||||
CMS but not yet triaged in VecGeom itself.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# - Check that FLUKA_INTERFACE environment was properly set.
|
||||
# Note: This file can also be placed in geant4_application/cmake/Modules/FindFLUKAInterface.cmake
|
||||
|
||||
message(STATUS "FLUKAInterface_INCLUDE_DIR = $ENV{FLUKAInterface_INCLUDE_DIR}")
|
||||
message(STATUS "FLUKAInterface_LIBRARIES = $ENV{FLUKAInterface_LIBRARIES}")
|
||||
if (NOT DEFINED ENV{FLUKAInterface_INCLUDE_DIR})
|
||||
message(FATAL_ERROR "\n $FLUKAInterface_INCLUDE_DIR is not set! \n Did you source env_FLUKA_G4_interface.sh? \n")
|
||||
elseif (NOT DEFINED ENV{FLUKAInterface_LIBRARIES})
|
||||
message(FATAL_ERROR "\n $FLUKAInterface_LIBRARIES is not set! \n Did you source env_FLUKA_G4_interface.sh? \n")
|
||||
endif()
|
||||
|
||||
|
||||
string(REPLACE " " ";" FLUKAInterface_INCLUDE_DIR $ENV{FLUKAInterface_INCLUDE_DIR})
|
||||
string(REPLACE " " ";" FLUKAInterface_LIBRARIES $ENV{FLUKAInterface_LIBRARIES})
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FLUKAInterface DEFAULT_MSG FLUKAInterface_INCLUDE_DIR FLUKAInterface_LIBRARIES)
|
||||
@@ -7,11 +7,6 @@ option(GEANT4_ENABLE_TESTING "Enable and define all the tests of the project" OF
|
||||
geant4_add_feature(GEANT4_ENABLE_TESTING "Enable and define all the tests of the project")
|
||||
mark_as_advanced(GEANT4_ENABLE_TESTING)
|
||||
|
||||
# - "BUILD_TESTS" means all 'tests' in individual categories.
|
||||
option(GEANT4_BUILD_TESTS "Build all the tests of the project" OFF)
|
||||
geant4_add_feature(GEANT4_BUILD_TESTS "Build all the tests of the project")
|
||||
mark_as_advanced(GEANT4_BUILD_TESTS)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Configure CTest and relevant Geant4 settings, if required
|
||||
#
|
||||
@@ -48,16 +43,3 @@ if(GEANT4_ENABLE_TESTING)
|
||||
list(APPEND GEANT4_TEST_ENVIRONMENT G4RUN_MANAGER_TYPE=TBB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Add Unit Tests if required
|
||||
#
|
||||
if(GEANT4_BUILD_TESTS)
|
||||
file(GLOB_RECURSE files RELATIVE ${PROJECT_SOURCE_DIR} source/CMakeLists.txt)
|
||||
foreach( file ${files} )
|
||||
get_filename_component(path ${file} PATH)
|
||||
if(path MATCHES "/test$")
|
||||
add_subdirectory(${path})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -51,9 +51,6 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(Geant4_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")")
|
||||
endif()
|
||||
|
||||
# Core compile definitions...
|
||||
set(GEANT4_CORE_DEFINITIONS )
|
||||
|
||||
# Third party includes (libraries *should* be handled by the imports)
|
||||
set(GEANT4_THIRD_PARTY_INCLUDES )
|
||||
|
||||
@@ -194,7 +191,7 @@ configure_file(
|
||||
)
|
||||
|
||||
|
||||
foreach(_mod HepMC Pythia6 Pythia8 StatTest TBB XQuartzGL)
|
||||
foreach(_mod FLUKAInterface HepMC Pythia6 Pythia8 StatTest TBB XQuartzGL)
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/Find${_mod}.cmake
|
||||
${PROJECT_BINARY_DIR}/Modules/Find${_mod}.cmake
|
||||
|
||||
@@ -242,7 +242,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS)
|
||||
# - Qt
|
||||
if(GEANT4_USE_QT)
|
||||
set(G4_BUILTWITH_QT "yes")
|
||||
set(_qtcomps Core Gui Widgets OpenGL PrintSupport)
|
||||
set(_qtcomps Core Gui Widgets OpenGL)
|
||||
if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 5.15)
|
||||
list(APPEND _qtcomp 3DCore 3DExtras 3DRender)
|
||||
endif()
|
||||
|
||||
@@ -18,11 +18,11 @@ geant4_add_dataset(
|
||||
# - Low energy electromagnetics
|
||||
geant4_add_dataset(
|
||||
NAME G4EMLOW
|
||||
VERSION 8.2
|
||||
VERSION 8.4
|
||||
FILENAME G4EMLOW
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4LEDATA
|
||||
MD5SUM 07773e57be3f6f2ebb744da5ed574f6d
|
||||
MD5SUM 59e2aea7f089f0b97f588b4b8e85dd28
|
||||
)
|
||||
|
||||
# - Photon evaporation
|
||||
@@ -88,22 +88,22 @@ geant4_add_dataset(
|
||||
# - ABLA
|
||||
geant4_add_dataset(
|
||||
NAME G4ABLA
|
||||
VERSION 3.1
|
||||
VERSION 3.3
|
||||
FILENAME G4ABLA
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4ABLADATA
|
||||
MD5SUM 180f1f5d937733b207f8d5677f76296e
|
||||
MD5SUM b25d093339e1e4532e31038653580ca6
|
||||
)
|
||||
|
||||
|
||||
# - INCL
|
||||
geant4_add_dataset(
|
||||
NAME G4INCL
|
||||
VERSION 1.0
|
||||
VERSION 1.1
|
||||
FILENAME G4INCL
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4INCLDATA
|
||||
MD5SUM 85fe937b6df46d41814f07175d3f5b51
|
||||
MD5SUM c719b61b1971a823188fc6c937e48287
|
||||
)
|
||||
|
||||
# - ENSDFSTATE
|
||||
|
||||
@@ -49,15 +49,17 @@ include_guard(DIRECTORY)
|
||||
#
|
||||
# geant4_add_module(<name>
|
||||
# PUBLIC_HEADERS header1 [header2 ...]
|
||||
# PRIVATE_HEADERS header1 [header2 ..]
|
||||
# [SOURCES source1 [source2 ...]])
|
||||
#
|
||||
# Add a Geant4 module called ``<name>`` to the project, composed
|
||||
# of the source files listed in the ``PUBLIC_HEADERS`` and ``SOURCES``
|
||||
# arguments. The ``<name>`` must be unique within the project.
|
||||
# of the source files listed in the ``PUBLIC_HEADERS``, ``PRIVATE_HEADERS``,
|
||||
# and ``SOURCES`` arguments. The ``<name>`` must be unique within the project.
|
||||
# The directory in which the module is added (i.e. ``CMAKE_CURRENT_LIST_DIR``
|
||||
# for the CMake script in which ``geant4_add_module`` is called) must contain:
|
||||
#
|
||||
# * An ``include`` subdirectory for the public headers
|
||||
# * A ``include/private`` subdirectory for the private headers
|
||||
# * A ``src`` subdirectory for source files if the module provides these
|
||||
#
|
||||
# Any module with only ``PUBLIC_HEADERS`` has its ``IS_INTERFACE`` property
|
||||
@@ -69,6 +71,12 @@ include_guard(DIRECTORY)
|
||||
# this is interpreted as being relative to the ``include`` subdirectory of the module.
|
||||
# Absolute paths may also be supplied, e.g. if headers are generated by the project.
|
||||
#
|
||||
# The ``PRIVATE_HEADERS`` argument must list the headers comprising any
|
||||
# interfaces that are implementation details of the module. If a header is supplied
|
||||
# as a relative path, this is interpreted as being relative to the ``include/private``
|
||||
# subdirectory of the module. Absolute paths may also be supplied, e.g. if headers
|
||||
# are generated by the project.
|
||||
#
|
||||
# The ``SOURCES`` argument should list any source files for the module.
|
||||
# If a source is is supplied as a relative path, this is interpreted as being
|
||||
# relative to the ``src`` subdirectory of the module. Absolute paths may
|
||||
@@ -80,7 +88,7 @@ function(geant4_add_module _name)
|
||||
cmake_parse_arguments(G4ADDMOD
|
||||
""
|
||||
""
|
||||
"PUBLIC_HEADERS;SOURCES"
|
||||
"PUBLIC_HEADERS;PRIVATE_HEADERS;SOURCES"
|
||||
${ARGN}
|
||||
)
|
||||
__geant4_assert_no_unparsed_arguments(G4ADDMOD geant4_add_module)
|
||||
@@ -100,14 +108,20 @@ function(geant4_add_module _name)
|
||||
geant4_set_module_property(${_name} PROPERTY CMAKE_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
|
||||
# Compose header/source lists
|
||||
geant4_module_sources(${_name} PUBLIC_HEADERS ${G4ADDMOD_PUBLIC_HEADERS} SOURCES ${G4ADDMOD_SOURCES})
|
||||
geant4_module_sources(${_name}
|
||||
PUBLIC_HEADERS ${G4ADDMOD_PUBLIC_HEADERS}
|
||||
PRIVATE_HEADERS ${G4ADDMOD_PRIVATE_HEADERS}
|
||||
SOURCES ${G4ADDMOD_SOURCES})
|
||||
|
||||
# Set default usage requirements for this module, dependent on whether it is an INTERFACE or not
|
||||
# TODO: It's a hard error if a module is INTERFACE and has PRIVATE_HEADERS
|
||||
if(NOT G4ADDMOD_SOURCES)
|
||||
geant4_module_include_directories(${_name} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
|
||||
geant4_set_module_property(${_name} PROPERTY IS_INTERFACE TRUE)
|
||||
else()
|
||||
# Set the default include directory for this module
|
||||
# Private header inclusions are, for now, dealt with at the target level (until we require CMake >=3.18)
|
||||
# - See set_source_files_properties for details
|
||||
geant4_module_include_directories(${_name} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
|
||||
|
||||
# Some compile definitions are still transported via directory level
|
||||
@@ -131,6 +145,7 @@ endfunction()
|
||||
#
|
||||
# geant4_module_sources(<name>
|
||||
# PUBLIC_HEADERS header1 [header2 ...]
|
||||
# PRIVATE_HEADERS header1 [header2 ...]
|
||||
# [SOURCES source1 [source2 ...]])
|
||||
#
|
||||
# Append sources to a Geant4 module called ``<name>``, composed of the source
|
||||
@@ -146,7 +161,7 @@ function(geant4_module_sources _name)
|
||||
cmake_parse_arguments(G4MODSRCS
|
||||
""
|
||||
""
|
||||
"PUBLIC_HEADERS;SOURCES"
|
||||
"PUBLIC_HEADERS;PRIVATE_HEADERS;SOURCES"
|
||||
${ARGN}
|
||||
)
|
||||
__geant4_assert_no_unparsed_arguments(G4MODSRCS geant4_module_sources)
|
||||
@@ -169,6 +184,16 @@ function(geant4_module_sources _name)
|
||||
endforeach()
|
||||
geant4_set_module_property(${_name} APPEND PROPERTY PUBLIC_HEADERS ${__tmp_HEADERS})
|
||||
|
||||
set(__tmp_HEADERS)
|
||||
foreach(__elem ${G4MODSRCS_PRIVATE_HEADERS})
|
||||
if(IS_ABSOLUTE "${__elem}")
|
||||
list(APPEND __tmp_HEADERS "${__elem}")
|
||||
else()
|
||||
list(APPEND __tmp_HEADERS "${CMAKE_CURRENT_LIST_DIR}/include/private/${__elem}")
|
||||
endif()
|
||||
endforeach()
|
||||
geant4_set_module_property(${_name} APPEND PROPERTY PRIVATE_HEADERS ${__tmp_HEADERS})
|
||||
|
||||
set(__tmp_SOURCES)
|
||||
foreach(__elem ${G4MODSRCS_SOURCES})
|
||||
if(IS_ABSOLUTE "${__elem}")
|
||||
@@ -859,11 +884,12 @@ function(geant4_compose_targets)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# - For each module, write out files for
|
||||
# 1. module -> used modules adjacency list for detecting module-module cycles
|
||||
# - For each module
|
||||
# 1. Write out files for
|
||||
# 1.1. module -> used modules adjacency list for detecting module-module cycles
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt" "# Geant4 Module - Module Adjacencies\n")
|
||||
|
||||
# 2. module,location,public headers for developer query operations
|
||||
# 1.2. module,location,public headers for developer query operations
|
||||
# Basically need a dict of module : [headers, ...]
|
||||
# - Two main queries to run
|
||||
# - Given a module, what public headers does it provide?
|
||||
@@ -884,26 +910,51 @@ function(geant4_compose_targets)
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/G4ModuleInterfaceMap.csv" "")
|
||||
configure_file("${PROJECT_SOURCE_DIR}/cmake/Modules/geant4_module_check.py" "${PROJECT_BINARY_DIR}/geant4_module_check.py" COPYONLY)
|
||||
|
||||
# 2. Check it does not link to a composed library composed of N>1 modules
|
||||
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
|
||||
set(__g4disallowedlinks ${__g4definedlibraries})
|
||||
list(REMOVE_ITEM __g4disallowedlinks ${__g4definedmodules})
|
||||
|
||||
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)
|
||||
|
||||
# 1.1 Adjacency list - take all dependencies
|
||||
set(__alldeps_l ${__publicdeps} ${__privatedeps} ${__interfacedeps})
|
||||
list(JOIN __alldeps_l " " __alldeps)
|
||||
file(APPEND "${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt" "${__module} ${__alldeps}\n")
|
||||
|
||||
# 2. Module interfaces, needs CMAKE, PUBLIC_HEADER
|
||||
# 1.2 Module interfaces, needs CMAKE, PUBLIC_HEADER
|
||||
geant4_get_module_property(__listfile ${__module} CMAKE_LIST_FILE)
|
||||
geant4_get_module_property(__publichdrs ${__module} PUBLIC_HEADERS)
|
||||
geant4_get_module_property(__privatehdrs ${__module} PRIVATE_HEADERS)
|
||||
geant4_get_module_property(__srcs ${__module} SOURCES)
|
||||
geant4_get_module_property(__parent_target ${__module} PARENT_TARGET)
|
||||
get_filename_component(__listdir "${__listfile}" DIRECTORY)
|
||||
# Remove generated headers
|
||||
list(TRANSFORM __publichdrs REPLACE "^${PROJECT_BINARY_DIR}/.*$" "")
|
||||
list(TRANSFORM __publichdrs REPLACE "^/.*/" "")
|
||||
file(APPEND "${PROJECT_BINARY_DIR}/G4ModuleInterfaceMap.csv" "${__module},${__listdir},${__publichdrs},${__publicdeps},${__privatedeps},${__interfacedeps},${__parent_target},${__gmc_build_settings}\n")
|
||||
list(TRANSFORM __privatehdrs REPLACE "^/.*/" "")
|
||||
list(TRANSFORM __srcs REPLACE "^/.*/" "")
|
||||
file(APPEND "${PROJECT_BINARY_DIR}/G4ModuleInterfaceMap.csv" "${__module},${__listdir},${__publichdrs},${__privatehdrs},${__srcs},${__publicdeps},${__privatedeps},${__interfacedeps},${__parent_target},${__gmc_build_settings}\n")
|
||||
|
||||
# 2. Check for disallowed links in each link type
|
||||
foreach(__linktype IN ITEMS public private interface)
|
||||
foreach(__link ${__${__linktype}deps})
|
||||
if(__link IN_LIST __g4disallowedlinks)
|
||||
geant4_get_category_property(__linktothese ${__link} MODULES)
|
||||
string(REPLACE "${PROJECT_SOURCE_DIR}/" "" __badlistfile ${__listfile})
|
||||
message(FATAL_ERROR "Geant4 module '${__module}' has a ${__linktype} link to composed category '${__link}'."
|
||||
"It must link to one or more of its component modules instead:\n"
|
||||
"${__linktothese}\n"
|
||||
"in ${__badlistfile}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Process all defined libraries
|
||||
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
|
||||
set(__g4builtlibraries)
|
||||
set(__g4public_headers)
|
||||
|
||||
@@ -1224,19 +1275,21 @@ function(__geant4_add_library _name _type)
|
||||
foreach(__g4mod ${__g4modules})
|
||||
# - Process sources...
|
||||
geant4_get_module_property(_headers ${__g4mod} PUBLIC_HEADERS)
|
||||
geant4_get_module_property(_headers_private ${__g4mod} PRIVATE_HEADERS)
|
||||
geant4_get_module_property(_srcs ${__g4mod} SOURCES)
|
||||
geant4_get_module_property(_cmakescript ${__g4mod} CMAKE_LIST_FILE)
|
||||
get_filename_component(_moddir "${_cmakescript}" DIRECTORY)
|
||||
|
||||
# - Group sources and scripts for IDEs
|
||||
# NB: Seemingly has to be done at same level we define target.
|
||||
# TODO: If lib name is same as mod name, don't group avoid extra
|
||||
# folder layer.
|
||||
source_group(${__g4mod}\\Headers FILES ${_headers})
|
||||
source_group(${__g4mod}\\Headers FILES ${_headers} ${_headers_private})
|
||||
source_group(${__g4mod}\\Sources FILES ${_srcs})
|
||||
source_group(${__g4mod} FILES ${_cmakescript})
|
||||
|
||||
# - Add sources to target - PRIVATE, because consuming targets don't need them
|
||||
target_sources(${_target_name} PRIVATE ${_headers} ${_srcs} ${_cmakescript})
|
||||
target_sources(${_target_name} PRIVATE ${_headers} ${_headers_private} ${_srcs} ${_cmakescript})
|
||||
|
||||
# - Process usage properties
|
||||
# Include dirs, compile definitions and libraries can be handled together
|
||||
@@ -1256,8 +1309,11 @@ function(__geant4_add_library _name _type)
|
||||
# declared its deps correctly (but then an error will occur
|
||||
# anyway, and point is that libs are linked, not modules!)
|
||||
# "Module" level really means "Source file" level, so same
|
||||
# sets of rules should apply (i.e. can't specify inc dirs
|
||||
# at source level).
|
||||
# sets of rules should apply.
|
||||
# Can use set_source_files_properties for module-level PRIVATE_HEADERS,
|
||||
# but that's it
|
||||
set_property(SOURCE ${_srcs} APPEND PROPERTY INCLUDE_DIRECTORIES "${_moddir}/include/private")
|
||||
|
||||
foreach(_prop ${_props_to_process})
|
||||
# Further gotcha with INTERFACE modules here
|
||||
# - If an interface module is composed into a non-interface module
|
||||
@@ -1306,7 +1362,7 @@ function(__geant4_add_library _name _type)
|
||||
# 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|G4ToolsSG" AND GEANT4_USE_QT)
|
||||
if(__g4mod MATCHES "G4UIimplementation|G4OpenGL|G4OpenInventor|G4ToolsSG" AND GEANT4_USE_QT)
|
||||
set_target_properties(${_target_name} PROPERTIES AUTOMOC ON)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -65,14 +65,27 @@ if(GEANT4_USE_INVENTOR_QT AND NOT GEANT4_USE_QT)
|
||||
message(STATUS "Forcing GEANT4_USE_QT to ON, required by selection of GEANT4_USE_INVENTOR_QT as ON")
|
||||
endif()
|
||||
set(GEANT4_USE_TOOLSSG_QT_GLES ${GEANT4_USE_QT})
|
||||
set(GEANT4_USE_TOOLSSG_QT_ZB ${GEANT4_USE_QT})
|
||||
|
||||
# TEMPORARY for 11.2 Beta Development
|
||||
# Decision still required on whether to allow selection of 5/6 in production
|
||||
cmake_dependent_option(GEANT4_USE_QT_QT6 "Require Qt6 when building Qt support" OFF "GEANT4_USE_QT" OFF)
|
||||
mark_as_advanced(GEANT4_USE_QT_QT6)
|
||||
|
||||
# - Vtk
|
||||
option(GEANT4_USE_VTK "Build Geant4 with VTK visualisation" OFF)
|
||||
mark_as_advanced(GEANT4_USE_VTK)
|
||||
if(GEANT4_USE_VTK)
|
||||
find_package(VTK 8.2 REQUIRED)
|
||||
find_package(VTK 9 REQUIRED COMPONENTS
|
||||
CommonColor
|
||||
InteractionStyle
|
||||
IOExport
|
||||
GUISupportQt
|
||||
RenderingVolumeOpenGL2
|
||||
)
|
||||
geant4_save_package_variables(VTK VTK_DIR)
|
||||
endif()
|
||||
geant4_add_feature(GEANT4_USE_VTK "Using VTK for visualisation (EXPERIMENTAL)")
|
||||
geant4_add_feature(GEANT4_USE_VTK "Using VTK for visualisation")
|
||||
|
||||
# - Unix only
|
||||
if(UNIX)
|
||||
@@ -86,6 +99,7 @@ if(UNIX)
|
||||
message(STATUS "Forcing GEANT4_USE_XM to ON, required by Inventor driver")
|
||||
endif()
|
||||
set(GEANT4_USE_TOOLSSG_XT_GLES ${GEANT4_USE_XM})
|
||||
set(GEANT4_USE_TOOLSSG_XT_ZB ${GEANT4_USE_XM})
|
||||
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
|
||||
|
||||
# - OpenGL/X11 Vis Driver
|
||||
@@ -94,6 +108,9 @@ if(UNIX)
|
||||
set(GEANT4_USE_TOOLSSG_X11_GLES ${GEANT4_USE_OPENGL_X11})
|
||||
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
|
||||
|
||||
# tools/zb X11 Vis Driver
|
||||
set(GEANT4_USE_TOOLSSG_X11_ZB ${X11_FOUND})
|
||||
|
||||
# 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")
|
||||
@@ -104,6 +121,8 @@ if(WIN32)
|
||||
option(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support" OFF)
|
||||
set(GEANT4_USE_TOOLSSG_WINDOWS_GLES ${GEANT4_USE_OPENGL_WIN32})
|
||||
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
|
||||
|
||||
set(GEANT4_USE_TOOLSSG_WINDOWS_ZB ON)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -136,19 +155,36 @@ endif()
|
||||
# - Qt5/6
|
||||
if(GEANT4_USE_QT)
|
||||
# Use versioned targets to support Qt5 < 5.15
|
||||
# 5.9 is selected as the min version to support based on the system version on CentOS7
|
||||
# Once 5.15 is the minimum version, the "Qt${QT_VERSION_MAJOR}_..." variables can be dropped
|
||||
# - https://doc.qt.io/qt-6/cmake-manual.html
|
||||
find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets OpenGL PrintSupport REQUIRED)
|
||||
# TEMPORARY for 11.2 beta:
|
||||
# - Decision still required on whether to allow selection of 5/6 in production
|
||||
# TODO:
|
||||
# - Because VTK and SoQt use Qt themselves, we may want to consider checking that we
|
||||
# have a consistent link to the same Qt version
|
||||
if(GEANT4_USE_QT_QT6)
|
||||
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
|
||||
else()
|
||||
find_package(QT 5.9 NAMES Qt5 COMPONENTS Core REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets OpenGL REQUIRED)
|
||||
|
||||
geant4_save_package_variables(Qt${QT_VERSION_MAJOR}
|
||||
Qt${QT_VERSION_MAJOR}_DIR
|
||||
Qt${QT_VERSION_MAJOR}Core_DIR
|
||||
Qt${QT_VERSION_MAJOR}Gui_DIR
|
||||
Qt${QT_VERSION_MAJOR}Widgets_DIR
|
||||
Qt${QT_VERSION_MAJOR}OpenGL_DIR
|
||||
Qt${QT_VERSION_MAJOR}PrintSupport_DIR)
|
||||
Qt${QT_VERSION_MAJOR}OpenGL_DIR)
|
||||
|
||||
get_target_property(QT_QMAKE_EXECUTABLE ${Qt${QT_VERSION_MAJOR}Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
|
||||
# G4OpenGL and G4ToolsSG also require OpenGLWidgets in Qt6
|
||||
if(QT_VERSION_MAJOR GREATER 5)
|
||||
find_package(Qt${QT_VERSION_MAJOR}OpenGLWidgets REQUIRED)
|
||||
geant4_save_package_variables(Qt${QT_VERSION_MAJOR} Qt${QT_VERSION_MAJOR}OpenGLWidgets_DIR)
|
||||
endif()
|
||||
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
|
||||
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt${QT_VERSION_MAJOR} support")
|
||||
|
||||
# Qt3D is only supported on 5.15 and above, but always on if available
|
||||
|
||||
@@ -34,11 +34,13 @@ def initdb(filename):
|
||||
for row in reader:
|
||||
db['modules'][row[0]] = {'location': row[1],
|
||||
'headers': set(row[2].split(';')) - set(['']),
|
||||
'public_deps': set(row[3].split(';')) - set(['']),
|
||||
'private_deps': set(row[4].split(';')) - set(['']),
|
||||
'interface_deps': set(row[5].split(';')) - set(['']),
|
||||
'parent_target': row[6]}
|
||||
db['build_settings'].add(row[7])
|
||||
'private_headers': set(row[3].split(';')) - set(['']),
|
||||
'sources': set(row[4].split(';')) - set(['']),
|
||||
'public_deps': set(row[5].split(';')) - set(['']),
|
||||
'private_deps': set(row[6].split(';')) - set(['']),
|
||||
'interface_deps': set(row[7].split(';')) - set(['']),
|
||||
'parent_target': row[8]}
|
||||
db['build_settings'].add(row[9])
|
||||
|
||||
return db
|
||||
|
||||
@@ -55,10 +57,45 @@ def get_location(name, db):
|
||||
return get_module(name, db)['location']
|
||||
|
||||
|
||||
def get_header_path(name, db):
|
||||
return os.path.join(get_location(name, db), 'include')
|
||||
|
||||
|
||||
def get_private_header_path(name, db):
|
||||
return os.path.join(get_location(name, db), 'include/private')
|
||||
|
||||
|
||||
def get_source_path(name, db):
|
||||
return os.path.join(get_location(name, db), 'src')
|
||||
|
||||
|
||||
def get_headers(name, db):
|
||||
return get_module(name, db)['headers']
|
||||
|
||||
|
||||
def get_headers_absolute(name, db):
|
||||
base_path = get_header_path(name, db)
|
||||
return set(os.path.join(base_path, h) for h in get_headers(name, db))
|
||||
|
||||
|
||||
def get_private_headers(name, db):
|
||||
return get_module(name, db)['private_headers']
|
||||
|
||||
|
||||
def get_private_headers_absolute(name, db):
|
||||
base_path = get_private_header_path(name, db)
|
||||
return set(os.path.join(base_path, h) for h in get_private_headers(name, db))
|
||||
|
||||
|
||||
def get_sources(name, db):
|
||||
return get_module(name, db)['sources']
|
||||
|
||||
|
||||
def get_sources_absolute(name, db):
|
||||
base_path = get_source_path(name, db)
|
||||
return set(os.path.join(base_path, h) for h in get_sources(name, db))
|
||||
|
||||
|
||||
def get_public_deps(name, db):
|
||||
return get_module(name, db)['public_deps']
|
||||
|
||||
@@ -79,6 +116,18 @@ def what_provides(h, db):
|
||||
return set([m for m in get_modules(db) if h in get_headers(m, db)])
|
||||
|
||||
|
||||
def what_provides_private(h, db):
|
||||
return set([m for m in get_modules(db) if h in get_private_headers(m, db)])
|
||||
|
||||
|
||||
def what_requires(m, db):
|
||||
return set([om for om in get_modules(db) if m in get_public_deps(om, db)])
|
||||
|
||||
|
||||
def what_requires_private(m, db):
|
||||
return set([om for om in get_modules(db) if m in get_private_deps(om, db)])
|
||||
|
||||
|
||||
def has_setting(setting, build_settings):
|
||||
if setting.startswith('!'):
|
||||
return setting[1:] not in build_settings
|
||||
@@ -108,52 +157,122 @@ def scan_includes(input_file, settings):
|
||||
return result
|
||||
|
||||
|
||||
def scan_files(input_path, settings):
|
||||
def scan_files(files, settings):
|
||||
used_headers = set()
|
||||
with os.scandir(input_path) as hdr_it:
|
||||
for entry in hdr_it:
|
||||
used_headers |= scan_includes(entry.path, settings)
|
||||
for f in files:
|
||||
used_headers |= scan_includes(f, settings)
|
||||
|
||||
return used_headers
|
||||
|
||||
|
||||
def scan_module_headers(name, db, full_scan):
|
||||
if full_scan:
|
||||
# NB: know that will have private/ subdir, so only consider files
|
||||
header_list = [e.path for e in os.scandir(
|
||||
get_header_path(name, db)) if e.is_file()]
|
||||
else:
|
||||
header_list = get_headers_absolute(name, db)
|
||||
|
||||
return scan_files(header_list, db['build_settings'])
|
||||
|
||||
|
||||
def scan_module_private_headers(name, db, full_scan):
|
||||
if full_scan:
|
||||
header_list = [e.path for e in os.scandir(
|
||||
get_private_header_path(name, db))]
|
||||
else:
|
||||
header_list = get_private_headers_absolute(name, db)
|
||||
|
||||
return scan_files(header_list, db['build_settings'])
|
||||
|
||||
|
||||
def scan_module_sources(name, db, full_scan):
|
||||
if full_scan:
|
||||
source_list = [e.path for e in os.scandir(get_source_path(name, db))]
|
||||
else:
|
||||
source_list = get_sources_absolute(name, db)
|
||||
|
||||
return scan_files(source_list, db['build_settings'])
|
||||
|
||||
|
||||
def find_modules(list_of_headers, module_db):
|
||||
found_modules = set()
|
||||
blame_headers = defaultdict(set)
|
||||
orphan_hdrs = set()
|
||||
for h in list_of_headers:
|
||||
ms = what_provides(h, module_db)
|
||||
found_modules |= ms
|
||||
if not ms:
|
||||
orphan_hdrs.add(h)
|
||||
else:
|
||||
blame_headers[ms.pop()].add(h)
|
||||
|
||||
return {'modules': found_modules, 'headers': orphan_hdrs}
|
||||
return {'modules': found_modules, 'blame': {k: sorted(v) for k, v in blame_headers.items()}, 'headers': orphan_hdrs}
|
||||
|
||||
|
||||
def usage_requirements(module_name, module_db):
|
||||
def find_modules_private(list_of_headers, module_db):
|
||||
found_modules = set()
|
||||
blame_headers = defaultdict(set)
|
||||
orphan_hdrs = set()
|
||||
for h in list_of_headers:
|
||||
ms = what_provides_private(h, module_db)
|
||||
found_modules |= ms
|
||||
if not ms:
|
||||
orphan_hdrs.add(h)
|
||||
else:
|
||||
blame_headers[ms.pop()].add(h)
|
||||
|
||||
return {'modules': found_modules, 'blame': {k: sorted(v) for k, v in blame_headers.items()}, 'headers': orphan_hdrs}
|
||||
|
||||
|
||||
def usage_requirements(module_name, module_db, full_scan):
|
||||
""" Find modules needed publically and privately by input module
|
||||
"""
|
||||
try:
|
||||
module_path = get_location(module_name, module_db)
|
||||
module_headers = get_headers(module_name, module_db)
|
||||
module_private_headers = get_private_headers(module_name, module_db)
|
||||
except KeyError as err:
|
||||
print(f'No module named \'{module_name}\'', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Determine public usage reqs
|
||||
includes_from_headers = scan_files(os.path.join(module_path, "include"), module_db['build_settings'])
|
||||
includes_from_headers = scan_module_headers(
|
||||
module_name, module_db, full_scan)
|
||||
includes_from_headers -= module_headers
|
||||
public_deps = find_modules(includes_from_headers, module_db)
|
||||
access_violation_public = find_modules_private(
|
||||
includes_from_headers, module_db)
|
||||
|
||||
# The same for private, if module has srcs
|
||||
# Determine private usage reqs
|
||||
# private headers...
|
||||
try:
|
||||
includes_from_srcs = scan_files(os.path.join(module_path, "src"), module_db['build_settings'])
|
||||
includes_from_srcs -= module_headers
|
||||
private_deps = find_modules(includes_from_srcs, module_db)
|
||||
# Public deps are higher priority
|
||||
private_deps['modules'] -= public_deps['modules']
|
||||
private_deps['headers'] -= public_deps['headers']
|
||||
includes_from_private_headers = scan_module_private_headers(
|
||||
module_name, module_db, full_scan)
|
||||
includes_from_private_headers -= module_headers
|
||||
includes_from_private_headers -= module_private_headers
|
||||
except FileNotFoundError:
|
||||
private_deps = {'modules': set(), 'headers': set()}
|
||||
includes_from_private_headers = set()
|
||||
|
||||
# ... and sources if they exist
|
||||
try:
|
||||
includes_from_srcs = scan_module_sources(
|
||||
module_name, module_db, full_scan)
|
||||
includes_from_srcs -= module_headers
|
||||
includes_from_srcs -= module_private_headers
|
||||
except FileNotFoundError:
|
||||
includes_from_srcs = set()
|
||||
|
||||
# Join private/src and remove public deps, which are higher priority
|
||||
# We don't do this for blames as these can be unique
|
||||
private_deps = find_modules(
|
||||
includes_from_private_headers | includes_from_srcs, module_db)
|
||||
private_deps['modules'] -= public_deps['modules']
|
||||
private_deps['headers'] -= public_deps['headers']
|
||||
|
||||
# Determine any access violations
|
||||
access_violation_private = find_modules_private(
|
||||
includes_from_private_headers | includes_from_srcs, module_db)
|
||||
|
||||
# Transform results to output dict
|
||||
d = {'module': module_name,
|
||||
@@ -161,22 +280,30 @@ def usage_requirements(module_name, module_db):
|
||||
'public': sorted(public_deps['modules']),
|
||||
'private': sorted(private_deps['modules'])
|
||||
},
|
||||
'blame': {
|
||||
'public': OrderedDict(sorted(public_deps['blame'].items())),
|
||||
'private': OrderedDict(sorted(private_deps['blame'].items()))
|
||||
},
|
||||
'external_headers': {
|
||||
'public': sorted(public_deps['headers']),
|
||||
'private': sorted(private_deps['headers'])
|
||||
},
|
||||
'access_violations': {
|
||||
'public': sorted(access_violation_public['modules']),
|
||||
'private': sorted(access_violation_private['modules'])
|
||||
}
|
||||
}
|
||||
return d
|
||||
|
||||
|
||||
def check_consistency(module_name, module_db):
|
||||
def check_consistency(module_name, module_db, full_scan):
|
||||
""" Check module declared/apparent dependencies for consistency
|
||||
"""
|
||||
# NB: Can have false positives from externals G4expat, G4clhep, G4zlib, G4tools (plus imported :: targets and stdlib)
|
||||
def filter_dependencies(dep_list, module_name):
|
||||
return set([x for x in dep_list if not re.match("^.+::.+", x)]) - set(['G4expat', 'G4clhep', 'G4zlib', 'G4tools', 'G4ptl', 'stdc++fs'])
|
||||
|
||||
ur = usage_requirements(module_name, module_db)
|
||||
ur = usage_requirements(module_name, module_db, full_scan)
|
||||
apparent_public_deps = filter_dependencies(
|
||||
ur['dependencies']['public'], module_name)
|
||||
apparent_private_deps = filter_dependencies(
|
||||
@@ -189,6 +316,11 @@ def check_consistency(module_name, module_db):
|
||||
declared_private_deps = filter_dependencies(
|
||||
get_private_deps(module_name, module_db), module_name)
|
||||
|
||||
public_access_violations = filter_dependencies(
|
||||
ur['access_violations']['public'], module_name)
|
||||
private_access_violations = filter_dependencies(
|
||||
ur['access_violations']['private'], module_name)
|
||||
|
||||
# Collate any consistency errors
|
||||
report = []
|
||||
# - Declared dependencies duplicated between public/private
|
||||
@@ -221,6 +353,16 @@ def check_consistency(module_name, module_db):
|
||||
report.append(
|
||||
f' - may not require PRIVATE dependencies: {overdeclared_private_deps}')
|
||||
|
||||
# - Module exposes a header that's declared private locally or in another module
|
||||
if public_access_violations:
|
||||
report.append(
|
||||
f' ! public interface #include-s PRIVATE headers from modules: {public_access_violations}')
|
||||
|
||||
# - Module uses a header that's declared private
|
||||
if private_access_violations:
|
||||
report.append(
|
||||
f' ! implementation uses PRIVATE headers from modules: {private_access_violations}')
|
||||
|
||||
return report
|
||||
|
||||
|
||||
@@ -238,9 +380,45 @@ def do_provides(header_name, module_db, verbose):
|
||||
print(mods.pop())
|
||||
|
||||
|
||||
def do_check_consistency(module_name, module_db):
|
||||
def do_requires(module_name, module_db):
|
||||
"""find all modules that use module_name
|
||||
"""
|
||||
try:
|
||||
cc = check_consistency(module_name, module_db)
|
||||
public_users = sorted(what_requires(module_name, module_db))
|
||||
private_users = sorted(what_requires_private(module_name, module_db))
|
||||
except KeyError as err:
|
||||
print(f'No module named \'{module_name}\'', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print(f'{module_name} is required by:')
|
||||
|
||||
if len(public_users) != 0:
|
||||
print('- PUBLIC:')
|
||||
print(" -", "\n - ".join(public_users))
|
||||
|
||||
if len(private_users) != 0:
|
||||
print('PRIVATE:')
|
||||
print(" -", "\n - ".join(private_users))
|
||||
|
||||
|
||||
def do_count_usage(module_db, verbose):
|
||||
"""print modules ordered by number of modules linking to them"""
|
||||
reqcount = dict.fromkeys(get_modules(module_db), 0)
|
||||
|
||||
for m in get_modules(module_db):
|
||||
reqcount[m] += len(what_requires(m, module_db))
|
||||
reqcount[m] += len(what_requires_private(m, module_db))
|
||||
|
||||
for m in sorted(reqcount, key=reqcount.get, reverse=True):
|
||||
if verbose:
|
||||
print(m, f'({reqcount[m]} users)')
|
||||
else:
|
||||
print(m)
|
||||
|
||||
|
||||
def do_check_consistency(module_name, module_db, full_scan):
|
||||
try:
|
||||
cc = check_consistency(module_name, module_db, full_scan)
|
||||
if cc:
|
||||
print(f'{module_name} has inconsistent dependencies:', file=sys.stderr)
|
||||
print("\n".join(cc), file=sys.stderr)
|
||||
@@ -292,10 +470,10 @@ def do_find_cycles(module_db, verbose):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def do_find_inconsistencies(db, verbose):
|
||||
def do_find_inconsistencies(db, verbose, full_scan):
|
||||
inconsistent = {}
|
||||
for m in get_modules(db):
|
||||
cc = check_consistency(m, db)
|
||||
cc = check_consistency(m, db, full_scan)
|
||||
if cc:
|
||||
inconsistent[m] = "\n".join(cc)
|
||||
|
||||
@@ -327,6 +505,9 @@ if __name__ == "__main__":
|
||||
metavar="FILE", help="module interface map file")
|
||||
parser.add_argument("-v", "--verbose",
|
||||
action="store_true", help="verbose output")
|
||||
parser.add_argument("--all-files",
|
||||
action="store_true",
|
||||
help="consider all files in source tree for consistency checks")
|
||||
|
||||
query_group = parser.add_mutually_exclusive_group(required=True)
|
||||
|
||||
@@ -353,7 +534,17 @@ if __name__ == "__main__":
|
||||
query_group.add_argument(
|
||||
"-u", "--usage-requirements",
|
||||
metavar="<module>",
|
||||
help="determine and print usage requirements of module"
|
||||
help="print usage requirements of module"
|
||||
)
|
||||
query_group.add_argument(
|
||||
"-r", "--requires",
|
||||
metavar="<module>",
|
||||
help="print modules linking to this module"
|
||||
)
|
||||
query_group.add_argument(
|
||||
"--count-usage",
|
||||
action="store_true",
|
||||
help="print modules from most to least linked to"
|
||||
)
|
||||
query_group.add_argument(
|
||||
"-c", "--check-consistency",
|
||||
@@ -408,14 +599,18 @@ if __name__ == "__main__":
|
||||
elif args.provides:
|
||||
do_provides(args.provides, db, args.verbose)
|
||||
elif args.usage_requirements:
|
||||
ur = usage_requirements(args.usage_requirements, db)
|
||||
ur = usage_requirements(args.usage_requirements, db, args.all_files)
|
||||
print(json.dumps(ur, indent=2))
|
||||
elif args.count_usage:
|
||||
do_count_usage(db, args.verbose)
|
||||
elif args.requires:
|
||||
do_requires(args.requires, db)
|
||||
elif args.check_consistency:
|
||||
do_check_consistency(args.check_consistency, db)
|
||||
do_check_consistency(args.check_consistency, db, args.all_files)
|
||||
elif args.find_cycles:
|
||||
do_find_cycles(db, args.verbose)
|
||||
elif args.find_inconsistencies:
|
||||
do_find_inconsistencies(db, args.verbose)
|
||||
do_find_inconsistencies(db, args.verbose, args.all_files)
|
||||
elif args.library:
|
||||
try:
|
||||
print(get_parent_target(args.library, db))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#
|
||||
# It defines the following variables
|
||||
# Geant4_INCLUDE_DIRS - include directories for Geant4
|
||||
# Geant4_DEFINITIONS - compile definitions needed to use Geant4
|
||||
# Geant4_LIBRARIES - libraries to link against
|
||||
# Geant4_BUILD_TYPE - Build type (e.g. "Release") used to build this
|
||||
# install. Only set if Geant4 was installed using
|
||||
@@ -41,8 +40,8 @@
|
||||
# In Geant4, components can be optional subcomponents of an always
|
||||
# available library. In that case there will be no
|
||||
# Geant4_{COMPONENT}_LIBRARY variable. These non-library components are
|
||||
# generally activated by compile definitions, and in these cases the
|
||||
# appropriate definition will be added to the Geant4_DEFINITIONS component.
|
||||
# generally activated by compile definitions that are part of the target's
|
||||
# COMPILE_DEFINITIONS property.
|
||||
#
|
||||
# If you use the REQUIRED and/or COMPONENTS arguments of find_package to
|
||||
# specify components, then the module will issue a FATAL_ERROR if the
|
||||
@@ -91,6 +90,11 @@
|
||||
# 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)
|
||||
|
||||
# vis_toolssg_x11_zb (ToolsSG visualization with X11 windowing and g4tools zbuffer rendering)
|
||||
# vis_toolssg_xt_zb (ToolsSG visualization with Xt windowing and g4tools zbuffer rendering)
|
||||
# vis_toolssg_qt_zb (ToolsSG visualization with Qt windowing and g4tools zbuffer rendering)
|
||||
# vis_toolssg_windows_zb (ToolsSG visualization with Windows windowing and g4tools zbuffer rendering)
|
||||
#
|
||||
# In addition, two 'shorthand' components are defined to help activate all
|
||||
# available User Interface and Visualization drivers:
|
||||
@@ -194,16 +198,6 @@ get_filename_component(_geant4_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
# - Provide variable indicating C++ Standard we were compiled against
|
||||
set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set the base compile definitions required to use Geant4 if the variable
|
||||
# does not exist (we do this to ensure multiple calls to find_package
|
||||
# don't overwrite previous invocations)
|
||||
# Components may append to this, but should prefer usage requirements
|
||||
# via INTERFACE_COMPILE_DEFINITIONS
|
||||
if(NOT Geant4_DEFINITIONS)
|
||||
set(Geant4_DEFINITIONS @GEANT4_CORE_DEFINITIONS@)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Configure the path to the Geant4 headers, using a relative path if
|
||||
# possible. This is only known at CMake time, so we expand a CMake
|
||||
@@ -367,19 +361,9 @@ endif()
|
||||
|
||||
# - UI : TCSH
|
||||
set(Geant4_ui_tcsh_FOUND @UNIX@)
|
||||
if(Geant4_ui_tcsh_FOUND)
|
||||
if(("ui_tcsh" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4UI_USE_TCSH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - UI : win32
|
||||
set(Geant4_ui_win32_FOUND @WIN32@)
|
||||
if(Geant4_ui_win32_FOUND)
|
||||
if(("ui_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4UI_USE_WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Components which requires slightly more complex setup
|
||||
@@ -389,10 +373,6 @@ set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@)
|
||||
if(Geant4_vis_raytracer_x11_FOUND)
|
||||
find_dependency(X11)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
|
||||
|
||||
if(("vis_raytracer_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_RAYTRACERX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - Qt (UI and Vis!)
|
||||
@@ -405,7 +385,9 @@ if(Geant4_qt_FOUND)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@Gui REQUIRED)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@Widgets REQUIRED)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@OpenGL REQUIRED)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@PrintSupport REQUIRED)
|
||||
if(@QT_VERSION_MAJOR@ GREATER 5)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@OpenGLWidgets REQUIRED)
|
||||
endif()
|
||||
|
||||
if(Geant4_qt3d_FOUND)
|
||||
find_dependency(Qt@QT_VERSION_MAJOR@3DCore @QT3D_MINIMUM_VERSION@ REQUIRED)
|
||||
@@ -421,7 +403,6 @@ if(Geant4_qt_FOUND)
|
||||
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 -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT)
|
||||
set(_geant4_use_opengl_library ON)
|
||||
# Qt3D is always on if available
|
||||
set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
|
||||
@@ -446,7 +427,6 @@ if(Geant4_motif_FOUND)
|
||||
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 -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM)
|
||||
set(_geant4_use_opengl_library ON)
|
||||
endif()
|
||||
endif()
|
||||
@@ -463,7 +443,6 @@ if(Geant4_vis_opengl_x11_FOUND)
|
||||
endif()
|
||||
|
||||
if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGLX)
|
||||
set(_geant4_use_opengl_library ON)
|
||||
endif()
|
||||
endif()
|
||||
@@ -473,7 +452,6 @@ set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@)
|
||||
if(Geant4_vis_opengl_win32_FOUND)
|
||||
find_dependency(OpenGL)
|
||||
if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGLWIN32)
|
||||
set(_geant4_use_opengl_library ON)
|
||||
endif()
|
||||
endif()
|
||||
@@ -499,16 +477,6 @@ if(Geant4_vis_openinventor_FOUND)
|
||||
endif()
|
||||
|
||||
if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
|
||||
if(Geant4_vis_openinventor_qt_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIQT)
|
||||
else()
|
||||
if(WIN32)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIWIN32)
|
||||
else()
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_geant4_use_inventor_library ON)
|
||||
endif()
|
||||
endif()
|
||||
@@ -523,21 +491,24 @@ if(Geant4_vis_toolssg_x11_gles_FOUND)
|
||||
else()
|
||||
find_dependency(OpenGL)
|
||||
endif()
|
||||
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)
|
||||
endif()
|
||||
# - ToolsSG X11/ZB
|
||||
set(Geant4_vis_toolssg_x11_zb_FOUND @GEANT4_USE_TOOLSSG_X11_ZB@)
|
||||
if(Geant4_vis_toolssg_x11_zb_FOUND)
|
||||
find_dependency(X11)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - ToolsSG Windows/ZB
|
||||
set(Geant4_vis_toolssg_windows_zb_FOUND @GEANT4_USE_TOOLSSG_WINDOWS_ZB@)
|
||||
|
||||
# - ToolsSG Xt/GLES
|
||||
set(Geant4_vis_toolssg_xt_gles_FOUND @GEANT4_USE_TOOLSSG_XT_GLES@)
|
||||
if(Geant4_vis_toolssg_xt_gles_FOUND)
|
||||
@@ -548,33 +519,37 @@ if(Geant4_vis_toolssg_xt_gles_FOUND)
|
||||
else()
|
||||
find_dependency(OpenGL)
|
||||
endif()
|
||||
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)
|
||||
endif()
|
||||
# - ToolsSG Xt/ZB
|
||||
set(Geant4_vis_toolssg_xt_zb_FOUND @GEANT4_USE_TOOLSSG_XT_ZB@)
|
||||
if(Geant4_vis_toolssg_xt_zb_FOUND)
|
||||
find_dependency(X11)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - ToolsSG Qt/ZB
|
||||
set(Geant4_vis_toolssg_qt_zb_FOUND @GEANT4_USE_TOOLSSG_QT_ZB@)
|
||||
|
||||
# Reset any OpenGL Preference
|
||||
set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
|
||||
|
||||
set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@)
|
||||
if(Geant4_vis_Vtk_FOUND)
|
||||
find_dependency(VTK)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VTK)
|
||||
find_dependency(VTK 9 REQUIRED COMPONENTS
|
||||
CommonColor
|
||||
InteractionStyle
|
||||
IOExport
|
||||
GUISupportQt
|
||||
RenderingVolumeOpenGL2
|
||||
)
|
||||
set(_geant4_use_vtk_library ON)
|
||||
|
||||
if(Geant4_qt_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VTK_QT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -628,13 +603,11 @@ set(_geant4_internal_libraries
|
||||
# - G4OpenGL if it's requested.
|
||||
if(_geant4_use_opengl_library)
|
||||
list(APPEND _geant4_internal_libraries Geant4::G4OpenGL${_geant4_lib_use_suffix})
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL)
|
||||
endif()
|
||||
|
||||
# - Qt3D if it's requested.
|
||||
if(_geant4_use_qt3D_library)
|
||||
list(APPEND _geant4_internal_libraries Geant4::G4visQt3D${_geant4_lib_use_suffix})
|
||||
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_QT3D)
|
||||
endif()
|
||||
|
||||
# - G4OpenInventor if it's requested.
|
||||
@@ -646,6 +619,11 @@ if(_geant4_use_vtk_library)
|
||||
list(APPEND _geant4_internal_libraries Geant4::G4visVtk${_geant4_lib_use_suffix})
|
||||
endif()
|
||||
|
||||
# - GDML always added for now as old G4persistency lib always added if present
|
||||
if(Geant4_gdml_FOUND)
|
||||
set(_geant4_g4gdml_library Geant4::G4gdml${_geant4_lib_use_suffix})
|
||||
endif()
|
||||
|
||||
# - G3toG4 if it's requested
|
||||
if(_geant4_use_g3tog4_library)
|
||||
set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
|
||||
@@ -693,7 +671,9 @@ list(APPEND _geant4_internal_libraries
|
||||
Geant4::G4vis_management${_geant4_lib_use_suffix}
|
||||
Geant4::G4modeling${_geant4_lib_use_suffix}
|
||||
Geant4::G4interfaces${_geant4_lib_use_suffix}
|
||||
Geant4::G4persistency${_geant4_lib_use_suffix}
|
||||
Geant4::G4mctruth${_geant4_lib_use_suffix}
|
||||
Geant4::G4geomtext${_geant4_lib_use_suffix}
|
||||
${_geant4_g4gdml_library}
|
||||
${_geant4_g3tog4_library}
|
||||
Geant4::G4analysis${_geant4_lib_use_suffix}
|
||||
Geant4::G4error_propagation${_geant4_lib_use_suffix}
|
||||
@@ -728,24 +708,9 @@ endforeach()
|
||||
set(Geant4_LIBRARIES ${_geant4_internal_libraries})
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Remove any duplicates from the Geant4_{DEFINITIONS,INCLUDE_DIRS,LIBRARIES}
|
||||
# Remove any duplicates from the Geant4_{INCLUDE_DIRS,LIBRARIES}
|
||||
# variables so that multiple passes append things correctly
|
||||
#
|
||||
if(Geant4_DEFINITIONS)
|
||||
list(REMOVE_DUPLICATES Geant4_DEFINITIONS)
|
||||
endif()
|
||||
# - Create an interface target to export the selected definitions as
|
||||
# usage requirements
|
||||
if(NOT TARGET Geant4::G4UIVisDefinitions)
|
||||
add_library(Geant4::G4UIVisDefinitions INTERFACE IMPORTED)
|
||||
endif()
|
||||
string(REGEX REPLACE "^\-D|;-D" ";" G4UIVIS_COMPILE_DEFINITIONS "${Geant4_DEFINITIONS}")
|
||||
set_target_properties(Geant4::G4UIVisDefinitions PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${G4UIVIS_COMPILE_DEFINITIONS}")
|
||||
unset(G4UIVIS_COMPILE_DEFINITIONS)
|
||||
|
||||
list(APPEND Geant4_LIBRARIES Geant4::G4UIVisDefinitions)
|
||||
|
||||
if(Geant4_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
@@ -116,7 +116,8 @@ for g4incdir in ${includedirs} ; do
|
||||
done
|
||||
|
||||
libs="-lG4interfaces \
|
||||
-lG4persistency \
|
||||
-lG4geomtext \
|
||||
-lG4mctruth \
|
||||
-lG4analysis \
|
||||
-lG4error_propagation \
|
||||
-lG4readout \
|
||||
@@ -176,6 +177,7 @@ feature_list="${feature_list} gdml[${have_gdml}]"
|
||||
|
||||
if test "x${have_gdml}" = "xyes" ; then
|
||||
cflags="${cflags} @G4_XERCESC_CFLAGS@"
|
||||
libs="-lG4gdml ${libs}"
|
||||
fi
|
||||
|
||||
# - PTL
|
||||
|
||||
@@ -74,11 +74,19 @@ foreach(_sourcesfile ${GEANT4_SOURCESCMAKE_FILES})
|
||||
|
||||
# - Find on disk files...
|
||||
file(GLOB
|
||||
_ondisk_hh
|
||||
_ondisk_public_hh
|
||||
RELATIVE ${_sourcesfile_location}/include
|
||||
${_sourcesfile_location}/include/*.hh
|
||||
${_sourcesfile_location}/include/*.icc
|
||||
)
|
||||
file(GLOB
|
||||
_ondisk_private_hh
|
||||
RELATIVE ${_sourcesfile_location}/include/private
|
||||
${_sourcesfile_location}/include/private/*.hh
|
||||
${_sourcesfile_location}/include/private/*.icc
|
||||
)
|
||||
set(_ondisk_hh ${_ondisk_public_hh} ${_ondisk_private_hh})
|
||||
|
||||
file(GLOB
|
||||
_ondisk_cc
|
||||
RELATIVE ${_sourcesfile_location}/src
|
||||
|
||||
Reference in New Issue
Block a user