Import Geant4 11.1.1 source tree
This commit is contained in:
@@ -6,6 +6,20 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-02-06 Ben Morgan (cmake-V11-00-53)
|
||||
- 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)
|
||||
- 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)
|
||||
- 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-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.
|
||||
|
||||
@@ -25,7 +25,7 @@ endif()
|
||||
#Note that the second suggested path is G4 specific...
|
||||
find_path(STATTEST_APP_DIR
|
||||
NAMES StatTestVersion.py
|
||||
PATHS ${STATTEST_ROOT_DIR} ${CMAKE_SOURCE_DIR}/verification/StatTest
|
||||
PATHS ${STATTEST_ROOT_DIR} ${PROJECT_SOURCE_DIR}/verification/StatTest
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ if(GEANT4_ENABLE_TESTING)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/tests)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/benchmarks)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/benchmarks)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/verification)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/verification)
|
||||
add_subdirectory(verification)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -249,7 +249,7 @@ function(geant4_add_unit_tests)
|
||||
if(IS_ABSOLUTE ${incdir})
|
||||
include_directories(${incdir})
|
||||
else()
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/${incdir})
|
||||
include_directories(${PROJECT_SOURCE_DIR}/source/${incdir})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ include(InstallRequiredSystemLibraries)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Copy/Generate common resource files into formats CPack generators like
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/README.txt "
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/README.txt "
|
||||
Geant4
|
||||
======
|
||||
A toolkit for the simulation of the passage of particles through matter.
|
||||
@@ -155,7 +155,7 @@ configure_file(
|
||||
CMakeCPackOptions.cmake
|
||||
@ONLY
|
||||
)
|
||||
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake)
|
||||
set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake)
|
||||
include(CPack)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@ if(GEANT4_ENABLE_TESTING)
|
||||
|
||||
# - Geant4_DIR is needed to locate GeantConfig.cmake file required
|
||||
# by tests and examples
|
||||
set(Geant4_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Current build directory")
|
||||
set(Geant4_DIR ${PROJECT_BINARY_DIR} CACHE PATH "Current build directory")
|
||||
|
||||
# - Add datasets to testing environment
|
||||
geant4_get_datasetnames(_dslist)
|
||||
@@ -53,7 +53,7 @@ endif()
|
||||
# Add Unit Tests if required
|
||||
#
|
||||
if(GEANT4_BUILD_TESTS)
|
||||
file(GLOB_RECURSE files RELATIVE ${CMAKE_SOURCE_DIR} source/CMakeLists.txt)
|
||||
file(GLOB_RECURSE files RELATIVE ${PROJECT_SOURCE_DIR} source/CMakeLists.txt)
|
||||
foreach( file ${files} )
|
||||
get_filename_component(path ${file} PATH)
|
||||
if(path MATCHES "/test$")
|
||||
|
||||
@@ -187,12 +187,6 @@ configure_file(
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/G4VecGeomShim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4VecGeomShim.cmake
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/G4X11Shim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4X11Shim.cmake
|
||||
@@ -274,7 +268,6 @@ install(FILES
|
||||
${PROJECT_BINARY_DIR}/G4EXPATShim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4FreetypeShim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4HDF5Shim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4VecGeomShim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4MotifShim.cmake
|
||||
${PROJECT_BINARY_DIR}/G4X11Shim.cmake
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/UseGeant4.cmake
|
||||
|
||||
@@ -694,7 +694,7 @@ macro(_g4tc_configure_build_tree_scripts SCRIPT_NAME)
|
||||
|
||||
# Configure the file - goes straight into the binary dir
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4make-skeleton.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4make-skeleton.in
|
||||
${PROJECT_BINARY_DIR}/${SCRIPT_NAME}${GEANT4_TC_SHELL_EXTENSION}
|
||||
@ONLY
|
||||
)
|
||||
@@ -715,7 +715,7 @@ macro(_g4tc_configure_install_tree_scripts CONFIGURE_DESTINATION SCRIPT_NAME INS
|
||||
|
||||
# Configure the file
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4make-skeleton.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4make-skeleton.in
|
||||
${CONFIGURE_DESTINATION}/${SCRIPT_NAME}${GEANT4_TC_SHELL_EXTENSION}
|
||||
@ONLY
|
||||
)
|
||||
@@ -835,7 +835,7 @@ set(TOOLS_FONT_PATH "\"`cd \$geant4make_root/../fonts > /dev/null ; pwd`\"")
|
||||
|
||||
# - Configure the shell scripts for the INSTALL TREE
|
||||
_g4tc_configure_install_tree_scripts(
|
||||
${CMAKE_BINARY_DIR}/InstallTreeFiles
|
||||
${PROJECT_BINARY_DIR}/InstallTreeFiles
|
||||
geant4make
|
||||
${CMAKE_INSTALL_DATADIR}/geant4make
|
||||
)
|
||||
@@ -1010,7 +1010,7 @@ foreach(_shell IN LISTS shells_list)
|
||||
|
||||
# Configure the file
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-env-skeleton.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4-env-skeleton.in
|
||||
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
|
||||
@ONLY
|
||||
)
|
||||
@@ -1099,7 +1099,7 @@ rem Uncomment the line and edit the path to the dataset if installed in not stan
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-bat-skeleton.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4-bat-skeleton.in
|
||||
${PROJECT_BINARY_DIR}/InstallTreeFiles/${_scriptfullname}
|
||||
@ONLY
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ function(get_system_include_dirs _dirs)
|
||||
# Only for GCC, Clang and Intel
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel)
|
||||
# Proceed
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/g4dummy" "\n")
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/CMakeFiles/g4dummy" "\n")
|
||||
|
||||
# Save locale, them to "C" english locale so we can parse in English
|
||||
set(_orig_lc_all $ENV{LC_ALL})
|
||||
@@ -72,12 +72,12 @@ function(get_system_include_dirs _dirs)
|
||||
set(ENV{LANG} C)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v -E -x c++ -dD g4dummy
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles
|
||||
ERROR_VARIABLE _cxxOutput
|
||||
OUTPUT_VARIABLE _cxxStdout
|
||||
)
|
||||
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/g4dummy")
|
||||
file(REMOVE "${PROJECT_BINARY_DIR}/CMakeFiles/g4dummy")
|
||||
|
||||
# Parse and extract search dirs
|
||||
set(_resultIncludeDirs )
|
||||
@@ -349,7 +349,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS)
|
||||
|
||||
# Configure the build tree script
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4-config.in
|
||||
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/geant4-config
|
||||
@ONLY
|
||||
)
|
||||
@@ -390,7 +390,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS)
|
||||
|
||||
# Configure the install tree script
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4-config.in
|
||||
${PROJECT_BINARY_DIR}/InstallTreeFiles/geant4-config
|
||||
@ONLY
|
||||
)
|
||||
@@ -409,7 +409,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS)
|
||||
if(WIN32)
|
||||
# No configuration just a copy
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/Templates/geant4-config-cmd.in
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/geant4-config-cmd.in
|
||||
${PROJECT_BINARY_DIR}/InstallTreeFiles/geant4-config.cmd
|
||||
@ONLY
|
||||
)
|
||||
|
||||
@@ -296,11 +296,6 @@ endif()
|
||||
# - Geant4 USolids/VecGom setup
|
||||
if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
|
||||
find_package(VecGeom 1.2.0 REQUIRED)
|
||||
# Shim until VecGeom supports config mode properly
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
|
||||
# Backward Compatibility
|
||||
set(VECGEOM_LIBRARIES VecGeom::vecgeom)
|
||||
|
||||
geant4_save_package_variables(VecGeom VecGeom_DIR)
|
||||
|
||||
# If VecCore_DIR is set, means updated VecGeom install used, so
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Create imported target to help use VecGeom (a mess because the VecGeomConfig is...)
|
||||
if(VecGeom_FOUND)
|
||||
if(NOT TARGET VecGeom::vecgeom)
|
||||
add_library(VecGeom::vecgeom UNKNOWN IMPORTED)
|
||||
# VecGeom's config file is awful, so the following is neccessary...
|
||||
foreach(__vglib ${VECGEOM_LIBRARIES})
|
||||
if(__vglib MATCHES ".*libvecgeom\.(a|so|dylib|lib|dll)$")
|
||||
set(VECGEOM_LIBRARY "${__vglib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
string(REGEX REPLACE "^\-D|;-D" ";" VECGEOM_COMPILE_DEFINITIONS "${VECGEOM_DEFINITIONS}")
|
||||
set_target_properties(VecGeom::vecgeom PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${VECGEOM_COMPILE_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${VECGEOM_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${VECGEOM_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${VECGEOM_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -333,7 +333,6 @@ endif()
|
||||
set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@)
|
||||
if(Geant4_usolids_FOUND)
|
||||
find_dependency(VecGeom @VecGeom_VERSION@)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
|
||||
endif()
|
||||
|
||||
# - Freetype
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#
|
||||
function(geant4_add_test test)
|
||||
if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)
|
||||
message(WARNING "function GEANT4_ADD_TEST is only for internal Geant4 usage")
|
||||
message(WARNING "geant4_add_test is only for internal Geant4 usage, test '${test}' is disabled")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -116,9 +116,11 @@ function(geant4_add_test test)
|
||||
endif()
|
||||
|
||||
#- Locate the test driver
|
||||
set(_driver ${CMAKE_SOURCE_DIR}/cmake/Modules/G4TestDriver.cmake)
|
||||
# This is one of the few cases where we require ..._SOURCE_DIR to be scoped to Geant4
|
||||
# because we may have called geant4_add_test after a project() call, as in the integration tests
|
||||
set(_driver ${Geant4_SOURCE_DIR}/cmake/Modules/G4TestDriver.cmake)
|
||||
if(NOT EXISTS ${_driver})
|
||||
message(FATAL_ERROR "GEANT4_ADD_TEST: G4TestDriver.cmake not found!")
|
||||
message(FATAL_ERROR "geant4_add_test: G4TestDriver.cmake not found!")
|
||||
endif()
|
||||
set(_command ${_command} -P ${_driver})
|
||||
|
||||
@@ -147,6 +149,8 @@ function(geant4_add_test test)
|
||||
endif()
|
||||
|
||||
# Build part of the test
|
||||
# Again, note that we scope Geant4_DIR to Geant4_BINARY_DIR so we don't accidentally pickup
|
||||
# local or higher scopes
|
||||
add_test(NAME ${__build_test_name} COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test ${ARG_SOURCE_DIR} ${ARG_BINARY_DIR}
|
||||
--build-generator ${CMAKE_GENERATOR}
|
||||
@@ -157,7 +161,7 @@ function(geant4_add_test test)
|
||||
--build-noclean
|
||||
--build-options
|
||||
--no-warn-unused-cli
|
||||
-DGeant4_DIR=${CMAKE_BINARY_DIR}
|
||||
-DGeant4_DIR=${Geant4_BINARY_DIR}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
|
||||
@@ -172,7 +176,7 @@ function(geant4_add_test test)
|
||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_ROOT=$<BOOL:${CMAKE_DISABLE_FIND_PACKAGE_ROOT}>
|
||||
)
|
||||
set_property(TEST ${__build_test_name} PROPERTY ENVIRONMENT Geant4_DIR=${CMAKE_BINARY_DIR})
|
||||
set_property(TEST ${__build_test_name} PROPERTY ENVIRONMENT Geant4_DIR=${Geant4_BINARY_DIR})
|
||||
|
||||
# Build part of the test should have additional regex, and *must* have same labels
|
||||
if(ARG_FAILREGEX)
|
||||
|
||||
@@ -69,6 +69,7 @@ vis_libs="-lG4Tree \
|
||||
-lG4visHepRep \
|
||||
-lG4RayTracer \
|
||||
-lG4VRML \
|
||||
-lG4ToolsSG \
|
||||
-lG4vis_management \
|
||||
-lG4modeling"
|
||||
|
||||
@@ -214,7 +215,7 @@ feature_list="${feature_list} qt[${have_qt}]"
|
||||
|
||||
if test "x${have_qt}" = "xyes" ; then
|
||||
vis_cflags="${vis_cflags} \
|
||||
-DG4UI_USE_QT -DG4VIS_USE_OPENGLQT @G4_QT_CFLAGS@"
|
||||
-DG4UI_USE_QT -DG4VIS_USE_OPENGLQT -DG4VIS_USE_TOOLSSG_QT_GLES @G4_QT_CFLAGS@"
|
||||
geant4_uses_opengl="yes"
|
||||
fi
|
||||
|
||||
@@ -232,7 +233,7 @@ have_motif="@G4_BUILTWITH_MOTIF@"
|
||||
feature_list="${feature_list} motif[${have_motif}]"
|
||||
|
||||
if test "x${have_motif}" = "xyes" ; then
|
||||
vis_cflags="${vis_cflags} -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM"
|
||||
vis_cflags="${vis_cflags} -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM -DG4VIS_USE_TOOLSSG_XT_GLES"
|
||||
geant4_uses_x11="yes"
|
||||
geant4_uses_opengl="yes"
|
||||
fi
|
||||
@@ -251,7 +252,7 @@ have_openglx11="@G4_BUILTWITH_OPENGLX11@"
|
||||
feature_list="${feature_list} opengl-x11[${have_openglx11}]"
|
||||
|
||||
if test "x${have_openglx11}" = "xyes" ; then
|
||||
vis_cflags="${vis_cflags} -DG4VIS_USE_OPENGLX"
|
||||
vis_cflags="${vis_cflags} -DG4VIS_USE_OPENGLX -DG4VIS_USE_TOOLSSG_X11_GLES"
|
||||
geant4_uses_opengl="yes"
|
||||
geant4_uses_x11="yes"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user