Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+1 -6
View File
@@ -1,10 +1,5 @@
#-----------------------------------------------------------------------
# - Top Level CMakeLists.txt for Geant4 Build
#
# 21st September 2010 Ben Morgan
#
#
#-----------------------------------------------------------------------
# - Enforce an out-of-source builds before anything else
#
@@ -21,7 +16,7 @@ endif()
#-----------------------------------------------------------------------
# - Define CMake requirements and override make rules as needed
#
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
# - Any policy requirements should go here
File diff suppressed because it is too large Load Diff
+281 -152
View File
File diff suppressed because it is too large Load Diff
+87 -99
View File
@@ -44,113 +44,101 @@
# 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)
FIND_PATH( Wt_INCLUDE_DIR NAMES Wt/WObject PATHS ENV PATH PATH_SUFFIXES include wt )
# - 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")
SET( Wt_FIND_COMPONENTS Release Debug )
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_INCLUDE_DIR )
FIND_LIBRARY( Wt_LIBRARY NAMES wt PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_EXT_LIBRARY NAMES wtext PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_HTTP_LIBRARY NAMES wthttp PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_FCGI_LIBRARY NAMES wtfcgi PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_DBO_LIBRARY NAMES wtdbo PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_DBOSQLITE3_LIBRARY NAMES wtdbosqlite3 PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
FIND_LIBRARY( Wt_DBOPOSTGRES_LIBRARY NAMES wtdbopostgres PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
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()
FIND_LIBRARY( Wt_DEBUG_LIBRARY NAMES wtd wt PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_EXT_DEBUG_LIBRARY NAMES wtextd wtext PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_HTTP_DEBUG_LIBRARY NAMES wthttpd wthttp PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_FCGI_DEBUG_LIBRARY NAMES wtfcgid wtfcgi PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_DBO_DEBUG_LIBRARY NAMES wtdbod wtdbo PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_DBOSQLITE3_DEBUG_LIBRARY NAMES wtdbosqlite3d wtdbosqlite3 PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
FIND_LIBRARY( Wt_DBOPOSTGRES_DEBUG_LIBRARY NAMES wtdbopostgresd wtdbopostgres PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
if(NOT Wt_LIBRARY_RELEASE AND NOT Wt_LIBRARY_DEBUG)
set_property(TARGET Wt::Wt APPEND PROPERTY
IMPORTED_LOCATION "${Wt_LIBRARY}")
endif()
endif()
IF( Wt_LIBRARY )
IF( Wt_HTTP_LIBRARY )
SET( Wt_FOUND TRUE )
SET( Wt_FIND_REQUIRED_Release TRUE )
SET( Wt_LIBRARIES ${Wt_HTTP_LIBRARY} ${Wt_LIBRARY} )
IF( Wt_FCGI_LIBRARY )
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_FCGI_LIBRARY} )
ENDIF( Wt_FCGI_LIBRARY )
ELSE( Wt_HTTP_LIBRARY )
IF( Wt_FCGI_LIBRARY )
SET( Wt_FOUND TRUE )
SET( Wt_FIND_REQUIRED_Release TRUE )
SET( Wt_LIBRARIES ${Wt_FCGI_LIBRARY} ${Wt_LIBRARY} )
ENDIF( Wt_FCGI_LIBRARY )
ENDIF( Wt_HTTP_LIBRARY )
ENDIF( Wt_LIBRARY )
# 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_EXT_LIBRARY )
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_EXT_LIBRARY} )
ENDIF( Wt_EXT_LIBRARY )
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_DBO_LIBRARY )
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBO_LIBRARY} )
IF( Wt_DBOSQLITE3_LIBRARY )
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBOSQLITE3_LIBRARY} )
ENDIF( Wt_DBOSQLITE3_LIBRARY )
IF( Wt_DBOPOSTGRES_LIBRARY )
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBOPOSTGRES_LIBRARY} )
ENDIF( Wt_DBOPOSTGRES_LIBRARY )
ENDIF( Wt_DBO_LIBRARY )
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( Wt_DEBUG_LIBRARY )
IF ( Wt_HTTP_DEBUG_LIBRARY)
SET( Wt_DEBUG_FOUND TRUE )
SET( Wt_FIND_REQUIRED_Debug TRUE )
SET( Wt_DEBUG_LIBRARIES ${Wt_HTTP_DEBUG_LIBRARY} ${Wt_DEBUG_LIBRARY} )
IF( Wt_FCGI_DEBUG_LIBRARY )
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_FCGI_DEBUG_LIBRARY} )
ENDIF( Wt_FCGI_DEBUG_LIBRARY )
ELSE( Wt_HTTP_DEBUG_LIBRARY )
IF( Wt_FCGI_DEBUG_LIBRARY )
SET( Wt_DEBUG_FOUND TRUE )
SET( Wt_FIND_REQUIRED_Debug TRUE )
SET( Wt_DEBUG_LIBRARIES ${Wt_FCGI_DEBUG_LIBRARY} ${Wt_DEBUG_LIBRARY} )
ENDIF( Wt_FCGI_DEBUG_LIBRARY )
ENDIF( Wt_HTTP_DEBUG_LIBRARY)
ENDIF( Wt_DEBUG_LIBRARY )
IF( Wt_DBO_DEBUG_LIBRARY )
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBO_DEBUG_LIBRARY} )
IF( Wt_DBOSQLITE3_DEBUG_LIBRARY )
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBOSQLITE3_DEBUG_LIBRARY} )
ENDIF( Wt_DBOSQLITE3_DEBUG_LIBRARY )
IF( Wt_DBOPOSTGRES_DEBUG_LIBRARY )
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBOPOSTGRES_DEBUG_LIBRARY} )
ENDIF( Wt_DBOPOSTGRES_DEBUG_LIBRARY )
ENDIF( Wt_DBO_DEBUG_LIBRARY )
IF(Wt_FOUND)
IF (NOT Wt_FIND_QUIETLY)
MESSAGE(STATUS "Found the Wt libraries at ${Wt_LIBRARIES}")
MESSAGE(STATUS "Found the Wt headers at ${Wt_INCLUDE_DIR}")
ENDIF (NOT Wt_FIND_QUIETLY)
ELSE(Wt_FOUND)
IF(Wt_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find Wt")
ENDIF(Wt_FIND_REQUIRED)
ENDIF(Wt_FOUND)
IF(Wt_DEBUG_FOUND)
IF (NOT Wt_FIND_QUIETLY)
MESSAGE(STATUS "Found the Wt debug libraries at ${Wt_DEBUG_LIBRARIES}")
MESSAGE(STATUS "Found the Wt debug headers at ${Wt_INCLUDE_DIR}")
ENDIF (NOT Wt_FIND_QUIETLY)
ELSE(Wt_DEBUG_FOUND)
IF(Wt_FIND_REQUIRED_Debug)
MESSAGE(FATAL_ERROR "Could NOT find Wt debug libraries")
ENDIF(Wt_FIND_REQUIRED_Debug)
ENDIF(Wt_DEBUG_FOUND)
ENDIF( Wt_INCLUDE_DIR )
find_package_handle_standard_args(Wt DEFAULT_MSG Wt_INCLUDE_DIR Wt_LIBRARY)
set(Wt_FOUND ${WT_FOUND})
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
View File
@@ -0,0 +1,97 @@
#[=======================================================================[.rst:
FindXQuartzGL
-------------
FindModule for XQuartz implementation of OpenGL/GLU. Specific to Geant4
to allow use of XQuartz only.
Use of the module on non-macOS systems will result in a fatal error
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines the :prop_tgt:`IMPORTED` targets:
``XQuartz::GL``
Defined to the XQuartz GL library
``XQuartz::GLU``
Define to the XQuartz GLU library
Result Variables
^^^^^^^^^^^^^^^^
This module sets the following variables:
``XQuartzGL_FOUND``
True, if the XQuartz GL/GLU libraries were located
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set
``XQuartzGL_INCLUDE_DIR``
Path to the XQuartz GL include directory
``XQuartzGL_gl_LIBRARY``
Path to the XQuartz GL library
``XQuartzGL_glu_LIBRARY``
Path to the XQuartz GLU library
#]=======================================================================]
# Just don't run if we're on macOS
if(NOT APPLE)
message(FATAL_ERROR "FindXquartzGL is only for use on macOS platforms")
endif()
# - This is for X11 GL drivers, so we DON'T want Framework!
set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
find_path(XQuartzGL_INCLUDE_DIR GL/gl.h
PATHS /usr/X11R6/include /opt/X11/include
NO_DEFAULT_PATH
)
find_library(XQuartzGL_gl_LIBRARY GL
PATHS /usr/X11R6/lib /opt/X11/lib
NO_DEFAULT_PATH
)
find_library(XQuartzGL_glu_LIBRARY GLU
PATHS /usr/X11R6/lib /opt/X11/lib
NO_DEFAULT_PATH
)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XQuartzGL
FOUND_VAR
XQuartzGL_FOUND
REQUIRED_VARS
XQuartzGL_INCLUDE_DIR
XQuartzGL_gl_LIBRARY
XQuartzGL_glu_LIBRARY
)
mark_as_advanced(XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRARY)
if(XQuartzGL_FOUND)
if(NOT TARGET XQuartzGL::GL)
add_library(XQuartzGL::GL UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
IMPORTED_LOCATION "${XQuartzGL_gl_LIBRARY}"
)
endif()
if(NOT TARGET XQuartzGL::GLU)
add_library(XQuartzGL::GLU UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GLU PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES XQuartzGL::GL
IMPORTED_LOCATION "${XQuartzGL_glu_LIBRARY}"
)
endif()
endif()
-79
View File
@@ -1,79 +0,0 @@
# - Find Xerces-C
# This module tries to find the Xerces-C library and headers.
# Once done this will define
#
# XERCESC_FOUND - system has Xerces-C headers and libraries
# XERCESC_INCLUDE_DIRS - the include directories needed for Xerces-C
# XERCESC_LIBRARIES - the libraries needed to use Xerces-C
#
# Variables used by this module, which can change the default behaviour and
# need to be set before calling find_package:
#
# XERCESC_ROOT_DIR Root directory to Xerces-C installation. Will
# be used ahead of CMake default path.
#
# The following advanced variables may be used if the module has difficulty
# locating Xerces-C or you need fine control over what is used.
#
# XERCESC_INCLUDE_DIR
#
# XERCESC_LIBRARY
#
# Copyright (c) 2009, 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.
# Look for the header - preferentially searching below XERCESC_ROOT_DIR
find_path(
XERCESC_INCLUDE_DIR
NAMES xercesc/util/XercesVersion.hpp
PATHS ${XERCESC_ROOT_DIR}
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
# If we didn't find it there, fall back to some standard search paths
find_path(
XERCESC_INCLUDE_DIR
NAMES xercesc/util/XercesVersion.hpp
)
# Look for the library, preferentially searching below XERCESC_ROOT_DIR
find_library(
XERCESC_LIBRARY
NAMES xerces-c xerces-c_3
PATHS ${XERCESC_ROOT_DIR}
PATH_SUFFIXES lib64 lib32 lib
NO_DEFAULT_PATH
)
find_library(
XERCESC_LIBRARY
NAMES xerces-c xerces-c_3
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
XercesC
DEFAULT_MSG
XERCESC_LIBRARY
XERCESC_INCLUDE_DIR
)
if (XERCESC_FOUND)
set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
set(XERCESC_INCLUDE_DIRS ${XERCESC_INCLUDE_DIR})
else (XERCESC_FOUND)
set(XERCESC_LIBRARIES)
set(XERCESC_INCLUDE_DIRS)
endif (XERCESC_FOUND)
mark_as_advanced(
XERCESC_LIBRARY
XERCESC_INCLUDE_DIR
)
+8 -1
View File
@@ -57,6 +57,7 @@ endif()
#
include(CheckCXXSourceCompiles)
include(IntelCompileFeatures)
include(MSVCCompileFeatures)
#-----------------------------------------------------------------------
#.rst:
@@ -156,10 +157,16 @@ endif() #NOT WIN32
# - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, c++11, c++14, c++17)
#
# - Choose C++ Standard to build against from supported list.
# - Note that only C++17 is supported on Windows with MSVC
#
set(__g4_default_cxxstd 11 14 17 c++11 c++14 c++17)
if(MSVC)
set(__g4_default_cxxstd 17 c++17)
endif()
enum_option(GEANT4_BUILD_CXXSTD
DOC "C++ Standard to compile against"
VALUES 11 14 17 c++11 c++14 c++17
VALUES ${__g4_default_cxxstd}
CASE_INSENSITIVE
)
+51
View File
@@ -179,6 +179,57 @@ function(geant4_latest_version dir name var)
set(${var} ${dir}/${name}${newer} PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------
# GEANT4 EXTERNAL PACKAGE HELPERS
#-----------------------------------------------------------------------
# function geant4_save_package_variables(<title> <var1> ... <varN>)
# Save variables <var1> ... <varN> under <title> for export to
# build-time package settings file.
#
function(geant4_save_package_variables _title)
get_property(__ep_titles GLOBAL PROPERTY GEANT4_EXPORT_PACKAGE_TITLES)
if(NOT (${_title} IN_LIST __ep_titles))
set_property(GLOBAL APPEND PROPERTY GEANT4_EXPORT_PACKAGE_TITLES ${_title})
endif()
get_property(__exported_vars GLOBAL PROPERTY GEANT4_EXPORT_PACKAGE_${_title}_VARIABLES)
foreach(__varname ${ARGN})
if(NOT (${__varname} IN_LIST __exported_vars))
# TODO: Also check that the save variable is in the cache...
# if(CACHE ...) only available from 3.14
set_property(GLOBAL APPEND PROPERTY GEANT4_EXPORT_PACKAGE_${_title}_VARIABLES ${__varname})
endif()
endforeach()
endfunction()
# function geant4_export_package_variables(<file>)
# Write saved package variables to <file>
#
function(geant4_export_package_variables _file)
set(GEANT4_PACKAGE_SETTINGS )
get_property(__g4_exports GLOBAL PROPERTY GEANT4_EXPORT_PACKAGE_TITLES)
foreach(__pkg_title ${__g4_exports})
set(__local_build_setting "\n# ${__pkg_title} Build Time Settings")
get_property(__pkg_vars GLOBAL PROPERTY GEANT4_EXPORT_PACKAGE_${__pkg_title}_VARIABLES)
foreach(__var ${__pkg_vars})
get_property(__var_value CACHE ${__var} PROPERTY VALUE)
get_property(__var_type CACHE ${__var} PROPERTY TYPE)
get_property(__var_help CACHE ${__var} PROPERTY HELPSTRING)
list(APPEND __local_build_setting "geant4_set_and_check_package_variable(${__var} \"${__var_value}\" ${__var_type} \"${__var_help}\")")
endforeach()
list(APPEND GEANT4_PACKAGE_SETTINGS ${__local_build_setting})
endforeach()
string(REPLACE ";" "\n" GEANT4_PACKAGE_SETTINGS "${GEANT4_PACKAGE_SETTINGS}")
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/Geant4PackageCache.cmake.in
${_file}
@ONLY
)
endfunction()
#-----------------------------------------------------------------------
# GEANT4 TESTING
+168
View File
@@ -0,0 +1,168 @@
################################################################################
#
# Creates a 'format' target that runs clang-format
#
################################################################################
# - Include guard
if(NOT __G4CLANGFORMAT_INCLUDED)
set(__G4CLANGFORMAT_INCLUDED 1)
else()
return()
endif()
#------------------------------------------------------------------------------#
set(G4FORMAT_LOGDIR ${PROJECT_BINARY_DIR}/format CACHE PATH
"Output folder of files that are formatted")
#------------------------------------------------------------------------------#
find_program(CLANG_FORMATTER
NAMES
clang-format-8.0
clang-format-7.0
clang-format-6.0
clang-format)
#------------------------------------------------------------------------------#
function(exclude_from_format)
cmake_parse_arguments(ARG
"" "" "HEADERS;SOURCES;FILES" ${ARGN})
function(_add_labels _path)
foreach(_FILE ${ARGN})
if(NOT IS_ABSOLUTE ${_FILE})
set(_FILE ${CMAKE_CURRENT_LIST_DIR}${_path}/${_FILE})
endif()
set(_LABELS "EXCLUDE_FORMAT")
get_source_file_property(_EXISTING_LABELS ${_FILE} LABELS)
if(_EXISTING_LABELS)
list(APPEND _LABELS ${_EXISTING_LABELS})
endif()
set_source_files_properties(${_FILE} PROPERTIES
LABELS "${_LABELS}")
get_source_file_property(_EXISTING_LABELS ${_FILE} LABELS)
endforeach()
endfunction()
_add_labels("/include" ${ARG_HEADERS})
_add_labels("/src" ${ARG_SOURCES})
_add_labels("" ${ARG_FILES})
endfunction()
#------------------------------------------------------------------------------#
function(create_format_directory)
if(NOT EXISTS ${G4FORMAT_LOGDIR})
execute_process(COMMAND ${CMAKE_COMMAND}
-E make_directory ${G4FORMAT_LOGDIR})
endif()
endfunction()
#------------------------------------------------------------------------------#
function(geant4_format_target)
if(CLANG_FORMATTER)
cmake_parse_arguments(G4FMTTARGET
"" "NAME" "SOURCES" ${ARGN})
string(REGEX REPLACE "-format$" "" G4TARGET_NAME "${G4FMTTARGET_NAME}")
# ensure not empty list
if(NOT "${G4FMTTARGET_SOURCES}" STREQUAL "")
# create output directory
create_format_directory()
set(SOURCES ) # list of sources
set(FILELOG ) # string of sources (for log)
foreach(_SOURCE ${G4FMTTARGET_SOURCES})
# files in binary directory are almost always generated files
string(FIND "${_SOURCE}" "${PROJECT_BINARY_DIR}" IN_BINARY_DIR)
# ignore generated files
if(IN_BINARY_DIR GREATER -1)
continue()
endif()
# check if exists (valid full path)
if(EXISTS "${_SOURCE}")
# do nothing -- absolute path was specified
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${_SOURCE}")
# a relative path was specified
set(_SOURCE ${CMAKE_CURRENT_LIST_DIR}/${_SOURCE})
else()
# neither relative nor absolute
message(STATUS "[format] file not found: '${_SOURCE}'")
continue()
endif()
#string(REPLACE "${PROJECT_SOURCE_DIR}/" "" _SOURCE ${_SOURCE})
get_source_file_property(SOURCE_LABELS ${_SOURCE} LABELS)
list(FIND SOURCE_LABELS "EXCLUDE_FORMAT" EXCLUDE_FORMAT)
if(EXCLUDE_FORMAT GREATER -1)
continue()
endif()
# append to log
set(FILELOG "${FILELOG}${_SOURCE}\n")
# add to list to be processed
list(APPEND SOURCES ${_SOURCE})
endforeach()
# write format file
set(FMTLOG_OUT ${G4FORMAT_LOGDIR}/${G4TARGET_NAME}.txt)
file(WRITE ${FMTLOG_OUT} "${FILELOG}")
file(RELATIVE_PATH FMTLOG_RELATIVE_OUT ${PROJECT_BINARY_DIR} ${FMTLOG_OUT})
# get the number of source files
list(LENGTH SOURCES NUM_SOURCES)
# if there are too many source files (arguments), command will fail
# so process no more than 500 at a time
if(NUM_SOURCES GREATER 500)
# function to generate indices
function(generate_indices VAR NUM)
set(INDICES )
set(N 0)
while(N LESS NUM)
list(APPEND INDICES ${N})
math(EXPR N "${N}+1")
endwhile()
set(${VAR} ${INDICES} PARENT_SCOPE)
endfunction()
# generate 500 indices
generate_indices(INDICES 500)
set(FORMAT_COMMANDS )
# while there are still sources in list
while(NUM_SOURCES GREATER 0)
# if below 500, re-generate indices
if(NUM_SOURCES LESS 500)
generate_indices(INDICES ${NUM_SOURCES})
endif()
# get the subset of first 500
list(GET SOURCES ${INDICES} SOURCES_SUBSET)
# add the target for block of 500
list(APPEND FORMAT_COMMANDS COMMAND ${CLANG_FORMATTER} -i ${SOURCES_SUBSET})
# remove 500 we just processed
list(REMOVE_AT SOURCES ${INDICES})
# update the number of sources remaining
list(LENGTH SOURCES NUM_SOURCES)
endwhile()
# add the custom command
list(LENGTH FORMAT_COMMANDS NUM_COMMANDS)
if(NUM_COMMANDS GREATER 0)
add_custom_target(${G4FMTTARGET_NAME}
${FORMAT_COMMANDS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT
"Running '${CLANG_FORMATTER}' on source files in '${G4TARGET_NAME}' target (see ${FMTLOG_RELATIVE_OUT})...")
endif()
else()
list(LENGTH SOURCES NUM_SOURCES)
if(NUM_SOURCES GREATER 0)
# if less than 500 source files, add all in one target
add_custom_target(${G4FMTTARGET_NAME}
COMMAND ${CLANG_FORMATTER} -i ${SOURCES}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT
"Running '${CLANG_FORMATTER}' on source files in '${G4TARGET_NAME}' target (see ${FMTLOG_RELATIVE_OUT})...")
endif()
endif(NUM_SOURCES GREATER 500)
endif(NOT "${G4FMTTARGET_SOURCES}" STREQUAL "")
endif(CLANG_FORMATTER)
endfunction()
#------------------------------------------------------------------------------#
+79 -58
View File
@@ -38,7 +38,6 @@
# Compiler flags (because user apps are a bit dependent on them...)
set(GEANT4_COMPILER_FLAG_HINTS "#
set(CMAKE_CXX_EXTENSIONS OFF)
set(Geant4_CXX_FLAGS \"${CMAKE_CXX_FLAGS} ${GEANT4_CXXSTD_FLAGS}\")
set(Geant4_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}\")")
@@ -83,45 +82,26 @@ if(NOT GEANT4_USE_SYSTEM_ZLIB)
list(APPEND GEANT4_EXTERNALS_TARGETS G4zlib)
endif()
# - GDML
# Need to include Xerces-C headers becuase these do appear in the public
# interface of GDML. The library should then be in the LINK_INTERFACE of
# persistency...
if(GEANT4_USE_GDML)
list(APPEND GEANT4_THIRD_PARTY_INCLUDES ${XERCESC_INCLUDE_DIRS})
endif()
# - USolids
# Compile definitions
if(GEANT4_USE_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
set(GEANT4_USE_USOLIDS_EITHER ON)
# System USolids headers, because these do appear in Geant4's
# public interface. The library should be in the link interface
# of G4geometry (may need refinding)
list(APPEND GEANT4_CORE_DEFINITIONS ${VECGEOM_DEFINITIONS})
list(APPEND GEANT4_THIRD_PARTY_INCLUDES "${USOLIDS_INCLUDE_DIRS} ${VECGEOM_EXTERNAL_INCLUDES}")
endif()
# - Stuff from Geant4InterfaceOptions.cmake
if(GEANT4_USE_QT)
list(APPEND GEANT4_THIRD_PARTY_INCLUDES
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${QT_QTOPENGL_INCLUDE_DIR}
)
# On WIN32, re-import the Qt targets.
if(WIN32)
set(GEANT4_QT4_IMPORT_SETUP "
# Qt reimport on WIN32
set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE})
set(QT_USE_IMPORTED_TARGETS ON)
find_package(Qt4 REQUIRED)
")
endif()
endif()
#-----------------------------------------------------------------------
# - Common Build/Install Tree Configuration files
#-----------------------------------------------------------------------
# External package variables
geant4_export_package_variables(${PROJECT_BINARY_DIR}/Geant4PackageCache.cmake)
# Versioning file
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/Geant4ConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/Geant4ConfigVersion.cmake
@ONLY
)
#-----------------------------------------------------------------------
# - Generate Build Tree Configuration Files
@@ -133,6 +113,8 @@ set(GEANT4_CMAKE_DIR "${PROJECT_BINARY_DIR}")
# rather paths. We extract the paths from the global
# GEANT4_BUILDTREE_INCLUDE_DIRS property and use this to create the
# header setup
# This is *ONLY* required in case clients use ROOT dictionaries, whose
# generation mechanism is blind to usage requirements
#
get_property(__geant4_buildtree_include_dirs GLOBAL PROPERTY
GEANT4_BUILDTREE_INCLUDE_DIRS
@@ -140,20 +122,15 @@ get_property(__geant4_buildtree_include_dirs GLOBAL PROPERTY
set(GEANT4_INCLUDE_DIR_SETUP "
# Geant4 configured for use from the build tree - absolute paths are used.
set(Geant4_INCLUDE_DIR ${__geant4_buildtree_include_dirs})
")
set(GEANT4_MODULE_PATH_SETUP "
# Geant4 configured for use CMake modules from source tree
set(CMAKE_MODULE_PATH \${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH})
set(Geant4_INCLUDE_DIR \"${__geant4_buildtree_include_dirs}\")
")
# Geant4 data used in build tree
geant4_export_datasets(BUILD GEANT4_DATASET_DESCRIPTIONS)
# Export targets in the Geant4LibraryDepends export set from the build tree
# No longer need GEANT4_EXPORTED_TARGETS global property to list these for us.
export(EXPORT Geant4LibraryDepends
NAMESPACE Geant4::
FILE ${PROJECT_BINARY_DIR}/Geant4LibraryDepends.cmake
)
@@ -164,13 +141,6 @@ configure_file(
@ONLY
)
# Configure the build tree versioning file
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/Geant4ConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/Geant4ConfigVersion.cmake
@ONLY
)
# Copy the custom modules into the build tree
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/IntelCompileFeatures.cmake
@@ -178,7 +148,50 @@ configure_file(
COPYONLY
)
foreach(_mod AIDA HepMC Pythia6 StatTest TBB)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/MSVCCompileFeatures.cmake
${PROJECT_BINARY_DIR}/Modules/MSVCCompileFeatures.cmake
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/G4EXPATShim.cmake
${PROJECT_BINARY_DIR}/G4EXPATShim.cmake
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/G4FreetypeShim.cmake
${PROJECT_BINARY_DIR}/G4FreetypeShim.cmake
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/G4HDF5Shim.cmake
${PROJECT_BINARY_DIR}/G4HDF5Shim.cmake
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/G4MotifShim.cmake
${PROJECT_BINARY_DIR}/G4MotifShim.cmake
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
COPYONLY
)
foreach(_mod AIDA HepMC Pythia6 StatTest TBB XQuartzGL)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/Find${_mod}.cmake
${PROJECT_BINARY_DIR}/Modules/Find${_mod}.cmake
@@ -226,14 +239,13 @@ get_filename_component(Geant4_INCLUDE_DIR \"\${_geant4_thisdir}/${GEANT4_RELATIV
")
endif()
set(GEANT4_MODULE_PATH_SETUP)
# Geant4 data used in install tree
geant4_export_datasets(INSTALL GEANT4_DATASET_DESCRIPTIONS)
# Install exported targets file for the install tree - we just install
# the named export
install(EXPORT Geant4LibraryDepends
NAMESPACE Geant4::
DESTINATION ${GEANT4_CMAKE_DIR}
COMPONENT Development
)
@@ -245,23 +257,32 @@ configure_file(
@ONLY
)
# Configure the install tree config versioning file...
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/Geant4ConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/InstallTreeFiles/Geant4ConfigVersion.cmake
@ONLY
)
# Install the config, config versioning and use files
install(FILES
${PROJECT_BINARY_DIR}/InstallTreeFiles/Geant4Config.cmake
${PROJECT_BINARY_DIR}/InstallTreeFiles/Geant4ConfigVersion.cmake
${PROJECT_BINARY_DIR}/Geant4ConfigVersion.cmake
${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
DESTINATION ${GEANT4_CMAKE_DIR}
COMPONENT Development
)
# Install the custom modules for the examples
# Install the package settings file if required (always for now)
option(GEANT4_INSTALL_PACKAGE_CACHE "Install file recording build-time locations of required packages" ON)
mark_as_advanced(GEANT4_INSTALL_PACKAGE_CACHE)
if(GEANT4_INSTALL_PACKAGE_CACHE)
install(FILES ${PROJECT_BINARY_DIR}/Geant4PackageCache.cmake
DESTINATION ${GEANT4_CMAKE_DIR}
COMPONENT Development
)
endif()
# Install the custom modules for dependencies/examples
install(DIRECTORY
${PROJECT_BINARY_DIR}/Modules
DESTINATION ${GEANT4_CMAKE_DIR}
@@ -513,7 +513,7 @@ macro(_g4tc_configure_tc_variables SHELL_FAMILY SCRIPT_NAME)
# Backward compatibility requires XERCESCROOT to be set
# As this is a 'rootdir' determine it from the XERCESC_INCLUDE_DIR
# variable...
get_filename_component(_xercesc_root ${XERCESC_INCLUDE_DIR} PATH)
get_filename_component(_xercesc_root ${XercesC_INCLUDE_DIR} PATH)
_g4tc_setenv_command(GEANT4_TC_GDML_PATH_SETUP ${SHELL_FAMILY} XERCESCROOT ${_xercesc_root})
else()
set(GEANT4_TC_G4LIB_USE_GDML "# NOT BUILT WITH GDML SUPPORT")
@@ -914,8 +914,8 @@ foreach(_shell bourne;cshell)
# - 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)
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}
+18 -11
View File
@@ -123,6 +123,13 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_MULTITHREADING "no")
endif()
# - Smart Stack
if(GEANT4_USE_SMARTSTACK)
set(G4_BUILTWITH_SMARTSTACK "yes")
else()
set(G4_BUILTWITH_SMARTSTACK "no")
endif()
# - CLHEP
if(GEANT4_USE_SYSTEM_CLHEP)
set(G4_BUILTWITH_CLHEP "no")
@@ -163,7 +170,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
# - GDML
if(GEANT4_USE_GDML)
set(G4_BUILTWITH_GDML "yes")
set(G4_XERCESC_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS})
set(G4_XERCESC_INCLUDE_DIRS ${XercesC_INCLUDE_DIR})
list(REMOVE_DUPLICATES G4_XERCESC_INCLUDE_DIRS)
list(REMOVE_ITEM G4_XERCESC_INCLUDE_DIRS ${_cxx_compiler_dirs})
@@ -233,18 +240,18 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
endif()
# - Wt
if(GEANT4_USE_WT)
set(G4_BUILTWITH_WT "yes")
set(G4_WT_INCLUDE_DIRS ${Wt_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
#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()
# 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()
#else()
# set(G4_BUILTWITH_WT "no")
#endif()
# - Motif
if(GEANT4_USE_XM)
+47 -81
View File
@@ -42,7 +42,7 @@ endif()
# - Needed CMake modules
include(CMakeParseArguments)
include(G4WindowsDLLSupport)
include(G4ClangFormat)
#-----------------------------------------------------------------------
#.rst:
@@ -103,10 +103,13 @@ include(G4WindowsDLLSupport)
# using include_directories
#
macro(geant4_define_module)
set(multiargs
HEADERS SOURCES GRANULAR_DEPENDENCIES GLOBAL_DEPENDENCIES LINK_LIBRARIES
HEADERS_EXCLUDE_FORMAT SOURCES_EXCLUDE_FORMAT)
cmake_parse_arguments(G4DEFMOD
""
"NAME"
"HEADERS;SOURCES;GRANULAR_DEPENDENCIES;GLOBAL_DEPENDENCIES;LINK_LIBRARIES"
"${multiargs}"
${ARGN}
)
@@ -134,6 +137,10 @@ macro(geant4_define_module)
endif()
endforeach()
exclude_from_format(
HEADERS ${G4DEFMOD_HEADERS_EXCLUDE_FORMAT}
SOURCES ${G4DEFMOD_SOURCES_EXCLUDE_FORMAT})
foreach(_LIB ${G4DEFMOD_GRANULAR_DEPENDENCIES})
list(APPEND ${G4MODULENAME}_GRANULAR_DEPENDENCIES ${_LIB})
endforeach()
@@ -145,8 +152,6 @@ macro(geant4_define_module)
foreach(_LIB ${G4DEFMOD_LINK_LIBRARIES})
list(APPEND ${G4MODULENAME}_LINK_LIBRARIES ${_LIB})
endforeach()
include_directories(${${G4MODULENAME}_INCDIR})
endmacro()
@@ -214,25 +219,6 @@ endmacro()
#-----------------------------------------------------------------------
# function geant4_compile_definitions_config(<target>)
# Set a custom compile definition for a Geant4 target on a
# per configuration basis:
# For mode <CONFIG>, define GEANT4_DEVELOPER_<CONFIG>
#
function(geant4_compile_definitions_config _target)
if(NOT TARGET ${_target})
message(FATAL_ERROR "geant4_compile_definitions_config passed target '${_target}' which is not a valid CMake target")
endif()
# CMake 3 prefers $<CONFIG> in generator expressions
set(__default_config_generator "\$<CONFIG>")
set_property(TARGET ${_target}
APPEND PROPERTY COMPILE_DEFINITIONS
GEANT4_DEVELOPER_${__default_config_generator}
)
endfunction()
#-----------------------------------------------------------------------
# - GEANT4_LIBRARY_TARGET
@@ -245,26 +231,26 @@ macro(geant4_library_target)
${ARGN}
)
geant4_format_target(NAME ${G4LIBTARGET_NAME}-format SOURCES ${G4LIBTARGET_SOURCES})
if(BUILD_SHARED_LIBS)
# Add the shared library target and link its dependencies
# WIN32/CMake<3.4 workaround
if(WIN32 AND (CMAKE_VERSION VERSION_LESS 3.4))
__geant4_add_dll_old(${ARGV})
else()
# - Common shared lib commands
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
geant4_compile_definitions_config(${G4LIBTARGET_NAME})
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_link_libraries(${G4LIBTARGET_NAME}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})
# DLL support, portable to all platforms
# G4LIB_BUILD_DLL is public as despite the name it indicates the shared/archive mode
# and clients must apply it when linking to the shared libs. The global
# category handles the exact import/export statements
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC G4LIB_BUILD_DLL)
set_target_properties(${G4LIBTARGET_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
# - Common shared lib commands
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
target_compile_definitions(${G4LIBTARGET_NAME} PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_link_libraries(${G4LIBTARGET_NAME}
${G4LIBTARGET_GEANT4_LINK_LIBRARIES}
${G4LIBTARGET_LINK_LIBRARIES})
# DLL support, portable to all platforms
# G4LIB_BUILD_DLL is public as despite the name it indicates the shared/archive mode
# and clients must apply it when linking to the shared libs. The global
# category handles the exact import/export statements
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC G4LIB_BUILD_DLL)
set_target_properties(${G4LIBTARGET_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Set the include directory usage requirements
target_include_directories(${G4LIBTARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
# This property is set to prevent concurrent builds of static and
# shared libs removing each others files.
@@ -283,6 +269,9 @@ macro(geant4_library_target)
)
endif()
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME} ALIAS ${G4LIBTARGET_NAME})
# Install the library - note the use of RUNTIME, LIBRARY and ARCHIVE
# this helps with later DLL builds.
# Export to standard depends file for later install
@@ -290,12 +279,8 @@ macro(geant4_library_target)
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
# Append the library target to a global property so that build tree
# export of library dependencies can pick up all targets
set_property(GLOBAL APPEND
PROPERTY GEANT4_EXPORTED_TARGETS ${G4LIBTARGET_NAME})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
#
@@ -306,8 +291,9 @@ macro(geant4_library_target)
# -static targets (We should strictly do this for the external
# libraries as well if we want a pure static build).
add_library(${G4LIBTARGET_NAME}-static STATIC ${G4LIBTARGET_SOURCES})
geant4_compile_definitions_config(${G4LIBTARGET_NAME}-static)
target_compile_definitions(${G4LIBTARGET_NAME}-static PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME}-static PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_include_directories(${G4LIBTARGET_NAME}-static PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
set(G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC )
foreach(_tgt ${G4LIBTARGET_GEANT4_LINK_LIBRARIES})
@@ -324,7 +310,7 @@ macro(geant4_library_target)
"${G4LIBTARGET_LINK_LIBRARIES}"
)
target_link_libraries(${G4LIBTARGET_NAME}-static
target_link_libraries(${G4LIBTARGET_NAME}-static PUBLIC
${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC}
${G4LIBTARGET_LINK_LIBRARIES_STATIC})
@@ -339,14 +325,15 @@ macro(geant4_library_target)
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME}-static ALIAS ${G4LIBTARGET_NAME}-static)
install(TARGETS ${G4LIBTARGET_NAME}-static
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
set_property(GLOBAL APPEND
PROPERTY GEANT4_EXPORTED_TARGETS ${G4LIBTARGET_NAME}-static)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
endmacro()
@@ -373,7 +360,7 @@ macro(geant4_header_module_target)
# Store the include path of the component so that the build tree
# config file can pick up all needed header paths
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS ${${G4MODULENAME}_INCDIR})
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${${G4MODULENAME}_INCDIR}")
endmacro()
#-----------------------------------------------------------------------
@@ -388,26 +375,7 @@ macro(geant4_granular_library_target)
${ARGN}
)
# Granular lib only has one component, but we must pick out
# the granular dependencies
include(${G4GRANLIB_COMPONENT})
# Add the library target, using variables set by the inclusion of
# the component file
geant4_library_target(NAME ${G4MODULENAME}
SOURCES ${${G4MODULENAME}_SOURCES} ${${G4MODULENAME}_HEADERS}
GEANT4_LINK_LIBRARIES ${${G4MODULENAME}_GRANULAR_DEPENDENCIES}
LINK_LIBRARIES ${${G4MODULENAME}_LINK_LIBRARIES})
# Header install?
install(FILES ${${G4MODULENAME}_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component so that the build tree
# config file can pick up all needed header paths
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS ${${G4MODULENAME}_INCDIR})
message(FATAL_ERROR "geant4_granular_library_target is no longer supported")
endmacro()
#-----------------------------------------------------------------------
@@ -443,11 +411,8 @@ macro(geant4_global_library_target)
list(APPEND ${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES ${${G4MODULENAME}_INCDIR})
endforeach()
# Reset include dirs, setting from module direct dirs only
# But need to pass this forward to the library target so that
# it can use this list in target_include_directories...
#set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
#include_directories(${${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES})
# Reset directory scope include dirs so we enforce usage requirements
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
# Filter out duplicates/self in GLOBAL_DEPENDENCIES and LINK_LIBRARIES
if(${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES)
@@ -473,8 +438,9 @@ macro(geant4_global_library_target)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component so that the build tree
# config file can pick up all needed header paths
# Store the include path of the component. Only used so that
# other tools like GNUmake/pkg-config can be configured for the
# build tree
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS ${${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES})
endmacro()
+16
View File
@@ -0,0 +1,16 @@
# - G4EXPATShim
#
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
# The EXPAT dependency is located through CMake's builtin FindEXPAT
# module and linked through the EXPAT::EXPAT imported target.
# This target is however only available from CMake 3.10, so recreate
# EXPAT::EXPAT target if it does not exist
if(EXPAT_FOUND)
if(NOT TARGET EXPAT::EXPAT)
add_library(EXPAT::EXPAT UNKNOWN IMPORTED)
set_target_properties(EXPAT::EXPAT PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${EXPAT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}")
endif()
endif()
+37
View File
@@ -0,0 +1,37 @@
# - G4FreetypeShim
#
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
# The Freetype dependency is located through CMake's builtin FindFreetype
# module and linked through the Freetype::Freetype imported target.
# This target is however only available from CMake 3.10, so recreate
# Freetype::Freetype target if it does not exist
if(Freetype_FOUND)
if(NOT TARGET Freetype::Freetype)
add_library(Freetype::Freetype UNKNOWN IMPORTED)
set_target_properties(Freetype::Freetype PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}")
if(FREETYPE_LIBRARY_RELEASE)
set_property(TARGET Freetype::Freetype APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Freetype::Freetype PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
endif()
if(FREETYPE_LIBRARY_DEBUG)
set_property(TARGET Freetype::Freetype APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Freetype::Freetype PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${FREETYPE_LIBRARY_DEBUG}")
endif()
if(NOT FREETYPE_LIBRARY_RELEASE AND NOT FREETYPE_LIBRARY_DEBUG)
set_target_properties(Freetype::Freetype PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${FREETYPE_LIBRARY}")
endif()
endif()
endif()
+41
View File
@@ -0,0 +1,41 @@
# - G4HDF5Shim
#
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
# The HDF5 dependency is located through CMake's builtin FindHDF5
# module, but this does not supply imported targets as of CMake 3.16.
# It may use HDF5's hdf5-config.cmake file if available, so create
# custom imported target Geant4::HDF5 to allow both cases to be handled
# without interference with either.
if(HDF5_FOUND)
# If we're in MT mode, found HDF5 must also support MT
if(GEANT4_BUILD_MULTITHREADED OR Geant4_multithreaded_FOUND)
include(CheckCXXSymbolExists)
set(CMAKE_REQUIRED_INCLUDES "${HDF5_INCLUDE_DIRS}")
check_cxx_symbol_exists(H5_HAVE_THREADSAFE "H5pubconf.h" GEANT4_HAVE_H5_HAVE_THREADSAFE)
unset(CMAKE_REQUIRED_INCLUDES)
if(NOT GEANT4_HAVE_H5_HAVE_THREADSAFE)
message(FATAL_ERROR
"Found an install of HDF5, but it was not built with support for thread safety. "
"Either build Geant4 in single threaded mode, or use/reinstall HDF5 with "
"thread safety enabled. See HDF5's install guides, available from https://support.hdfgroup.org/HDF5/release/, for instructions on this.\n"
)
endif()
endif()
# As FindHDF5 does not yet supply imported targets, we
# create an internal INTERFACE target to wrap these.
# This still hard-codes include/library paths, but limits it
# to one place. Later, we'll create proper imported targets
# with re-finds but for now this is the best minimally invasive proceedure
if(NOT TARGET Geant4::HDF5)
add_library(Geant4::HDF5 IMPORTED UNKNOWN)
set_target_properties(Geant4::HDF5 PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${HDF5_C_LIBRARY_hdf5}"
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}"
)
endif()
endif()
+15
View File
@@ -0,0 +1,15 @@
# - G4MotifShim
#
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
# The Motif dependency is located through CMake's builtin FindMotif
# This module does not support imported targets as of CMake 3.16, so
# provide a target Motif::Xm
if(Motif_FOUND)
if(NOT TARGET Motif::Xm)
add_library(Motif::Xm UNKNOWN IMPORTED)
set_target_properties(Motif::Xm PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MOTIF_INCLUDE_DIR}"
IMPORTED_LOCATION "${MOTIF_LIBRARIES}"
)
endif()
endif()
+20
View File
@@ -0,0 +1,20 @@
# 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()
-116
View File
@@ -1,116 +0,0 @@
#.rst:
# G4WindowsDLLSupport
# -------------------
#
# Provides functions needed to support builds of DLLs both pre and post
# CMake 3.4. This version introduced the WINDOWS_EXPORT_ALL_SYMBOLS
# property, removing the need for the shipped `genwindef` program.
#
# With Geant4 10.4 and below having a minimum version requirement of
# CMake 3.3, we need to provide both so that patches can be applied
# to these versions without requiring clients to bump their CMake version.
#
#-----------------------------------------------------------------
# License and Disclaimer
#
# The Geant4 software is copyright of the Copyright Holders of
# the Geant4 Collaboration. It is provided under the terms and
# conditions of the Geant4 Software License, included in the file
# LICENSE and available at http://cern.ch/geant4/license . These
# include a list of copyright holders.
#
# Neither the authors of this software system, nor their employing
# institutes,nor the agencies providing financial support for this
# work make any representation or warranty, express or implied,
# regarding this software system or assume any liability for its
# use. Please see the license in the file LICENSE and URL above
# for the full disclaimer and the limitation of liability.
#
# This code implementation is the result of the scientific and
# technical work of the GEANT4 collaboration.
# By using, copying, modifying or distributing the software (or
# any work based on the software) you agree to acknowledge its
# use in resulting scientific publications, and indicate your
# acceptance of all terms of the Geant4 Software license.
#
#-----------------------------------------------------------------
if(NOT __G4WINDOWSDLLSUPPORT_INCLUDED)
set(__G4WINDOWSDLLSUPPORT_INCLUDED)
else()
return()
endif()
# On WIN32, we need to build the genwindef application to create export
# def files for building DLLs.
# We only use it as a helper application at the moment so we exclude it from
# the ALL target.
if(WIN32)
# Assume the sources are co-located
get_filename_component(_genwindef_src_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
add_executable(genwindef EXCLUDE_FROM_ALL
${_genwindef_src_dir}/genwindef/genwindef.cpp
${_genwindef_src_dir}/genwindef/LibSymbolInfo.h
${_genwindef_src_dir}/genwindef/LibSymbolInfo.cpp)
endif()
#.rst:
# Macro for supporting DLL build on CMake < 3.4
macro(__geant4_add_dll_old)
# It's an error to call this on non-WIN32 platforms
if(NOT WIN32)
message(FATAL_ERROR "__geant4_add_dll_old is not callable on non-Windows platforms!")
endif()
# - Takes same args as geant4_library_target for compatibility
cmake_parse_arguments(__G4ADDOLDDLL
""
"NAME" "SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
${ARGN}
)
# We have to generate the def export file from an archive library.
# This is a temporary separate from a real archive library, and
# even though it's static, we need to mark that it will have
# DLL symbols via the G4LIB_BUILD_DLL macro
add_library(_${__G4ADDOLDDLL_NAME}-archive STATIC EXCLUDE_FROM_ALL ${__G4ADDOLDDLL_SOURCES})
set(_archive _${__G4ADDOLDDLL_NAME}-archive)
target_compile_features(${_archive} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_compile_definitions(${_archive} PUBLIC -DG4LIB_BUILD_DLL)
# - Add the config specific compile definitions
geant4_compile_definitions_config(${_archive})
# - Create the .def file for this library
# Use generator expressions to get path to per-mode lib and
# older CMAKE_CFG_INTDIR variable to set name of per-mode def
# file (Needed as generator expressions cannot be used in argument
# to OUTPUT...
add_custom_command(OUTPUT _${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def
COMMAND genwindef -o _${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def -l ${__G4ADDOLDDLL_NAME} $<TARGET_FILE:${_archive}>
DEPENDS ${_archive} genwindef)
# - Now we can build the DLL
# We create it from a dummy empty C++ file plus the def file.
# Also set the public compile definition on it so that clients
# will set correct macro automatically.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/_${__G4ADDOLDDLL_NAME}.cpp
"// empty _${__G4ADDOLDDLL_NAME}.cpp\n")
add_library(${__G4ADDOLDDLL_NAME} SHARED _${__G4ADDOLDDLL_NAME}.cpp
_${__G4ADDOLDDLL_NAME}-${CMAKE_CFG_INTDIR}.def)
target_compile_definitions(${__G4ADDOLDDLL_NAME} PUBLIC -DG4LIB_BUILD_DLL)
target_compile_features(${__G4ADDOLDDLL_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
# - Link the DLL.
# We link it to the archive, and the supplied libraries,
# but then remove the archive from the LINK_INTERFACE.
target_link_libraries(${__G4ADDOLDDLL_NAME}
${_archive}
${__G4ADDOLDDLL_GEANT4_LINK_LIBRARIES}
${__G4ADDOLDDLL_LINK_LIBRARIES})
set_target_properties(${__G4ADDOLDDLL_NAME}
PROPERTIES INTERFACE_LINK_LIBRARIES "${__G4ADDOLDDLL_GEANT4_LINK_LIBRARIES};${__G4ADDOLDDLL_LINK_LIBRARIES}")
endmacro()
+67
View File
@@ -0,0 +1,67 @@
# - G4X11Shim
#
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
# The X11 dependency is located through CMake's builtin FindX11
# module and linked through the X11:: imported targets.
# These targets are however only available from CMake 3.14, so recreate
# those we need if they do not exist.
if(X11_FOUND)
if (NOT TARGET X11::X11)
add_library(X11::X11 UNKNOWN IMPORTED)
set_target_properties(X11::X11 PROPERTIES
IMPORTED_LOCATION "${X11_X11_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_X11_INCLUDE_PATH}")
endif ()
if (X11_ICE_FOUND AND NOT TARGET X11::ICE)
add_library(X11::ICE UNKNOWN IMPORTED)
set_target_properties(X11::ICE PROPERTIES
IMPORTED_LOCATION "${X11_ICE_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_ICE_INCLUDE_PATH}")
endif ()
if (X11_SM_FOUND AND NOT TARGET X11::SM)
add_library(X11::SM UNKNOWN IMPORTED)
set_target_properties(X11::SM PROPERTIES
IMPORTED_LOCATION "${X11_SM_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_SM_INCLUDE_PATH}")
endif ()
if (X11_Xext_FOUND AND NOT TARGET X11::Xext)
# CMake < 3.14 won't search for Xext headers
if(NOT X11_Xext_INCLUDE_PATH)
find_path(X11_Xext_INCLUDE_PATH X11/extensions/Xext.h ${X11_INC_SEARCH_PATH})
mark_as_advanced(X11_Xext_INCLUDE_PATH)
endif()
add_library(X11::Xext UNKNOWN IMPORTED)
set_target_properties(X11::Xext PROPERTIES
IMPORTED_LOCATION "${X11_Xext_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_Xext_INCLUDE_PATH}"
INTERFACE_LINK_LIBRARIES "X11::X11")
endif ()
if (X11_Xmu_FOUND AND NOT TARGET X11::Xmu)
add_library(X11::Xmu UNKNOWN IMPORTED)
set_target_properties(X11::Xmu PROPERTIES
IMPORTED_LOCATION "${X11_Xmu_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_Xmu_INCLUDE_PATH}"
INTERFACE_LINK_LIBRARIES "X11::Xt;X11::Xext;X11::X11")
endif ()
if (X11_Xpm_FOUND AND NOT TARGET X11::Xpm)
add_library(X11::Xpm UNKNOWN IMPORTED)
set_target_properties(X11::Xpm PROPERTIES
IMPORTED_LOCATION "${X11_Xpm_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_Xpm_INCLUDE_PATH}"
INTERFACE_LINK_LIBRARIES "X11::X11")
endif ()
if (X11_Xt_FOUND AND NOT TARGET X11::Xt)
add_library(X11::Xt UNKNOWN IMPORTED)
set_target_properties(X11::Xt PROPERTIES
IMPORTED_LOCATION "${X11_Xt_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_Xt_INCLUDE_PATH}"
INTERFACE_LINK_LIBRARIES "X11::ICE;X11::SM;X11::X11")
endif ()
endif()
+10 -10
View File
@@ -8,51 +8,51 @@
# - NDL
geant4_add_dataset(
NAME G4NDL
VERSION 4.5
VERSION 4.6
FILENAME G4NDL
EXTENSION tar.gz
ENVVAR G4NEUTRONHPDATA
MD5SUM fd29c45fe2de432f1f67232707b654c0
MD5SUM d07e43499f607e01f2c1ce06d7a09f3e
)
# - Low energy electromagnetics
geant4_add_dataset(
NAME G4EMLOW
VERSION 7.7
VERSION 7.9
FILENAME G4EMLOW
EXTENSION tar.gz
ENVVAR G4LEDATA
MD5SUM 0f650ea65c028e862a05293c10ec1089
MD5SUM d28a09f0c93243522512cf2a3a733348
)
# - Photon evaporation
geant4_add_dataset(
NAME PhotonEvaporation
VERSION 5.3
VERSION 5.5
FILENAME G4PhotonEvaporation
EXTENSION tar.gz
ENVVAR G4LEVELGAMMADATA
MD5SUM 8991682af997e71bdd87f72ee3b3e9ee
MD5SUM 707514c864414089af9671db0f656e35
)
# - Radioisotopes
geant4_add_dataset(
NAME RadioactiveDecay
VERSION 5.3
VERSION 5.4
FILENAME G4RadioactiveDecay
EXTENSION tar.gz
ENVVAR G4RADIOACTIVEDATA
MD5SUM ce1fe5e4d82d1a2ce89380e5e7e16cc8
MD5SUM 08abe2bcc0bcd1ac4bbe09f5ae69cdbe
)
# - Particle XS - replaces Neutron XS
geant4_add_dataset(
NAME G4PARTICLEXS
VERSION 2.0
VERSION 2.1
FILENAME G4PARTICLEXS
EXTENSION tar.gz
ENVVAR G4PARTICLEXSDATA
MD5SUM bc115502d4524ef7625557d9cab355c0
MD5SUM 24a68bb627a95629e2edcd098131d6b3
)
# - PII
+90 -146
View File
@@ -11,10 +11,9 @@
#
# UI category : Built on supported platforms when Third Party
# library(libraries) available
# G4UIQt : UNIX, WIN32 (Requires : Qt4)
# G4UIWt : Web (Requires : Wt)
# G4UIQt : UNIX, WIN32 (Requires : Qt5)
# G4UIWt : Web (Requires : Wt) DEPRECATED
# G4UIXm : UNIX
# G4UIXaw : DEPRECATED
#
# Vis Category: Always built on supported platforms
# DAWNFILE : UNIX, Win32
@@ -36,6 +35,8 @@
# Specific UI/Vis options are also handled here.
#
# Prefer Legacy GL when using CMake >= 3.10
set(OpenGL_GL_PREFERENCE "LEGACY")
#-----------------------------------------------------------------------
# Configure OpenInventor support
@@ -66,7 +67,7 @@ if(GEANT4_USE_INVENTOR)
endif()
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_INVENTOR "Build OpenInventor Driver")
geant4_add_feature(GEANT4_USE_INVENTOR "Build OpenInventor Driver")
endif()
@@ -74,29 +75,14 @@ endif()
# Configure Qt Support if needed (CROSSPLATFORM).
#
option(GEANT4_USE_QT "Build Geant4 with Qt support (Qt5 preferred, Qt4 fallback)" OFF)
option(GEANT4_FORCE_QT4 "When building Qt support require Qt4 only" OFF)
mark_as_advanced(GEANT4_FORCE_QT4)
if(GEANT4_USE_QT)
# Find and configure Qt and OpenGL - Search for 5 first, then 4, unless
# GEANT4_FORCE_QT4 is set. In this case only search for 4.
# This is fine on Mac OS X because Qt will use Framework GL.
# On WIN32 only, set QT_USE_IMPORTED_TARGETS. The Qt4 module will
# otherwise set QT_LIBRARIES using the 'optimized A; debug Ad'
# technique. CMake will then complain because when building DLLs we reset
# LINK_INTERFACE_LIBRARIES and this cannot be passed a link of this form.
# This means we have to recreate the imported targets later though...
if(WIN32)
set(QT_USE_IMPORTED_TARGETS ON)
endif()
if(NOT GEANT4_FORCE_QT4)
find_package(Qt5Core QUIET)
find_package(Qt5Gui QUIET)
find_package(Qt5Widgets QUIET)
find_package(Qt5OpenGL QUIET)
find_package(Qt5PrintSupport QUIET)
endif()
# Find and configure Qt and OpenGL - Search for 5 first, then 4
find_package(Qt5Core QUIET)
find_package(Qt5Gui QUIET)
find_package(Qt5Widgets QUIET)
find_package(Qt5OpenGL QUIET)
find_package(Qt5PrintSupport QUIET)
if(Qt5Core_FOUND
AND Qt5Gui_FOUND
@@ -107,20 +93,42 @@ if(GEANT4_USE_QT)
macro(qt4_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
set(Qt5_USE_FILE_IN "${PROJECT_SOURCE_DIR}/cmake/Templates/Geant4UseQt5.cmake.in")
set(QT_USE_FILE "${PROJECT_BINARY_DIR}/Geant4UseQt5.cmake")
configure_file("${Qt5_USE_FILE_IN}" "${QT_USE_FILE}" @ONLY)
# 4/5 Compatibility
set(QT_QTCORE_LIBRARY Qt5::Core Qt5::PrintSupport)
set(QT_QTGUI_LIBRARY Qt5::Gui Qt5::Widgets)
set(QT_OPENGL_LIBRARY Qt5::Gui Qt5::OpenGL)
set(QT_LIBRARIES Qt5::OpenGL Qt5::Gui Qt5::PrintSupport Qt5::Widgets)
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
geant4_save_package_variables(Qt5 Qt5Core_DIR Qt5Gui_DIR Qt5Widgets_DIR Qt5OpenGL_DIR Qt5PrintSupport_DIR)
else()
unset(Qt5Core_DIR CACHE)
unset(Qt5Gui_DIR CACHE)
unset(Qt5Widgets_DIR CACHE)
unset(Qt5OpenGL_DIR CACHE)
unset(Qt5PrintSupport_DIR CACHE)
# On WIN32 only, set QT_USE_IMPORTED_TARGETS. The Qt4 module will
# otherwise set QT_LIBRARIES using the 'optimized A; debug Ad'
# technique.
if(WIN32)
set(QT_USE_IMPORTED_TARGETS ON)
endif()
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtOpenGL)
if(Qt4_FOUND)
message(WARNING "Support for Qt4 in Geant4 is now deprecated and will be removed in the next release")
endif()
# 4/5 Compatibility
set(QT_QTCORE_LIBRARY Qt4::QtCore)
set(QT_QTGUI_LIBRARY Qt4::QtGui)
set(QT_OPENGL_LIBRARY Qt4::QtOpenGL)
set(QT_LIBRARIES Qt4::QtOpenGL Qt4::QtGui)
geant4_save_package_variables(Qt4 QT_QMAKE_EXECUTABLE)
endif()
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
# Variables for export
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX OUTPUT_VARIABLE G4QTHOME OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -129,31 +137,35 @@ if(GEANT4_USE_QT)
# OpenGL part of Qt is in OpenGL component so mark the need to
# add OpenGL.
set(GEANT4_USE_OPENGL ON)
GEANT4_ADD_FEATURE(GEANT4_USE_QT "Build Geant4 with Qt support")
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt support")
endif()
#-----------------------------------------------------------------------
# Configure Wt Support
#
option(GEANT4_USE_WT "Build Geant4 with Wt4 support" OFF)
mark_as_advanced(GEANT4_USE_WT)
if(GEANT4_USE_WT)
# Find and configure Wt and OpenGL
find_package(Wt REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Boost REQUIRED signals)
set(WT_DEFINITIONS "-DQT_NO_KEYWORDS")
# Link the library to the Wt library, plus its dependents.
list(APPEND Wt_LIBRARY "${Wt_HTTP_LIBRARY}" "${Boost_SIGNALS_LIBRARY}")
# WebGL part of Wt is in OpenGL component so mark the need to
# add OpenGL.
set(GEANT4_USE_OPENGL ON)
GEANT4_ADD_FEATURE(GEANT4_USE_WT "Build Geant4 with Wt support")
message(WARNING "Support for Wt in Geant4 is no longer available and may be removed in future releases")
endif()
set(GEANT4_USE_WT OFF)
#option(GEANT4_USE_WT "Build Geant4 with Wt4 support" OFF)
#mark_as_advanced(GEANT4_USE_WT)
#
#if(GEANT4_USE_WT)
# # Find and configure Wt and OpenGL
# find_package(Wt REQUIRED)
# find_package(OpenGL REQUIRED)
#
# geant4_save_package_variables(Wt Wt_INCLUDE_DIR Wt_LIBRARY_RELEASE Wt_LIBRARY_DEBUG Wt_HTTP_LIBRARY_RELEASE Wt_HTTP_LIBRARY_DEBUG)
# geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
#
# set(WT_DEFINITIONS "-DQT_NO_KEYWORDS")
#
# # WebGL part of Wt is in OpenGL component so mark the need to
# # add OpenGL.
# set(GEANT4_USE_OPENGL ON)
# geant4_add_feature(GEANT4_USE_WT "Build Geant4 with Wt support")
#endif()
#-----------------------------------------------------------------------
@@ -166,24 +178,20 @@ if(UNIX)
#
# Possible headers checks for needed network parts?
#
GEANT4_ADD_FEATURE(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
geant4_add_feature(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKDAWN)
# - Support for Client/Server VRML driver
# mark as advanced because user should know what they're doing to use this
option(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support" OFF)
#
# Possible header checks for needed network parts?
#
GEANT4_ADD_FEATURE(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
geant4_add_feature(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKVRML)
# - Configure Xm support if requested
option(GEANT4_USE_XM "Build Geant4 with Motif (X11) support" OFF)
# - Configure OpenGL X11 support if requested
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support"
OFF)
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support" OFF)
# - X11 Support for RayTracer driver
option(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support" OFF)
@@ -194,117 +202,52 @@ if(UNIX)
# - X11
if(GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11 OR GEANT4_USE_RAYTRACER_X11 OR GEANT4_USE_INVENTOR)
find_package(X11 REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
# We also require Xmu, which isn't found by default
# Just the search in here, copying pattern from
# FindX11. We don't add it to X11 libraries because it's only
# needed in the OpenGL driver.
#
set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
set(X11_INC_SEARCH_PATH
/usr/pkg/xorg/include
/usr/X11R6/include
/usr/X11R7/include
/usr/include/X11
/usr/openwin/include
/usr/openwin/share/include
/opt/graphics/OpenGL/include
/opt/X11/include
)
set(X11_LIB_SEARCH_PATH
/usr/pkg/xorg/lib
/usr/X11R6/lib
/usr/X11R7/lib
/usr/openwin/lib
/opt/X11/lib
)
find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH})
find_library(X11_Xmu_LIBRARY Xmu ${X11_LIB_SEARCH_PATH})
if(NOT X11_Xmu_LIBRARY OR NOT X11_Xmu_INCLUDE_PATH)
# Check for additional required X11 libraries
# - Xmu
if(NOT X11_Xmu_FOUND)
message(FATAL_ERROR "could not find X11 Xmu library and/or headers")
endif()
mark_as_advanced(X11_Xmu_INCLUDE_PATH X11_Xmu_LIBRARY)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
# END of finding Xmu
# Check for additional required X11 libraries
# - Xt
if(NOT X11_Xt_FOUND)
message(FATAL_ERROR "could not find X11 Xt library and/or headers")
endif()
# Create final list of X11 libraries needed for Geant4
# - Motif/Inventor
if(GEANT4_USE_XM OR GEANT4_USE_INVENTOR)
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xt_LIB} ${X11_Xmu_LIBRARY})
endif()
geant4_save_package_variables(X11
X11_X11_INCLUDE_PATH
X11_X11_LIB
X11_ICE_INCLUDE_PATH
X11_ICE_LIB
X11_SM_INCLUDE_PATH
X11_SM_LIB
X11_Xext_INCLUDE_PATH
X11_Xext_LIB
X11_Xmu_INCLUDE_PATH
X11_Xmu_LIB
X11_Xt_INCLUDE_PATH
X11_Xt_LIB
)
# - If we got to this point, RayTracer is o.k., so add the feature
GEANT4_ADD_FEATURE(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
geant4_add_feature(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
endif()
#- OpenGL : we also do this for Inventor so that we pick up Mac X11 GL...
if(GEANT4_USE_INVENTOR OR GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11)
# - Find native GL first
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
# - If we're on Apple, also find the X11 GL libraries and append them.
# - If we're on Apple, also find the XQuartz GL libraries and append t.
if(APPLE)
# - This is for X11 GL drivers, so we DON'T want Framework!
set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
find_path(OPENGL_X11_INCLUDE_DIR GL/gl.h
PATHS /usr/X11R6/include /opt/X11/include
NO_DEFAULT_PATH
)
find_library(OPENGL_X11_gl_LIBRARY GL
PATHS /usr/X11R6/lib /opt/X11/lib
NO_DEFAULT_PATH
)
find_library(OPENGL_X11_glu_LIBRARY GLU
PATHS /usr/X11R6/lib /opt/X11/lib
NO_DEFAULT_PATH
)
mark_as_advanced(
OPENGL_X11_INCLUDE_DIR
OPENGL_X11_gl_LIBRARY
OPENGL_X11_glu_LIBRARY
)
if(NOT OPENGL_X11_INCLUDE_DIR)
message(FATAL_ERROR "Apple X11 OpenGL GL/gl.h NOTFOUND")
endif()
if(NOT OPENGL_X11_gl_LIBRARY)
message(FATAL_ERROR "Apple X11 OpenGL GL Library NOTFOUND")
endif()
if(NOT OPENGL_X11_glu_LIBRARY)
message(FATAL_ERROR "Apple X11 OpenGL GLU Library NOTFOUND")
endif()
# Append the X11 GL libraries to the native paths
set(OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${OPENGL_X11_INCLUDE_DIR})
set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES}
${OPENGL_X11_gl_LIBRARY}
${OPENGL_X11_glu_LIBRARY}
)
# Restore framework search
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
find_package(XQuartzGL REQUIRED)
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRARY)
endif()
# Add feature for X11 GL
GEANT4_ADD_FEATURE(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
endif()
# - Add need for OpenGL in X11 case
@@ -315,7 +258,9 @@ if(UNIX)
# - Motif last of all, then can add the feature
if(GEANT4_USE_XM)
find_package(Motif REQUIRED)
GEANT4_ADD_FEATURE(GEANT4_USE_XM "Build Geant4 with Xm Support")
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
geant4_save_package_variables(Motif MOTIF_INCLUDE_DIR MOTIF_LIBRARIES)
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
endif()
endif()
@@ -332,9 +277,8 @@ if(WIN32)
# This is part of the G4OpenGL component, so mark it as needed
set(GEANT4_USE_OPENGL ON)
GEANT4_ADD_FEATURE(
GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support"
)
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
endif()
endif()
-1
View File
@@ -81,7 +81,6 @@ if(MSVC)
# Extra modes
set(CMAKE_CXX_FLAGS_TESTRELEASE_INIT "-MDd -Zi -G4DEBUG_VERBOSE")
set(CMAKE_CXX_FLAGS_MAINTAINER_INIT "-MDd -Zi")
endif()
#-----------------------------------------------------------------------
+70 -95
View File
@@ -35,14 +35,10 @@
# `GEANT4_USE_SYSTEM_CLHEP_GRANULAR` is available to configure
# use of the modular CLHEP libraries.
#
set(_default_use_system_clhep OFF)
if(CLHEP_ROOT_DIR)
set(_default_use_system_clhep ON)
# CLHEP_ROOT_DIR is non-standard for Config mode, so attempt temporary translation
# into CMAKE_PREFIX_PATH. Could also add as PATHS to find_package,
# but CMAKE_PREFIX_PATH has higher search priority.
list(INSERT CMAKE_PREFIX_PATH 0 "${CLHEP_ROOT_DIR}")
else()
set(_default_use_system_clhep OFF)
endif()
option(GEANT4_USE_SYSTEM_CLHEP "Use system CLHEP library" ${_default_use_system_clhep})
@@ -65,16 +61,9 @@ if(GEANT4_USE_SYSTEM_CLHEP)
set(__system_clhep_mode " (granular)")
endif()
# Find CLHEP using config-mode (i.e. CLHEPConfig)
# Note that the imported targets have different properties
# depending on version:
# >= 2.3.3.0 Imported targets have INTERFACE_INCLUDE_DIRECTORIES
# >= 2.3.1.0 Imported targets are namespaced, all components available
# < 2.3.1.0 Only CLHEP/CLHEPS available as imported targets
#
# By supplying components, CLHEP_LIBRARIES is populated with the
# appropriate set of imported targets.
find_package(CLHEP 2.3.3.0 REQUIRED ${__g4_clhep_components} CONFIG)
geant4_save_package_variables(CLHEP CLHEP_DIR)
else()
set(CLHEP_FOUND TRUE)
# TODO: CLHEP_INCLUDE_DIRS still required for windows support
@@ -115,6 +104,8 @@ else()
if(GEANT4_USE_SYSTEM_EXPAT)
# If system package requested, find it or fail
find_package(EXPAT REQUIRED)
# Shim only needed until we require CMake >= 3.10
include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake")
# Check version requirement externally to provide information
# on using internal expat.
@@ -131,65 +122,54 @@ EXPAT_LIBRARY = ${__badexpat_library}
are of insufficient version '${EXPAT_VERSION_STRING}' (Required >= 2.0.1)
Set the above CMake variables to point to an expat install of the required version, or set GEANT4_USE_SYSTEM_EXPAT to OFF to use Geant4's packaged version.")
endif()
# Backward compatibility for sources.cmake using the variable
set(EXPAT_LIBRARIES EXPAT::EXPAT)
geant4_save_package_variables(EXPAT EXPAT_INCLUDE_DIR EXPAT_LIBRARY)
else()
set(EXPAT_FOUND TRUE)
set(GEANT4_USE_BUILTIN_EXPAT TRUE)
set(EXPAT_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/source/externals/expat/include)
if(BUILD_SHARED_LIBS)
set(EXPAT_LIBRARIES G4expat)
else()
set(EXPAT_LIBRARIES G4expat-static)
endif()
set(EXPAT_LIBRARIES G4expat)
endif()
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_SYSTEM_EXPAT "Using system EXPAT library")
geant4_add_feature(GEANT4_USE_SYSTEM_EXPAT "Using system EXPAT library")
#-----------------------------------------------------------------------
# Find required ZLIB package
# Default to use internal zlib, otherwise point interface variables to
# internal zlib
# Find required ZLIB package, defaulting in internal
# Rely on ZLIB::ZLIB imported target (since CMake 3.1)
option(GEANT4_USE_SYSTEM_ZLIB "Use system zlib library" OFF)
if(GEANT4_USE_SYSTEM_ZLIB)
find_package(ZLIB REQUIRED)
# NB : FindZLIB on cmake < 2.8 does not set the ZLIB_INCLUDE_DIRS
# variable, only the ZLIB_INCLUDE_DIR variable. Set the DIRS variable
# here for backward compatibility.
if(${CMAKE_VERSION} VERSION_LESS "2.8.0")
set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
endif()
# Backward compatibility for sources.cmake using the variable
set(ZLIB_LIBRARIES ZLIB::ZLIB)
geant4_save_package_variables(ZLIB ZLIB_INCLUDE_DIR ZLIB_LIBRARY_DEBUG ZLIB_LIBRARY_RELEASE)
else()
set(ZLIB_FOUND TRUE)
set(GEANT4_USE_BUILTIN_ZLIB TRUE)
set(ZLIB_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/source/externals/zlib/include
${PROJECT_BINARY_DIR}/source/externals/zlib)
if(BUILD_SHARED_LIBS)
set(ZLIB_LIBRARIES G4zlib)
else()
set(ZLIB_LIBRARIES G4zlib-static)
endif()
set(ZLIB_LIBRARIES G4zlib)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_SYSTEM_ZLIB "Using system zlib library")
geant4_add_feature(GEANT4_USE_SYSTEM_ZLIB "Using system zlib library")
#-----------------------------------------------------------------------
# Optional Support for GDML - requires Xerces-C package
#
# Relies on XercesC::XercesC imported target (since CMake 3.5)
set(_default_use_gdml OFF)
if(XERCESC_ROOT_DIR)
set(_default_use_gdml ON)
else()
set(_default_use_gdml OFF)
list(INSERT CMAKE_PREFIX_PATH 0 "${XERCESC_ROOT_DIR}")
endif()
option(GEANT4_USE_GDML "Build Geant4 with GDML support" ${_default_use_gdml}
)
option(GEANT4_USE_GDML "Build Geant4 with GDML support" ${_default_use_gdml})
if(GEANT4_USE_GDML)
find_package(XercesC REQUIRED)
geant4_save_package_variables(XercesC XercesC_INCLUDE_DIR XercesC_LIBRARY_DEBUG XercesC_LIBRARY_RELEASE)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_GDML "Building Geant4 with GDML support")
geant4_add_feature(GEANT4_USE_GDML "Building Geant4 with GDML support")
#-----------------------------------------------------------------------
# Optional use of smart stack
@@ -204,37 +184,35 @@ GEANT4_ADD_FEATURE(GEANT4_USE_GDML "Building Geant4 with GDML support")
option(GEANT4_USE_SMARTSTACK "Use smart track stack" OFF)
mark_as_advanced(GEANT4_USE_SMARTSTACK)
if(GEANT4_USE_SMARTSTACK)
add_definitions(-DG4_USESMARTSTACK)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_SMARTSTACK "Use smart track stack")
geant4_add_feature(GEANT4_USE_SMARTSTACK "Use smart track stack")
#-----------------------------------------------------------------------
# Optional Support for TiMemory -- cross-language timing and memory
# Optional Support for TiMemory -- timing, memory, HW counters, roofline, gperftools, etc.
# easily installed via:
# "pip install timemory" and pointing TiMemory_DIR to
# <install-prefix>/share/cmake/TiMemory
# e.g. -DTiMemory_DIR=/usr/local/share/cmake/TiMemory
# for /usr/local/bin/pip
# git clone https://github.com/NERSC/timemory.git timemory
# pip install -vvv ./timemory
# and setting timemory_DIR to `python -c "import sys; print(sys.prefix)"`
#
set(_default_use_timemory OFF)
if(TiMemory_DIR)
set(_default_use_timemory ON)
else()
set(_default_use_timemory OFF)
endif()
option(GEANT4_USE_TIMEMORY "Build Geant4 with TiMemory support"
${_default_use_timemory}
)
option(GEANT4_USE_TIMEMORY "Build Geant4 with TiMemory support" ${_default_use_timemory})
mark_as_advanced(GEANT4_USE_TIMEMORY)
if(GEANT4_USE_TIMEMORY)
find_package(TiMemory REQUIRED)
set(_G4timemory_DEFAULT_COMPONENTS headers caliper papi gotcha gperftools-cpu vector)
set(G4timemory_COMPONENTS "${_G4timemory_DEFAULT_COMPONENTS}" CACHE STRING
"timemory INTERFACE libraries that activate various capabilities in toolkit")
set(G4timemory_VERSION 3.0)
set(timemory_FIND_COMPONENTS_INTERFACE geant4-timemory)
find_package(timemory ${G4timemory_VERSION} REQUIRED COMPONENTS ${G4timemory_COMPONENTS})
set(timemory_LIBRARIES geant4-timemory)
geant4_save_package_variables(timemory timemory_DIR)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_TIMEMORY "Building Geant4 with TiMemory support")
geant4_add_feature(GEANT4_USE_TIMEMORY "Building Geant4 with TiMemory support")
#-----------------------------------------------------------------------
# Optional support for G3TOG4 convertion interface.
@@ -261,6 +239,9 @@ set(GEANT4_USOLIDS_SHAPES
BOX
CONS
CTUBS
ELLIPSOID
ELLIPTICALCONE
ELLIPTICALTUBE
EXTRUDEDSOLID
HYPE
GENERICPOLYCONE
@@ -309,7 +290,14 @@ endif()
# - Geant4 USolids/VecGom setup
if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
# VecGeom's config file doesn't support versioning...
find_package(VecGeom 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(GEANT4_USE_ALL_USOLIDS)
set(G4GEOM_USE_USOLIDS TRUE)
@@ -321,11 +309,6 @@ if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
endforeach()
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing Geant4 solids with VecGeom equivalents for ${GEANT4_USE_PARTIAL_USOLIDS_SHAPE_LIST} (EXPERIMENTAL)")
endif()
# Always need defs/includes for VecGeom until that supports usage reqs...
# Or can create a "G4VecGeom" internal target to propagate these.
add_definitions(${VECGEOM_DEFINITIONS})
include_directories(${VECGEOM_INCLUDE_DIR} ${VECGEOM_EXTERNAL_INCLUDES})
endif()
@@ -337,9 +320,17 @@ 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
FREETYPE_LIBRARY_DEBUG
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 library with Freetype support")
#-----------------------------------------------------------------------
# Optional support for HDF5
@@ -351,35 +342,19 @@ mark_as_advanced(GEANT4_USE_HDF5)
if(GEANT4_USE_HDF5)
find_package(HDF5 1.8 REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake")
# Backward compatibility
set(HDF5_LIBRARIES Geant4::HDF5)
# If we're in MT mode, found HDF5 must also support MT
if(GEANT4_BUILD_MULTITHREADED)
include(CheckCXXSymbolExists)
set(CMAKE_REQUIRED_INCLUDES "${HDF5_INCLUDE_DIRS}")
check_cxx_symbol_exists(H5_HAVE_THREADSAFE "H5pubconf.h" GEANT4_HAVE_H5_HAVE_THREADSAFE)
unset(CMAKE_REQUIRED_INCLUDES)
if(NOT GEANT4_HAVE_H5_HAVE_THREADSAFE)
message(FATAL_ERROR
"Found an install of HDF5, but it was not built with support for thread safety. "
"Either build Geant4 in single threaded mode, or use/reinstall HDF5 with "
"thread safety enabled. See HDF5's install guides, available from https://support.hdfgroup.org/HDF5/release/, for instructions on this.\n"
)
# May have found via config mode...
if(HDF5_DIR)
geant4_save_package_variables(HDF5 HDF5_DIR)
else()
# Otherwise almost certainly used compiler wrapper
geant4_save_package_variables(HDF5
HDF5_C_COMPILER_EXECUTABLE
HDF5_C_LIBRARY_hdf5)
endif()
endif()
# As FindHDF5 does not yet supply imported targets, we
# create an internal INTERFACE target to wrap these.
# This still hard-codes include/library paths, but limits it
# to one place. Later, we'll create proper imported targets
# with re-finds but for now this is the best minimally invasive proceedure
add_library(G4HDF5 INTERFACE)
target_include_directories(G4HDF5 INTERFACE ${HDF5_INCLUDE_DIRS})
target_link_libraries(G4HDF5 INTERFACE ${HDF5_LIBRARIES})
install(TARGETS G4HDF5 EXPORT Geant4LibraryDepends)
# Override HDF5_LIBRARIES for back compatibility
set(HDF5_LIBRARIES G4HDF5)
endif()
GEANT4_ADD_FEATURE(GEANT4_USE_HDF5 "Building Geant4 analysis library with HDF5 support")
+19 -104
View File
@@ -1,115 +1,30 @@
# - Rough n'Ready setup of CXX compile features for Intel
# - CXX compile features for Intel to support C++14/17 on CMake from 3.8
#
#-----------------------------------------------------------------------
# Add compile features for Intel - should eventually be placed
# into a module, as it will need exporting for use by clients
if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# Now version selection, focus on version 15 and above as that is the
# baseline - means that this isn't comprehensive for lower versions
# CMake 3.8,3.9,3.10 support up to 16.0, c++14
# 3.11,3,12,3.13,3.14,3.15,3.16 support up to 18, c++17
# So need to provide addons to provide c++17 on 3.8-3.10
if(CMAKE_VERSION VERSION_LESS 3.11)
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
# c++98 should be supported for all(?) versions we may encounter, and
# make it the default as required for compilers that recognise standards
set(CMAKE_CXX_STANDARD_DEFAULT "98")
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0))
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
# 15 and higher also allow c++14...
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
endif()
# Now the compile features... Eventually want to do these in the same
# way as CMake does (using compile time checks on compiler version
# etc - may also allow checks on GCC version in use), but for now
# *assume* that the underlying library will support.
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0))
set(CMAKE_CXX14_COMPILE_FEATURES
cxx_contextual_conversions
cxx_generic_lambdas
cxx_aggregate_default_initializers
cxx_attribute_deprecated
cxx_digit_separators
)
endif()
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0))
set(CMAKE_CXX14_COMPILE_FEATURES
${CMAKE_CXX14_COMPILE_FEATURES}
cxx_binary_literals
cxx_decltype_auto #cxx_return_type_deduction?
cxx_lambda_init_captures
)
if(NOT WIN32)
list(APPEND CMAKE_CXX14_COMPILE_FEATURES cxx_attribute_deprecated)
endif()
set(CMAKE_CXX11_COMPILE_FEATURES
cxx_alias_templates
cxx_alignas
cxx_alignof
cxx_attributes
cxx_auto_type
cxx_constexpr
cxx_decltype_incomplete_return_types
cxx_decltype
cxx_default_function_template_args
cxx_defaulted_functions
cxx_defaulted_move_initializers
cxx_delegating_constructors
cxx_deleted_functions
cxx_enum_forward_declarations
cxx_explicit_conversions
cxx_extended_friend_declarations
cxx_extern_templates
cxx_final
cxx_func_identifier
cxx_generalized_initializers
cxx_inheriting_constructors
cxx_inline_namespaces
cxx_lambdas
cxx_local_type_template_args
cxx_long_long_type
cxx_noexcept
cxx_nonstatic_member_init
cxx_nullptr
cxx_override
cxx_range_for
cxx_raw_string_literals
cxx_reference_qualified_functions
cxx_right_angle_brackets
cxx_rvalue_references
cxx_sizeof_member
cxx_static_assert
cxx_strong_enums
cxx_trailing_return_types
cxx_unicode_literals
cxx_uniform_initialization # Not explicit in Intel notes but should do...
cxx_user_literals
cxx_variadic_macros
cxx_variadic_templates
)
if(UNIX)
list(APPEND CMAKE_CXX11_COMPILE_FEATURES
cxx_unrestricted_unions # Linux/OSX only
cxx_thread_local # Linux/OSX only
)
list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17)
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} "${CMAKE_CXX17_COMPILE_FEATURES}")
endif()
else()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17)
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} "${CMAKE_CXX17_COMPILE_FEATURES}")
endif()
endif()
endif()
# always available?
set(CMAKE_CXX98_COMPILE_FEATURES cxx_template_template_parameters)
set(CMAKE_CXX_COMPILE_FEATURES
${CMAKE_CXX98_COMPILE_FEATURES}
${CMAKE_CXX11_COMPILE_FEATURES}
${CMAKE_CXX14_COMPILE_FEATURES}
)
endif()
+35
View File
@@ -0,0 +1,35 @@
#.rst:
# MSVC Compile Features for Geant4
# --------------------------------
#
# Due to use of C++17 features in visualization on Windows, Geant4 requires
# use of VS 2017 update 3 or newer. CMake 3.10 and higher support this out
# of the box, but with our minimum requirement of 3.8, we add this shim
# to:
#
# 1) Check the version requirement
# 2) Set the compile flags/features when using CMake < 3.10
#
if(MSVC)
# Require MSVC that supports standard flags and std::filesystem
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20)
message(FATAL_ERROR "Geant4 requires MSVC 19.20 (Visual Studio 2019 Version 16.0) or newer")
else()
# Set cxxstd flags on CMake < 3.10
if(CMAKE_VERSION VERSION_LESS 3.10)
# VS 2015 Update 3 and above support language standard level flags,
# with the default and minimum level being C++14.
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14")
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++17")
list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17)
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} "${CMAKE_CXX17_COMPILE_FEATURES}")
endif()
endif()
endif()
-260
View File
@@ -1,260 +0,0 @@
//==========================================
// Matt Pietrek
// Microsoft Systems Journal, April 1998
// Program: LibDump
// FILE: LibSymbolInfo.CPP
//==========================================
// LibSymbolInfo.cpp: implementation of the CLibSymbolInfo class.
//
//////////////////////////////////////////////////////////////////////
#include "LibSymbolInfo.h"
using namespace std;
#define MakePtr( cast, ptr, addValue ) (cast)( (DWORD_PTR)(ptr) + (DWORD_PTR)(addValue))
/////////////////////////////////////////////////////////////////////////////
// CLibSymbolInfo
CLibSymbolInfo::CLibSymbolInfo()
{
}
CLibSymbolInfo::~CLibSymbolInfo()
{
}
//=============================================================================
// Function: DumpSymbols
//
// Parameters:
// LPTSTR lpszLibPathName - The library file path name
// CStdioFile* pFile - Address of the file in which to dump the symbols
//
// Description:
//
// Given a library file path name, the function dumps the symbol info into the file
// pointed to by pFile.
//=============================================================================
BOOL CLibSymbolInfo::DumpSymbols(LPTSTR lpszLibPathName, ostream& pFile)
{
if(lpszLibPathName == NULL || pFile.bad() ) {
assert(lpszLibPathName != NULL);
assert(pFile.good());
m_strErrorMsg.assign("NULL <lpszLibPathName> or Invalid file handle.");
return FALSE;
}
if(!Dump(lpszLibPathName, pFile)) return FALSE;
return TRUE;
}
//=============================================================================
// Function: Dump
//
// Parameters:
// As mentioned above.
//
// Description:
//
// Depending on the value specified in <m_bDump>/<m_bGrep> the routine dumps/greps
// the symbo info.
//=============================================================================
BOOL CLibSymbolInfo::Dump(LPTSTR lpszLibPathName, ostream& pFile)
{
string sBuff;
MEMORY_MAPPED_FILE libFile(lpszLibPathName);
// Ensure that the file mapping worked
if( FALSE == libFile.IsValid() ) {
m_strErrorMsg = "Unable to access file ";
m_strErrorMsg+= lpszLibPathName;
return FALSE;
}
// All COFF libraries start with the string "!<arch>\n". Verify that this
// string is at the beginning of the mapped file
PSTR pArchiveStartString = (PSTR)libFile.GetBase();
if ( 0 != strncmp( pArchiveStartString, IMAGE_ARCHIVE_START,
IMAGE_ARCHIVE_START_SIZE ) ) {
m_strErrorMsg.assign("Not a valid COFF LIB file.");
return FALSE;
}
// Point to the first archive member. This entry contains the LIB symbols,
// and immediately follows the archive start string ("!<arch>\n")
PIMAGE_ARCHIVE_MEMBER_HEADER pMbrHdr;
pMbrHdr = MakePtr( PIMAGE_ARCHIVE_MEMBER_HEADER, pArchiveStartString,
IMAGE_ARCHIVE_START_SIZE );
// First DWORD after this member header is a symbol count
PDWORD pcbSymbols = (PDWORD)(pMbrHdr + 1); // Pointer math!
// The symbol count is stored in big endian format, so adjust as
// appropriate for the target architecture
DWORD cSymbols = ConvertBigEndian( *pcbSymbols );
// Following the symbol count is an array of offsets to archive members
// (essentially, embedded .OBJ files)
PDWORD pMemberOffsets = pcbSymbols + 1; // Pointer math!
// Following the array of member offsets is an array of offsets to symbol
// names.
PSTR pszSymbolName = MakePtr( PSTR, pMemberOffsets, 4 * cSymbols );
//
// Loop through every symbol in the first archive member
//
for ( unsigned i = 0; i < cSymbols; i++ )
{
DWORD offset;
// The offsets to the archive member that contains the symbol is stored
// in big endian format, so convert it appropriately.
offset = ConvertBigEndian( *pMemberOffsets );
// Call DisplayLibInfoForSymbol, which figures out what kind of symbol
// it is. The "IsRegularLibSymbol" filters out symbols that are
// internal to the linking process
if ( IsRegularLibSymbol( pszSymbolName ) ) {
string symbol(pszSymbolName);
if (IsFiltedSymbol(symbol) ) {
pFile << symbol << endl;
}
}
// Advanced to the next symbol offset and name. The MemberOffsets
// array has fixed length entries, while the symbol names are
// sequential null-terminated strings
pMemberOffsets++;
pszSymbolName += strlen(pszSymbolName) + 1;
}
return TRUE;
}
//=============================================================================
// Filters out symbols that are internal to the linking process, and which
// the programmer never explicitly sees.
//=============================================================================
BOOL CLibSymbolInfo::IsRegularLibSymbol( PSTR pszSymbolName )
{
if ( 0 == strncmp( pszSymbolName, "__IMPORT_DESCRIPTOR_", 20 ) )
return FALSE;
if ( 0 == strncmp( pszSymbolName, "__NULL_IMPORT_DESCRIPTOR", 24 ) )
return FALSE;
if ( strstr( pszSymbolName, "_NULL_THUNK_DATA" ) )
return FALSE;
return TRUE;
}
//=============================================================================
// Filters out symbols that are not needed....
//=============================================================================
BOOL CLibSymbolInfo::IsFiltedSymbol( string& symbolName )
{
// Filter problematic symbols for Win64
if ( symbolName.substr(0,3) == "_CT" ) return FALSE;
if ( symbolName.substr(0,3) == "_TI" ) return FALSE;
// Filter other symbols
if ( symbolName.substr(0,2) == "__" )
return FALSE;
if ( symbolName.substr(0,3) == "??_" && symbolName[3] != '0') // Keep 'operator/=' [??_0]
return FALSE;
if( symbolName[0] == '_') {
symbolName.erase(0, 1); // C functions ...
}
// Filter the internal Boost symbols
if (symbolName.find ("detail@boost") != string::npos )
return FALSE;
if (symbolName.find ("details@boost") != string::npos )
return FALSE;
return TRUE;
}
//=============================================================================
// Converts from big endian to little endian numbers.
//=============================================================================
DWORD CLibSymbolInfo::ConvertBigEndian(DWORD bigEndian)
{
DWORD temp = 0;
temp |= bigEndian >> 24;
temp |= ((bigEndian & 0x00FF0000) >> 8);
temp |= ((bigEndian & 0x0000FF00) << 8);
temp |= ((bigEndian & 0x000000FF) << 24);
return temp;
}
string CLibSymbolInfo::GetLastError() const
{
return m_strErrorMsg;
}
MEMORY_MAPPED_FILE::MEMORY_MAPPED_FILE( PSTR pszFileName ) {
//
// Given a filename, the constructor opens a file handle, creates a file
// mapping, and maps the entire file into memory.
//
m_hFile = INVALID_HANDLE_VALUE;
m_hFileMapping = 0;
m_pMemoryMappedFileBase = 0;
m_cbFile = 0;
m_errCode = errMMF_FileOpen; // Initial error code: not found
// First get a file handle
m_hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0);
if ( m_hFile == INVALID_HANDLE_VALUE )
{
m_errCode = errMMF_FileOpen;
return;
}
m_cbFile = ::GetFileSize( m_hFile, 0 );
// Now, create a file mapping
m_hFileMapping = CreateFileMapping(m_hFile,NULL, PAGE_READONLY, 0, 0,NULL);
if ( m_hFileMapping == 0 )
{
// Oops. Something went wrong. Clean up.
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
m_errCode = errMMF_FileMapping;
return;
}
m_pMemoryMappedFileBase = (PCHAR)MapViewOfFile( m_hFileMapping,
FILE_MAP_READ, 0, 0, 0);
if ( m_pMemoryMappedFileBase == 0 )
{
// Oops. Something went wrong. Clean up.
CloseHandle(m_hFileMapping);
m_hFileMapping = 0;
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
m_errCode = errMMF_MapView;
return;
}
m_errCode = errMMF_NoError;
}
MEMORY_MAPPED_FILE::~MEMORY_MAPPED_FILE(void)
{
// Clean up everything that was created by the constructor
if ( m_pMemoryMappedFileBase )
UnmapViewOfFile( m_pMemoryMappedFileBase );
if ( m_hFileMapping )
CloseHandle( m_hFileMapping );
if ( m_hFile != INVALID_HANDLE_VALUE )
CloseHandle( m_hFile );
m_errCode = errMMF_FileOpen;
}
-80
View File
@@ -1,80 +0,0 @@
#ifdef _WIN32
// Disable a warning in Boost program_options headers:
// inconsistent linkage in program_options/variables_map.hpp
#pragma warning ( disable : 4273 )
#define popen _popen
#define pclose _pclose
#define fileno _fileno
#include <stdlib.h>
#endif
// Include files----------------------------------------------------------------
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "LibSymbolInfo.h"
using namespace std;
namespace windef {
void usage(){
cerr << "Usage: genwindef [-l <dllname>] [-o <output-file> | exports.def] <obj or lib filenames>" << endl;
exit(1);
}
}
//--- Command main program-----------------------------------------------------
int main ( int argc, char** argv )
//-----------------------------------------------------------------------------
{
string outfile("exports.def");
string library("UnknownLib");
string objfiles;
bool debug(false);
int arg;
if (argc < 3) windef::usage();
arg = 1;
while (argv[arg][0] == '-') {
if (strcmp(argv[arg], "--") == 0) {
windef::usage();
}
else if (strcmp(argv[arg], "-l") == 0) {
arg++;
if (arg == argc) windef::usage();
library = argv[arg];
}
else if (strcmp(argv[arg], "-o") == 0) {
arg++;
if (arg == argc) windef::usage();
outfile = argv[arg];
}
arg++;
}
if (arg == argc) windef::usage();
for (arg; arg < argc; arg++) {
objfiles += argv[arg];
if( arg+1 < argc) objfiles += " ";
}
CLibSymbolInfo libsymbols;
ofstream out(outfile.c_str());
if(out.fail()) {
cerr << "windef: Error opening file " << outfile << endl;
return 1;
}
out << "LIBRARY " << library << endl;
out << "EXPORTS" << endl;
libsymbols.DumpSymbols(const_cast<char*>(objfiles.c_str()), out);
out.close();
return 0;
}
+201 -198
View File
@@ -28,7 +28,7 @@
# By default only the core (or kernel) of Geant4 is activated by this
# module. You can specify additional components of Geant4 through the
# COMPONENTS argument to find_package. By default, all core libraries of
# Geant4 are appended to the Geant4_LIBRARIES variable. Specifiying
# Geant4 are appended to the Geant4_LIBRARIES variable. Specifying
# additional components will enable a check on the existence of these
# components, with the following per component variables being set:
#
@@ -44,9 +44,12 @@
# generally activated by compile definitions, and in these cases the
# appropriate definition will be added to the Geant4_DEFINITIONS component.
#
# If you specify components and use the REQUIRED option to find_package,
# then the module will issue a FATAL_ERROR if this build of Geant4 does
# not have the requested component(s).
# 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
# found Geant4 does not have the requested component(s). Any components
# specified through the OPTIONAL_COMPONENTS argument will be enabled
# only if the found Geant4 supports them, with no error being raised if
# they are not supported.
#
# The components available generally correspond to configurations of
# the Geant4 libraries or optional extras that Geant4 can be built with.
@@ -56,12 +59,14 @@
# static (Static libraries available. Using this component
# when static libraries are available will result in
# Geant4_LIBRARIES being populated with the static
# versions of the Geant4 libraries. It does not
# versions of the Geant4 libraries. It does not, and cannot,
# guarantee the use of static third party libraries.)
# multithreaded (Libraries are multithread capable)
#
# usolids (Geant4 solids are replaced with USolids equivalents)
#
# smartstack (G4event library G4StackManager uses G4SmartTrackStack)
#
# Optional Components
# -------------------
# gdml (GDML support)
@@ -74,7 +79,6 @@
#
# motif (Motif-X11/OpenGL Graphical User Interface)
# qt (Qt4/OpenGL Graphical User Interface)
# wt (Wt/OpenGL Web based Graphical User Interface)
#
# vis_network_dawn (Client/Server network interface to DAWN visualization)
# vis_network_vrml (Client/Server network interface to VRML visualization)
@@ -139,6 +143,13 @@
#
#-----------------------------------------------------------------------
# Support CMake >= 3.8
cmake_policy(VERSION 3.8)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Geant4Config requires CMake 3.8 or newer")
endif()
include(CMakeFindDependencyMacro)
#-----------------------------------------------------------------------
# DEBUG : print out the variables passed via find_package arguments
#
@@ -174,68 +185,23 @@ set(Geant4_CXXSTD "c++@GEANT4_BUILD_CXXSTD@")
# 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
# We set VIS/UI_USE directly here, because for now they are, unfortunately,
# always needed for the Examples.
# However, they ARE NOT required to use Geant4 itself.
#
# 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()
# We set VIS/UI_USE directly here, because for now they are, unfortunately,
# always needed for the Examples.
# However, they ARE NOT required to use Geant4 itself.
#
if(NOT G4UI_NONE)
list(APPEND Geant4_DEFINITIONS -DG4UI_USE)
endif()
if(NOT G4VIS_NONE)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE)
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
# supplied variable.
#
@GEANT4_INCLUDE_DIR_SETUP@
set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR}")
@GEANT4_MODULE_PATH_SETUP@
#-----------------------------------------------------------------------
# Re-Configure paths for third party packages.
# - Refind any needed external/imported targets.
# - Relies on same/compatible packages being in the paths CMake uses to
# search for packages
#-----------------------------------------------------------------------
# If we have used imported targets for any third party packages, reimport
# them here, BEFORE we try and import the Geant4 targets which are
# linked against them.
# Generally, we try and use a standard find_package, but try and force it
# to find the actual package we were built against.
# THIS IS NOT PERFECT, AS IT CANNOT GUARANTEE A BINARY COMPATIBLE
# PACKAGE IS FOUND.
#@GEANT4_THIRD_PARTY_IMPORT_SETUP@
#-----------------------------------------------------------------------
# Configure the path(s) to third party headers.
# This is not a perfect solution to recording dependencies on external
# libraries, but it does ensure that users of THIS Geant4 will pick up
# those it was built against.
# Library dependencies are generally handled through the
# Geant4LibraryDepends file listed below (apart from one exception!)
#
set(Geant4_THIRD_PARTY_INCLUDE_DIRS @GEANT4_THIRD_PARTY_INCLUDES@)
#-----------------------------------------------------------------------
# Construct overall include path for using Geant4
#
set(Geant4_INCLUDE_DIRS
${Geant4_INCLUDE_DIR}
${Geant4_THIRD_PARTY_INCLUDE_DIRS})
# Push our own module path onto the CMake one to help refind dependencies
# - Popped at end of this module
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules")
#-----------------------------------------------------------------------
# Data Resources
@@ -256,29 +222,26 @@ unset(Geant4_DATASET_DESCRIPTIONS)
#-----------------------------------------------------------------------
# Setup components.
# THIS SECTION IS VERY ROUGH AND VERY MUCH CUT AND PASTE.
# TODO: INVESTIGATE TIDY UP WITH LESS PROCESSING.
#-----------------------------------------------------------------------
# Many components are simply present as parts of libraries or always built
# but require additional compile definitions.
#
# Optionally import build-time package settings to provide hard values
# for find_package to work with
include("${CMAKE_CURRENT_LIST_DIR}/Geant4PackageCache.cmake" OPTIONAL)
# Builtin/External packages
set(Geant4_system_clhep_FOUND @GEANT4_USE_SYSTEM_CLHEP@)
if(Geant4_system_clhep_FOUND)
set(Geant4_builtin_clhep_FOUND FALSE)
set(Geant4_system_clhep_ISGRANULAR @GEANT4_USE_SYSTEM_CLHEP_GRANULAR@)
# TODO: Review hard-coding of build-time CLHEP_DIR, as this prevents
# full relocatability, but minimizes client configuration. It is
# also required by the testing system (due to tests/example *builds*
# being tests.
# TODO: See if hard-coded variables can be stored in an optional
# "build settings" file that can be optionally installed/included
set(CLHEP_DIR "@CLHEP_DIR@")
find_package(CLHEP @CLHEP_VERSION@ EXACT REQUIRED @__g4_clhep_components@ CONFIG)
# HACK: Explicitly use include_directories.
if(Geant4_system_clhep_ISGRANULAR)
find_dependency(CLHEP @CLHEP_VERSION@ EXACT COMPONENTS @__g4_clhep_components@ CONFIG)
else()
find_dependency(CLHEP @CLHEP_VERSION@ EXACT CONFIG)
endif()
# Explicitly use include_directories.
# - Geant4 and CLHEP use full imported targets with usage requirements,
# but ROOT (used in the examples), ignores usage requirements in dictionary
# generation steps.
@@ -292,13 +255,19 @@ else()
endif()
set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUILTIN_EXPAT@)
if(NOT Geant4_builtin_expat_FOUND)
find_dependency(EXPAT @EXPAT_VERSION_STRING@)
include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake")
endif()
set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUILTIN_ZLIB@)
if(NOT Geant4_builtin_zlib_FOUND)
find_dependency(ZLIB @ZLIB_VERSION_STRING@)
endif()
# - Multithreading
set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@)
if(Geant4_multithreaded_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS multithreaded)
# - Define variable to indicate TLS model used
set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODEL@")
if(Geant4_TLS_MODEL STREQUAL "auto")
@@ -309,29 +278,21 @@ endif()
# - GDML
set(Geant4_gdml_FOUND @GEANT4_USE_GDML@)
if(Geant4_gdml_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS gdml)
find_dependency(XercesC @XercesC_VERSION@)
endif()
# - Smart track stack
set(Geant4_use_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
if(Geant4_use_smartstack_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS smartstack)
list(APPEND Geant4_DEFINITIONS -DG4_USESMARTSTACK)
endif()
set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
# - TiMemory
set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@)
if(Geant4_timemory_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS timemory)
set(_geant4_timemory_dir "@TiMemory_DIR@")
# always use same installation
unset(TiMemory_DIR CACHE)
set(TiMemory_DIR "${_geant4_timemory_dir}" CACHE PATH
"TiMemory installation of Geant4")
find_package(TiMemory REQUIRED QUIET)
include_directories(${TiMemory_INCLUDE_DIRS})
set(_geant4_use_timemory_library ON)
endif(Geant4_timemory_FOUND)
set(_geant4_use_timemory_library ON)
set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4")
set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@)
find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET COMPONENTS @G4timemory_COMPONENTS@)
set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@)
endif()
# - G3toG4
set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@)
@@ -339,66 +300,79 @@ if(Geant4_g3tog4_FOUND)
if(Geant4_FIND_REQUIRED_g3tog4)
set(_geant4_use_g3tog4_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS g3tog4)
endif()
# - Usolids
# - VecGeom
set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@)
if(Geant4_usolids_FOUND)
# Requires refind of VecGeom once that supports Targets/Usage Reqs
list(REMOVE_ITEM Geant4_FIND_COMPONENTS usolids)
find_dependency(VecGeom @VecGeom_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
endif()
# - Freetype
set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE@)
if(Geant4_freetype_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS freetype)
find_dependency(Freetype @FREETYPE_VERSION_STRING@)
include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake")
endif()
# - HDF5
set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@)
if(Geant4_hdf5_FOUND)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS hdf5)
find_dependency(HDF5 @HDF5_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake")
endif()
#-----------------------------------------------------------------------
# UI/VIS
#
# Prefer Legacy GL when using CMake >= 3.10
set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PREFERENCE}")
set(OpenGL_GL_PREFERENCE "LEGACY")
# - Helper variables for ui/vis_all components
if("ui_all" IN_LIST Geant4_FIND_COMPONENTS)
set(Geant4_ui_all_FOUND TRUE)
endif()
if("vis_all" IN_LIST Geant4_FIND_COMPONENTS)
set(Geant4_vis_all_FOUND TRUE)
endif()
# - UI : TCSH
set(Geant4_ui_tcsh_FOUND @UNIX@)
if(Geant4_ui_tcsh_FOUND)
if(Geant4_FIND_REQUIRED_ui_tcsh OR Geant4_FIND_REQUIRED_ui_all)
if(("ui_tcsh" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND)
list(APPEND Geant4_DEFINITIONS -DG4UI_USE_TCSH)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_tcsh)
endif()
# - UI : win32
set(Geant4_ui_win32_FOUND @WIN32@)
if(Geant4_ui_win32_FOUND)
if(Geant4_FIND_REQUIRED_ui_win32 OR Geant4_FIND_REQUIRED_ui_all)
if(("ui_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_WIN32
-DG4UI_USE_WIN32
)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_win32)
endif()
# - Visualization : Network DAWN
set(Geant4_vis_dawn_network_FOUND @GEANT4_USE_NETWORK_DAWN@)
if(Geant4_vis_dawn_network_FOUND)
if(Geant4_FIND_REQUIRED_vis_dawn_network OR Geant4_FIND_REQUIRED_vis_all)
if(("vis_dawn_network" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_DAWN)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_dawn_network)
endif()
# - Visualization : Network VRML
set(Geant4_vis_vrml_network_FOUND @GEANT4_USE_NETWORK_VRML@)
if(Geant4_vis_vrml_network_FOUND)
if(Geant4_FIND_REQUIRED_vis_vrml_network OR Geant4_FIND_REQUIRED_vis_all)
if(("vis_vrml_network" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VRML)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_vrml_network)
endif()
#-----------------------------------------------------------------------
@@ -407,14 +381,16 @@ endif()
# - Visualization : RayTracerX
set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@)
if(Geant4_vis_raytracer_x11_FOUND)
if(Geant4_FIND_REQUIRED_vis_raytracer_x11 OR Geant4_FIND_REQUIRED_vis_all)
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
-DG4INTY_USE_XT
-DG4VIS_USE_RAYTRACERX
)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_raytracer_x11)
endif()
# - Qt (UI and Vis!)
@@ -424,17 +400,19 @@ if(Geant4_qt_FOUND)
# Must always refind Qt5 to recreate imported targets. Because these
# are in the public interface, always need linking.
if(Geant4_USES_QT5)
find_package(Qt5Core REQUIRED PATHS "@Qt5Core_DIR@")
find_package(Qt5Gui REQUIRED PATHS "@Qt5Gui_DIR@")
find_package(Qt5Widgets REQUIRED PATHS "@Qt5Widgets_DIR@")
find_package(Qt5OpenGL REQUIRED PATHS "@Qt5OpenGL_DIR@")
find_package(Qt5PrintSupport REQUIRED PATHS "@Qt5PrintSupport_DIR@")
find_dependency(Qt5Core REQUIRED)
find_dependency(Qt5Gui REQUIRED)
find_dependency(Qt5Widgets REQUIRED)
find_dependency(Qt5OpenGL REQUIRED)
find_dependency(Qt5PrintSupport REQUIRED)
else()
# On Windows, must refind Qt4 because this always uses imported targets
@GEANT4_QT4_IMPORT_SETUP@
find_dependency(Qt4 REQUIRED QtCore QtGui QtOpenGL)
endif()
if(Geant4_FIND_REQUIRED_qt OR Geant4_FIND_REQUIRED_ui_all OR Geant4_FIND_REQUIRED_vis_all)
# Also require OpenGL
find_dependency(OpenGL)
if(("qt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_QT
@@ -443,30 +421,37 @@ if(Geant4_qt_FOUND)
)
set(_geant4_use_opengl_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS qt)
endif()
# - Wt (UI and Vis!)
set(Geant4_wt_FOUND @GEANT4_USE_WT@)
if(Geant4_wt_FOUND)
if(Geant4_FIND_REQUIRED_wt OR Geant4_FIND_REQUIRED_ui_all OR
Geant4_FIND_REQUIRED_vis_all)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_WT
-DG4UI_USE_WT
-DG4VIS_USE_OPENGLWT
)
set(_geant4_use_opengl_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS wt)
endif()
#set(Geant4_wt_FOUND @GEANT4_USE_WT@)
#if(Geant4_wt_FOUND)
# find_dependency(Wt)
# find_dependency(OpenGL)
# if(("wt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
# list(APPEND
# Geant4_DEFINITIONS
# -DG4INTY_USE_WT
# -DG4UI_USE_WT
# -DG4VIS_USE_OPENGLWT
# )
# set(_geant4_use_opengl_library ON)
# endif()
#endif()
# - Motif (UI and Vis!)
set(Geant4_motif_FOUND @GEANT4_USE_XM@)
if(Geant4_motif_FOUND)
if(Geant4_FIND_REQUIRED_motif OR Geant4_FIND_REQUIRED_ui_all OR
Geant4_FIND_REQUIRED_vis_all)
find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(Motif)
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
find_dependency(OpenGL)
if(APPLE)
find_dependency(XQuartzGL)
endif()
if(("motif" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_XT
@@ -475,14 +460,19 @@ if(Geant4_motif_FOUND)
)
set(_geant4_use_opengl_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS motif)
endif()
# - OpenGL X11
set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
if(Geant4_vis_opengl_x11_FOUND)
if(Geant4_FIND_REQUIRED_vis_opengl_x11 OR Geant4_FIND_REQUIRED_vis_all)
find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(OpenGL)
if(APPLE)
find_dependency(XQuartzGL)
endif()
if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_XT
@@ -490,14 +480,13 @@ if(Geant4_vis_opengl_x11_FOUND)
)
set(_geant4_use_opengl_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_opengl_x11)
endif()
# - OpenGL Win32
set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@)
if(Geant4_vis_opengl_win32_FOUND)
if(Geant4_FIND_REQUIRED_vis_opengl_win32 OR Geant4_FIND_REQUIRED_vis_all)
find_dependency(OpenGL)
if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
list(APPEND
Geant4_DEFINITIONS
-DG4INTY_USE_WIN32
@@ -505,14 +494,12 @@ if(Geant4_vis_opengl_win32_FOUND)
)
set(_geant4_use_opengl_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_opengl_win32)
endif()
# - OpenInventor
set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
if(Geant4_vis_openinventor_FOUND)
if(Geant4_FIND_REQUIRED_vis_openinventor OR Geant4_FIND_REQUIRED_vis_all)
if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
if(UNIX AND NOT WIN32)
list(APPEND Geant4_DEFINITIONS
-DG4INTY_USE_XT
@@ -529,18 +516,20 @@ if(Geant4_vis_openinventor_FOUND)
set(_geant4_use_inventor_library ON)
endif()
list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_openinventor)
endif()
# Reset any OpenGL Preference
set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
#-----------------------------------------------------------------------
# Include the files listing all the imported targets and configuring
# Intel Compile Features
# Intel/MSVC Compile Features
# (Not needed if used in the same Geant4 project, or if we have run before)
# This is always installed in the same location as us...
#
if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)
include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake")
include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake")
if(NOT Geant4_LIBDEPS_LOADED)
include("${_geant4_thisdir}/Geant4LibraryDepends.cmake")
@@ -563,9 +552,8 @@ else()
set(_geant4_lib_use_suffix "-static")
endif()
if(Geant4_FIND_REQUIRED_static AND Geant4_static_FOUND)
if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND)
set(_geant4_lib_use_suffix "-static")
list(REMOVE_ITEM Geant4_FIND_COMPONENTS static)
endif()
# The list of libraries probably should be autogenerated, but we hard code
@@ -573,19 +561,19 @@ endif()
# do so for consistency with the way we'll need to do it for static.
# - Always on Vis Components
set(_geant4_internal_libraries
G4Tree${_geant4_lib_use_suffix}
G4FR${_geant4_lib_use_suffix}
G4GMocren${_geant4_lib_use_suffix}
G4visHepRep${_geant4_lib_use_suffix}
G4RayTracer${_geant4_lib_use_suffix}
G4VRML${_geant4_lib_use_suffix}
Geant4::G4Tree${_geant4_lib_use_suffix}
Geant4::G4FR${_geant4_lib_use_suffix}
Geant4::G4GMocren${_geant4_lib_use_suffix}
Geant4::G4visHepRep${_geant4_lib_use_suffix}
Geant4::G4RayTracer${_geant4_lib_use_suffix}
Geant4::G4VRML${_geant4_lib_use_suffix}
)
# - G4OpenGL if it's requested.
if(_geant4_use_opengl_library)
list(APPEND _geant4_internal_libraries
G4OpenGL${_geant4_lib_use_suffix}
G4gl2ps${_geant4_lib_use_suffix}
Geant4::G4OpenGL${_geant4_lib_use_suffix}
Geant4::G4gl2ps${_geant4_lib_use_suffix}
)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL)
endif()
@@ -593,18 +581,18 @@ endif()
# - G4OpenInventor if it's requested.
if(_geant4_use_inventor_library)
list(APPEND _geant4_internal_libraries
G4OpenInventor${_geant4_lib_use_suffix}
Geant4::G4OpenInventor${_geant4_lib_use_suffix}
)
endif()
# - G3toG4 if it's requested
if(_geant4_use_g3tog4_library)
set(_geant4_g3tog4_library G3toG4${_geant4_lib_use_suffix})
set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
endif()
# - link to TiMemory library if activated
# - link to timemory library if activated
if(_geant4_use_timemory_library)
list(APPEND _geant4_internal_libraries ${TiMemory_LIBRARIES})
list(APPEND _geant4_internal_libraries ${timemory_LIBRARIES})
endif()
# - Factory registration mechanism in physics_lists requires whole
@@ -614,7 +602,7 @@ endif()
# static builds. --whole-archive never was implemented for _WIN32
# (appears not to even be possible)
# In order re-implement whole-archive, switch Geant4_FORCE_WHOLE_ARCHIVE ON
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
set(Geant4_FORCE_WHOLE_ARCHIVE OFF)
if( Geant4_FORCE_WHOLE_ARCHIVE )
@@ -624,52 +612,52 @@ if(_geant4_lib_use_suffix STREQUAL "-static")
# flags,keep their sections separate until behaviour confirmed
#
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(_geant4_physicslists_library -Wl,-force_load G4physicslists${_geant4_lib_use_suffix})
set(_geant4_physicslists_library -Wl,-force_load Geant4::G4physicslists${_geant4_lib_use_suffix})
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(_geant4_physicslists_library -Wl,--whole-archive G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
else()
# Needs determination of other compiler options.
# NB: MSVC has /OPT:NOREF, but may apply globally...
# reading up on this ... doesn't seem that it applies for subtle reasons
# only real way is to actually reference the static variables
set(_geant4_physicslists_library G4physicslists${_geant4_lib_use_suffix})
set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
endif()
endif()
endif()
# - 'Kernel' libraries
list(APPEND _geant4_internal_libraries
G4vis_management${_geant4_lib_use_suffix}
G4modeling${_geant4_lib_use_suffix}
G4interfaces${_geant4_lib_use_suffix}
G4persistency${_geant4_lib_use_suffix}
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_g3tog4_library}
G4analysis${_geant4_lib_use_suffix}
G4error_propagation${_geant4_lib_use_suffix}
G4readout${_geant4_lib_use_suffix}
Geant4::G4analysis${_geant4_lib_use_suffix}
Geant4::G4error_propagation${_geant4_lib_use_suffix}
Geant4::G4readout${_geant4_lib_use_suffix}
${_geant4_physicslists_library}
G4run${_geant4_lib_use_suffix}
G4event${_geant4_lib_use_suffix}
G4tracking${_geant4_lib_use_suffix}
G4parmodels${_geant4_lib_use_suffix}
G4processes${_geant4_lib_use_suffix}
G4digits_hits${_geant4_lib_use_suffix}
G4track${_geant4_lib_use_suffix}
G4particles${_geant4_lib_use_suffix}
G4geometry${_geant4_lib_use_suffix}
G4materials${_geant4_lib_use_suffix}
G4graphics_reps${_geant4_lib_use_suffix}
G4intercoms${_geant4_lib_use_suffix}
G4global${_geant4_lib_use_suffix}
Geant4::G4run${_geant4_lib_use_suffix}
Geant4::G4event${_geant4_lib_use_suffix}
Geant4::G4tracking${_geant4_lib_use_suffix}
Geant4::G4parmodels${_geant4_lib_use_suffix}
Geant4::G4processes${_geant4_lib_use_suffix}
Geant4::G4digits_hits${_geant4_lib_use_suffix}
Geant4::G4track${_geant4_lib_use_suffix}
Geant4::G4particles${_geant4_lib_use_suffix}
Geant4::G4geometry${_geant4_lib_use_suffix}
Geant4::G4materials${_geant4_lib_use_suffix}
Geant4::G4graphics_reps${_geant4_lib_use_suffix}
Geant4::G4intercoms${_geant4_lib_use_suffix}
Geant4::G4global${_geant4_lib_use_suffix}
)
# - Any externals built by Geant4
foreach(_extlib @GEANT4_EXTERNALS_TARGETS@)
list(APPEND
_geant4_internal_libraries
${_extlib}${_geant4_lib_use_suffix}
Geant4::${_extlib}${_geant4_lib_use_suffix}
)
endforeach()
@@ -680,9 +668,28 @@ set(Geant4_LIBRARIES ${_geant4_internal_libraries})
# Remove any duplicates from the Geant4_{DEFINITIONS,INCLUDE_DIRS,LIBRARIES}
# variables so that multiple passes append things correctly
#
list(REMOVE_DUPLICATES Geant4_DEFINITIONS)
list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)
list(REMOVE_DUPLICATES Geant4_LIBRARIES)
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()
if(Geant4_LIBRARIES)
list(REMOVE_DUPLICATES Geant4_LIBRARIES)
endif()
#-----------------------------------------------------------------------
# Point the user to the UseGeant4.cmake file which they may wish to include
@@ -691,22 +698,18 @@ list(REMOVE_DUPLICATES Geant4_LIBRARIES)
set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake")
#-----------------------------------------------------------------------
# Finally, handle any remaining components.
# We should have dealt with all available components above, except for
# ui_all and vis_all, and removed them from the list of FIND_COMPONENTS
# so any left we either didn't find or don't know about. Emit a warning
# if REQUIRED isn't set, or FATAL_ERROR otherwise
#
list(REMOVE_DUPLICATES Geant4_FIND_COMPONENTS)
list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_all vis_all)
# Pop our custom module path from the CMake one
list(REMOVE_AT CMAKE_MODULE_PATH 0)
foreach(_remaining ${Geant4_FIND_COMPONENTS})
if(Geant4_FIND_REQUIRED)
message(FATAL_ERROR "Geant4 component ${_remaining} not found")
elseif(NOT Geant4_FIND_QUIETLY)
message(WARNING " Geant4 component ${_remaining} not found")
#-----------------------------------------------------------------------
# Finally, check FOUNDness of required components.
foreach(_comp ${Geant4_FIND_COMPONENTS})
if(NOT Geant4_${_comp}_FOUND)
if(Geant4_FIND_REQUIRED_${_comp})
message(WARNING "Geant4 required component '${_comp}' not found")
set(Geant4_FOUND FALSE)
endif()
endif()
unset(Geant4_FIND_REQUIRED_${_remaining})
endforeach()
# And we should be done...
@@ -0,0 +1,16 @@
# This file is generated by the Geant4 CMake buildsystem and should not be editted
#
# This file stores paths and settings to external libraries found and used by this
# install of Geant4 when it was built.
macro(geant4_set_and_check_package_variable _name _value _type _docstring)
if(DEFINED ${_name})
if(NOT ("${${_name}}" STREQUAL "${_value}"))
message(WARNING "Value of '${_name}' is already set and does not match value set at Geant4 build-time")
endif()
else()
set(${_name} ${_value} CACHE ${_type} "${_docstring}")
endif()
endmacro()
@GEANT4_PACKAGE_SETTINGS@
-23
View File
@@ -1,23 +0,0 @@
# - Forward compatibility use file for Qt5
include_directories("@Qt5Core_INCLUDE_DIRS@")
include_directories("@Qt5Gui_INCLUDE_DIRS@")
include_directories("@Qt5Widgets_INCLUDE_DIRS@")
include_directories("@Qt5OpenGL_INCLUDE_DIRS@")
include_directories("@Qt5PrintSupport_INCLUDE_DIRS@")
add_definitions(@Qt5Core_DEFINITIONS@)
add_definitions(@Qt5Gui_DEFINITIONS@)
add_definitions(@Qt5Widgets_DEFINITIONS@)
add_definitions(@Qt5OpenGL_DEFINITIONS@)
add_definitions(@Qt5PrintSupport_DEFINITIONS@)
list(APPEND QT_QTCORE_LIBRARY
"@Qt5Core_LIBRARIES@;@Qt5PrintSupport_LIBRARIES@")
list(APPEND QT_QTGUI_LIBRARY
"@Qt5Widgets_LIBRARIES@;@Qt5Gui_LIBRARIES@")
list(APPEND QT_QTOPENGL_LIBRARY
"@Qt5OpenGL_LIBRARIES@;@Qt5Gui_LIBRARIES@")
list(APPEND QT_LIBRARIES
"@Qt5OpenGL_LIBRARIES@;@Qt5Gui_LIBRARIES@;@Qt5PrintSupport_LIBRARIES@;@Qt5Widgets_LIBRARIES@")
+14 -12
View File
@@ -1,7 +1,10 @@
# - Use file for Geant4
# This file should be included after a find_package call has successfully
# located Geant4. If Geant4 has been located via the Geant4Config.cmake
# config file, this will have set the following variable:
# This file may be included after a find_package call has successfully
# located Geant4 to set global compile definitions, include directories,
# and compiler flags for building and linking to the Geant4 libraries.
#
# If Geant4 has been located via the Geant4Config.cmake config file, the
# following variable will be set:
#
# Geant4_USE_FILE : Point to the location of the use file for the found
# Geant4 installation.
@@ -14,7 +17,7 @@
# include directories to those of the directory in which this file is
# included.
#
# Header paths are added to include_directories as SYSTEM type directories
# Header paths are added via include_directories as SYSTEM type directories
#
# The recommended Geant4 compiler flags are also prepended to
# CMAKE_CXX_FLAGS but duplicated flags are NOT removed. This permits
@@ -39,15 +42,14 @@ include_directories(AFTER SYSTEM ${Geant4_INCLUDE_DIRS})
#-----------------------------------------------------------------------
# Because Geant4 is sensitive to the compiler flags, set the base
# set here. This reproduces as far as possible the behaviour of the
# original makefile system. Users requiring additional flags must append them
# *after* inclusion of this file
# original makefile system.
#
set(CMAKE_CXX_FLAGS "${Geant4_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${Geant4_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${Geant4_CXX_FLAGS_MINSIZEREL}")
set(CMAKE_CXX_FLAGS_RELEASE "${Geant4_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${Geant4_CXX_FLAGS_RELWITHDEBINFO}")
set(CMAKE_EXE_LINKER_FLAGS "${Geant4_EXE_LINKER_FLAGS}")
set(CMAKE_CXX_FLAGS "${Geant4_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${Geant4_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${Geant4_CXX_FLAGS_MINSIZEREL} ${CMAKE_CXX_FLAGS_MINSIZEREL}")
set(CMAKE_CXX_FLAGS_RELEASE "${Geant4_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${Geant4_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(CMAKE_EXE_LINKER_FLAGS "${Geant4_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
#-----------------------------------------------------------------------
# Update build type information ONLY for single mode build tools, adding
+1 -1
View File
@@ -113,7 +113,7 @@ function(geant4_add_test test)
"COMMAND;PRECMD;POSTCMD;ENVIRONMENT;DEPENDS;LABELS"
${ARGN})
if(NOT CMAKE_GENERATOR MATCHES Makefiles)
if(CMAKE_CONFIGURATION_TYPES)
set(_cfg $<CONFIGURATION>/)
endif()
+10
View File
@@ -95,6 +95,13 @@ else
geant4_tls_model=""
fi
# - smart stacking
have_smartstack="@G4_BUILTWITH_SMARTSTACK@"
feature_list="${feature_list} smartstack[${have_smartstack}]"
if test "x${have_smartstack}" = "xyes" ; then
cflags="-DG4_USESMARTSTACK ${cflags}"
fi
# - Includes and Libs
for g4incdir in ${includedirs} ; do
cflags="${cflags} -I${g4incdir}"
@@ -552,6 +559,9 @@ while test $# -gt 0 ; do
multithreading)
echo ${have_multithreading}
;;
smartstack)
echo ${have_smartstack}
;;
clhep)
echo ${have_clhep}
;;
-11
View File
@@ -81,7 +81,6 @@
# - UI Build and Use options
# USE options only for applications.
@GEANT4_TC_UNSET_COMMAND@ G4UI_NONE
@GEANT4_TC_UNSET_COMMAND@ G4UI_BUILD_WT_SESSION
@GEANT4_TC_UNSET_COMMAND@ G4UI_BUILD_QT_SESSION
@GEANT4_TC_UNSET_COMMAND@ G4UI_BUILD_WIN32_SESSION
@GEANT4_TC_UNSET_COMMAND@ G4UI_BUILD_XAW_SESSION
@@ -92,7 +91,6 @@
@GEANT4_TC_UNSET_COMMAND@ G4UI_USE_XAW
@GEANT4_TC_UNSET_COMMAND@ G4UI_USE_XM
@GEANT4_TC_UNSET_COMMAND@ G4UI_USE_QT
@GEANT4_TC_UNSET_COMMAND@ G4UI_USE_WT
#- VIS Build and Use options
# Only USE options matter for applications.
@@ -113,9 +111,6 @@
@GEANT4_TC_UNSET_COMMAND@ G4VIS_USE_OIX
# - OpenGL drivers
@GEANT4_TC_UNSET_COMMAND@ G4VIS_BUILD_OPENGLWT_DRIVER
@GEANT4_TC_UNSET_COMMAND@ G4VIS_USE_OPENGLWT
@GEANT4_TC_UNSET_COMMAND@ QTHOME
@GEANT4_TC_UNSET_COMMAND@ QTLIBPATH
@GEANT4_TC_UNSET_COMMAND@ QTLIBS
@@ -245,12 +240,6 @@
@GEANT4_TC_G4VIS_USE_OPENGLQT@
@GEANT4_TC_QT_LIB_PATH_SETUP@
#-----------------------------------------------------------------------
# Wt UI/Vis
#
@GEANT4_TC_G4UI_USE_WT@
@GEANT4_TC_G4VIS_USE_OPENGLWT@
#-----------------------------------------------------------------------
# Xm UI/Vis
#
+1
View File
@@ -7,6 +7,7 @@
ifndef G4UI_NONE
G4UI_BUILD = 1
CPPFLAGS += -DG4UI_BUILD
INC_X11 = 1
# The following sessions are built by default (no environment
# variables needed)...
+25
View File
@@ -15,6 +15,31 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
20th Nov 2019 Gabriele Cosmo (config-V10-05-08)
- interactivity.gmk: added -DQT_NO_DEPRECATED_WARNINGS to Qt compilation
settings, to silence warnings from Qt for use of deprecated features.
22nd Oct 2019 Gabriele Cosmo (config-V10-05-07)
- Force use of c++17 in WIN32 targets.
9th Oct 2019 Gabriele Cosmo (config-V10-05-06)
- Corrected default path for XM in Darwin targets.
13th Sep 2019 Ivana Hrivnacova (config-V10-05-05)
- Added new analysis/factory subdirectory in includes in binmake.gmk;
removed analysis/parameters which does not exist anymore.
4th Sep 2019 Gabriele Cosmo (config-V10-05-04)
- Fixed compilation warning on gcc-9.2 for liblist.c; replaced use
of strncat() with strcat().
13th Aug 2019 Gabriele Cosmo (config-V10-05-03)
- geomconf.gmk: added VecGeom wrappers flags for G4EllipticalTube,
G4EllipticalCone and G4Ellipsoid.
28th Jun 2019 Gabriele Cosmo (config-V10-05-02)
- Fixed default paths for Linux architectures.
16th May 2019 Gabriele Cosmo (config-V10-05-01)
- Hard-code Qt version through QT_VERSION flag.
Corrected Qt5 setup for Linux-g++ and Linux-clang.
+2 -2
View File
@@ -50,8 +50,8 @@ ifndef INCFLAGS
-I$(G4BASE)/analysis/csv/include \
-I$(G4BASE)/analysis/root/include \
-I$(G4BASE)/analysis/xml/include \
-I$(G4BASE)/analysis/parameters/include \
-I$(G4BASE)/analysis/accumulables/include \
-I$(G4BASE)/analysis/factory/include \
-I$(G4BASE)/analysis/accumulables/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
+9
View File
@@ -23,6 +23,15 @@ endif
ifdef G4GEOM_USE_UCTUBS
CPPFLAGS += -DG4GEOM_USE_UCTUBS
endif
ifdef G4GEOM_USE_UELLIPTICALTUBE
CPPFLAGS += -DG4GEOM_USE_UELLIPTICALTUBE
endif
ifdef G4GEOM_USE_UELLIPTICALCONE
CPPFLAGS += -DG4GEOM_USE_UELLIPTICALCONE
endif
ifdef G4GEOM_USE_UELLIPSOID
CPPFLAGS += -DG4GEOM_USE_UELLIPSOID
endif
ifdef G4GEOM_USE_UEXTRUDEDSOLID
CPPFLAGS += -DG4GEOM_USE_UEXTRUDEDSOLID
endif
+1 -1
View File
@@ -26,7 +26,7 @@ endif
########################### Qt ###############################
# Should be before X11.
ifdef INC_QT
CPPFLAGS += $(QTFLAGS)
CPPFLAGS += -DQT_NO_DEPRECATED_WARNINGS $(QTFLAGS)
endif
ifdef LOAD_QT
INTYLIBS += $(QTLIBS)
+2 -2
View File
@@ -71,7 +71,7 @@ char** parsedir(char *directory,int *argc)
strlen(entry->d_name)+2)*sizeof(char));
strcpy(buffer,directory);
strncat(buffer,"/",1);
strncat(buffer,entry->d_name,strlen(entry->d_name));
strcat(buffer,entry->d_name);
s=stat(buffer,&status);
if(s==0)
{
@@ -295,7 +295,7 @@ int main (int argc, char** argv) {
while(ptr&&strcmp(ptr,"GNUmakefile"))
{
strncat(libmapPtr->trigger,"/",1);
strncat(libmapPtr->trigger,ptr,strlen(ptr));
strcat(libmapPtr->trigger,ptr);
ptr=strtok(NULL,"/");
}
if(!ptr)
+3 -3
View File
@@ -63,15 +63,15 @@ ifeq ($(G4SYSTEM),Darwin-clang)
X11LIBS := -L/usr/X11/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/sw/include
XMFLAGS := -I/usr/local/include
# XMFLAGS := -I/usr/X11/include ##### some installations.
endif
ifndef XMLIBS
XMLIBS := -L/sw/lib -lXm -lXpm
XMLIBS := -L/usr/local/lib -lXm -lXpm
# XMLIBS := -L/usr/X11/lib -lXm -lXpm ##### some installations.
endif
ifndef XAWFLAGS
XAWFLAGS := -I/sw/include
XAWFLAGS := -I/usr/local/include
# XAWFLAGS := -I/usr/X11/include ##### some installations.
endif
ifndef XAWLIBS
+3 -3
View File
@@ -69,15 +69,15 @@ ifeq ($(G4SYSTEM),Darwin-g++)
X11LIBS := -L/usr/X11/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/sw/include
XMFLAGS := -I/usr/local/include
# XMFLAGS := -I/usr/X11/include ##### some installations.
endif
ifndef XMLIBS
XMLIBS := -L/sw/lib -lXm -lXpm
XMLIBS := -L/usr/local/lib -lXm -lXpm
# XMLIBS := -L/usr/X11/lib -lXm -lXpm ##### some installations.
endif
ifndef XAWFLAGS
XAWFLAGS := -I/sw/include
XAWFLAGS := -I/usr/local/include
# XAWFLAGS := -I/usr/X11/include ##### some installations.
endif
ifndef XAWLIBS
+6 -3
View File
@@ -66,21 +66,24 @@ ifeq ($(G4SYSTEM),Linux-clang)
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
X11LIBS := -L/usr/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
XMFLAGS := -I/usr/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
XAWFLAGS := -I/usr/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLHOME
OGLHOME := /usr
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
+6 -3
View File
@@ -64,21 +64,24 @@ ifeq ($(G4SYSTEM),Linux-g++)
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
X11LIBS := -L/usr/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
XMFLAGS := -I/usr/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
XAWFLAGS := -I/usr/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLHOME
OGLHOME := /usr
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
+6 -3
View File
@@ -56,16 +56,16 @@ ifeq ($(G4SYSTEM),Linux-icc)
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
X11LIBS := -L/usr/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
XMFLAGS := -I/usr/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
XAWFLAGS := -I/usr/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
@@ -74,6 +74,9 @@ ifeq ($(G4SYSTEM),Linux-icc)
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
ifndef OGLHOME
OGLHOME := /usr
endif
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
+2 -2
View File
@@ -1,5 +1,5 @@
#
# ------ WIN32/VC ------ Visual-C++ 7 .NET and higher
# ------ WIN32/VC ------ Visual Studio 2019 and higher
#
ifeq ($(G4SYSTEM),WIN32-VC)
CXX := CL
@@ -10,7 +10,7 @@ ifeq ($(G4SYSTEM),WIN32-VC)
CXXFLAGS += -Od -MDd -Zi -Fd$(G4LIBDIR)/lib$(name)
endif
endif
CXXFLAGS += -GR -EHsc -Zm200 -nologo
CXXFLAGS += -GR -EHsc -Zm200 -nologo -std:c++17
CXXFLAGS += -D_CONSOLE -D_WIN32 -DOS
CPPFLAGS += -DWIN32 -DXPNET -D_CRT_SECURE_NO_DEPRECATE
LDFLAGS += -FORCE /NODEFAULTLIB:MSVCRT.dll /STACK:12582912
+5 -16
View File
@@ -1,9 +1,7 @@
#
# ------ GNU/WIN32 CYGWIN ------ !!! not supported !!!
# Cygnus CygWin - gcc-3.2 and higher
# Windows XP
#
# Stefano Agostinelli (agos001@pn.itnet.it) - IST Group, Genova
# Cygnus CygWin - gcc-9.2 and higher
# Windows 10
#
ifeq ($(G4SYSTEM),WIN32-g++)
CXX := g++
@@ -12,18 +10,9 @@ ifeq ($(G4SYSTEM),WIN32-g++)
CXXFLAGS += -Wno-variadic-macros -Wshadow -pipe
CXXFLAGS += -fno-trapping-math -ftree-vectorize -fno-math-errno
G4USE_STD11 := 1
ifdef G4USE_STD14
CPPFLAGS += -std=c++14
CXXFLAGS += -std=c++14
else
ifdef G4USE_STD17
CPPFLAGS += -std=c++17
CXXFLAGS += -std=c++17
else
CXXFLAGS += -std=c++11
CPPFLAGS += -std=c++11
endif
endif
G4USE_STD17 := 1
CPPFLAGS += -std=c++17
CXXFLAGS += -std=c++17
ifdef G4OPTIMISE
CXXFLAGS += -O3
FCFLAGS := -O3
+10 -6
View File
@@ -17,9 +17,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
envs-V10-05-00/ Dec. 1, 2019 K.Murakami
- g4py, updated for 10.6 release
- g4pym boost_python library name can be specified in cmake (BZ-2059)
envs-V10-04-01 / Nov. 30, 2018 K.Murakami
- g4py, updated for 10.5 release
- g4py, fix CMAKE_INSTALL_PREFIX does not work (id 1924)
- g4py, fix CMAKE_INSTALL_PREFIX does not work (id 1924)
envs-V10-03-01 / Nov. 24, 2017 K.Murakami
- g4py, updated for 10.4 release
@@ -201,7 +205,7 @@ envs-V08-01-00 20 November 2006 Koichi Murakami
- more exposed stuffs
- add physics list module
- add GUI examples using wxPython
envs-V08-00-09 29 June 2006 Koichi Murakami
[g4py]
- fix rpath of boost_python (config/sys/linux.gmk, linuxx8664gcc.gmk)
@@ -235,7 +239,7 @@ envs-V08-00-04 05 June 2006 Koichi Murakami
- [g4py] additional moddifications of g4py for G4 8.1 (08-00-ref-05)
envs-V08-00-03 05 June 2006 Koichi Murakami
- History file is updated.
- History file is updated.
- same as the previous
envs-V08-00-02 05 June 2006 Koichi Murakami
@@ -252,7 +256,7 @@ envs-V08-00-00 28 February 2006 Hajime Yoshida
-addition of new Python environments
-- g4py/source : Python wrappers of geant4/sources
-- g4py/site-modules : some application modules using the wrappers
-- g4py/ associated files to configure
-- g4py/ associated files to configure
envs-V06-02-00 27 November 2004 Hajime Yoshida
-old depricated files
@@ -283,7 +287,7 @@ envs-V01-01-01 09 June 2000 John Allison
- Only OPACS and History tagged.
09 June 2000 Guy Barrand
- Some correction to be able to compile
- Some correction to be able to compile
with 01-01-ref-04
envs-V01-01-00 7th June 2000 Guy Barrand
@@ -320,7 +324,7 @@ envs-00-03-02 14th Sep 1998 Hajime Yoshida
- minor updates in GGE
envs-00-03-01 13th Sep 1998 Hajime Yoshida
-Momo/GGEmake added README and a macro file
-Momo/java/Momo/GGE updated.
-Momo/java/Momo/GGE updated.
BREPs, sample persistent files etc.
envs-00-02-01 3rd Sep 1998 Hajime Yoshida
Momo/GGEmake
+8
View File
@@ -40,6 +40,14 @@ if(NOT GEANT4_FOUND)
message(FATAL_ERROR "NOT Found Geant4.")
endif()
if(NOT DEFINED BOOST_PYTHON_LIB)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
set(BOOST_PYTHON_LIB boost_python)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
set(BOOST_PYTHON_LIB boost_python3)
endif()
endif()
#------------------------------------------------------------------------------
# parameters for building
message(STATUS "--------------------------------------------------------")
+5
View File
@@ -11,6 +11,11 @@ Geant4Py is a Geant4-Python bridge.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
1 Dec. 2019 K. Murakami
- update for 10.6 release
- update for Python3 support
- boost_python library name can be specified in cmake (BZ-2059)
31 Jan. 2019, I.Hrivnacova
- Merged GitHub PR #4: all Boolean operators now return G4bool.
+7 -4
View File
@@ -24,9 +24,8 @@ ROOT for histogramming/analysis
### Tested Platforms
* CentOS7 (RH7 clones)
* OSX (High Siera)
* CentOS7 (Python2)
* Ubuntu 18.04 LTS (Python3)
How to Install
--------------
@@ -40,7 +39,7 @@ then
# mkdir build
# cd build
# cmake ..
# cmake ..
# make
# make install
@@ -67,7 +66,11 @@ Python module search directories, given by a colon-separated list of directories
# export PYTHONPATH=<g4py>/lib64:<g4py>/lib64/examples:<g4py>/lib64/tests (zsh, bash)
# setenv PYTHONPATH <g4py>/lib64:<g4py>/lib64/examples:<g4py>/lib64/tests (csh)
### *LD_LIBRARY_PATH*
You might need define LD_LIBRARY_PATH for Geant4 libraries.
# export LD_LIBRARY_PATH=<Geant4 install path>/lib (zsh, bash)
# setenv LD_LIBRARY_PATH=<Geant4 install path>/lib (csh)
### Getting started
You can import Geant4Py modules in Python just like
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -17,7 +17,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -19,7 +19,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -16,7 +16,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -22,5 +22,5 @@ add_custom_command (
# install
install (FILES ${PY_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -22,5 +22,5 @@ add_custom_command (
# install
install (FILES ${PY_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -22,5 +22,5 @@ add_custom_command (
# install
install (FILES ${PY_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYC_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
#install (FILES ${PYO_FILES} DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -18,7 +18,7 @@ set_target_properties(${_TARGET}
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -23,7 +23,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
+1 -1
View File
@@ -24,7 +24,7 @@ set_target_properties(${_TARGET}
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} ${XERCESC_LIBRARY}
boost_python ${PYTHON_LIBRARIES})
${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
@@ -56,7 +56,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -61,33 +61,29 @@ void export_G4VPhysicalVolume()
// ---
.def("SetTranslation", &G4VPhysicalVolume::SetTranslation)
.def("GetTranslation", &G4VPhysicalVolume::GetTranslation,
return_internal_reference<>())
return_value_policy<return_by_value>())
.def("GetObjectTranslation", &G4VPhysicalVolume::GetObjectTranslation)
.def("GetFrameTranslation", &G4VPhysicalVolume::GetObjectTranslation)
// ---
.def("SetRotation", &G4VPhysicalVolume::SetRotation)
.def("GetRotation", f1_GetRotation,
return_internal_reference<>())
return_internal_reference<>())
.def("GetRotation", f2_GetRotation,
return_internal_reference<>())
return_internal_reference<>())
.def("GetObjectRotationValue", &G4VPhysicalVolume::GetObjectRotationValue)
.def("GetFrameRotation", &G4VPhysicalVolume::GetFrameRotation,
return_internal_reference<>())
return_internal_reference<>())
// ---
.def("SetLogicalVolume", &G4VPhysicalVolume::SetLogicalVolume)
.def("SetMotherLogical", &G4VPhysicalVolume::SetMotherLogical)
.def("GetLogicalVolume", &G4VPhysicalVolume::GetLogicalVolume,
return_internal_reference<>())
return_internal_reference<>())
.def("GetMotherLogical", &G4VPhysicalVolume::GetMotherLogical,
return_internal_reference<>())
return_internal_reference<>())
// ---
.def("SetName", &G4VPhysicalVolume::SetName)
#if G4VERSION_NUMBER <= 801
.def("GetName", &G4VPhysicalVolume::GetName)
#else
.def("GetName", &G4VPhysicalVolume::GetName,
return_value_policy<return_by_value>())
#endif
.def("SetCopyNo", &G4VPhysicalVolume::SetCopyNo)
.def("GetCopyNo", &G4VPhysicalVolume::GetCopyNo)
// ---
@@ -96,7 +92,6 @@ void export_G4VPhysicalVolume()
.def("IsParameterised", &G4VPhysicalVolume::IsParameterised)
.def("GetMultiplicity", &G4VPhysicalVolume::GetMultiplicity)
.def("GetParameterisation", &G4VPhysicalVolume::GetParameterisation,
return_value_policy<reference_existing_object>())
return_value_policy<reference_existing_object>())
;
}
@@ -36,9 +36,8 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
@@ -18,7 +18,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -20,7 +20,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -17,7 +17,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -24,7 +24,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -29,7 +29,6 @@
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4Version.hh"
#include "G4Material.hh"
using namespace boost::python;
@@ -45,6 +44,14 @@ void (G4Material::*f1_AddElement)(G4Element*, G4int)
void (G4Material::*f2_AddElement)(G4Element*, G4double)
= &G4Material::AddElement;
// GetMaterial
G4Material* (*f1_GetMaterial)(const G4String&, G4bool)
= &G4Material::GetMaterial;
G4Material* (*f2_GetMaterial)(G4double, G4double, G4double)
= &G4Material::GetMaterial;
G4Material* (*f3_GetMaterial)(size_t, G4double)
= &G4Material::GetMaterial;
BOOST_PYTHON_FUNCTION_OVERLOADS(f_GetMaterial, G4Material::GetMaterial, 1, 2)
// raw pointer -> Python list conversion
@@ -156,9 +163,12 @@ void export_G4Material()
.def("GetNumberOfMaterials", &G4Material::GetNumberOfMaterials)
.staticmethod("GetNumberOfMaterials")
.def("GetIndex", &G4Material::GetIndex)
.def("GetMaterial", &G4Material::GetMaterial,
f_GetMaterial()
[return_value_policy<reference_existing_object>()])
.def("GetMaterial", f1_GetMaterial, f_GetMaterial()
[return_value_policy<reference_existing_object>()])
.def("GetMaterial", f2_GetMaterial,
return_value_policy<reference_existing_object>())
.def("GetMaterial", f3_GetMaterial,
return_value_policy<reference_existing_object>())
.staticmethod("GetMaterial")
// ---
//.def(self_ns::str(self))
@@ -173,4 +183,3 @@ void export_G4Material()
.value("kStateGas", kStateGas)
;
}
@@ -23,7 +23,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -17,7 +17,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -25,7 +25,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
+2 -2
View File
@@ -7,8 +7,8 @@
# This package contains a set of Python interface with Geant4.
# ==================================================================
"""
__version__ ='10.5'
__date__ = 'December/2018'
__version__ ='10.6'
__date__ = 'December/2019'
__author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
# import submodules
@@ -5,8 +5,8 @@ file (GLOB PY_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
foreach (_pyfile ${PY_FILES})
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/${_pyfile}
${CMAKE_CURRENT_BINARY_DIR}/${_pyfile} COPYONLY)
list (APPEND PYC_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_pyfile}c")
list (APPEND PYO_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_pyfile}o")
#list (APPEND PYC_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_pyfile}c")
#list (APPEND PYO_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_pyfile}o")
endforeach()
add_custom_target (Geant4Py ALL)
@@ -20,7 +20,8 @@ add_custom_command (
)
# install
install (FILES ${PY_FILES} DESTINATION ${G4MODULES_INSTALL_DIR})
install (FILES ${PYC_FILES} DESTINATION ${G4MODULES_INSTALL_DIR})
install (FILES ${PYO_FILES} DESTINATION ${G4MODULES_INSTALL_DIR})
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__pycache__
DESTINATION ${G4MODULES_INSTALL_DIR})
#install (FILES ${PYC_FILES} DESTINATION ${G4MODULES_INSTALL_DIR})
#install (FILES ${PYO_FILES} DESTINATION ${G4MODULES_INSTALL_DIR})
+2 -5
View File
@@ -7,8 +7,8 @@
# This package contains a set of Python interface with Geant4.
# ==================================================================
"""
__version__ ='10.5'
__date__ = 'December/2018'
__version__ ='10.6'
__date__ = 'December/2019'
__author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
# import submodules
@@ -85,9 +85,6 @@ gParticleIterator = PyG4ParticleList()
# gProcessTable
gProcessTable = G4ProcessTable.GetProcessTable()
# gLossTableManager
gLossTableManager = G4LossTableManager.Instance()
# gProductionCutsTable
gProductionCutsTable = G4ProductionCutsTable.GetProductionCutsTable()
+1 -1
View File
@@ -25,7 +25,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -21,7 +21,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -19,7 +19,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -42,7 +42,7 @@ set_target_properties(${_TARGET}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
+16 -12
View File
@@ -24,18 +24,22 @@ add_subdirectory(gtest01/module)
# testing
add_subdirectory(test00)
add_subdirectory(test01)
add_subdirectory(test02)
add_subdirectory(test03)
add_subdirectory(test04)
add_subdirectory(test05)
add_subdirectory(test06)
add_subdirectory(test07)
add_subdirectory(test08)
add_subdirectory(test09)
add_subdirectory(test10)
add_subdirectory(test11)
add_subdirectory(test12)
add_subdirectory(test13)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
add_subdirectory(test02)
add_subdirectory(test03)
add_subdirectory(test04)
add_subdirectory(test05)
add_subdirectory(test06)
add_subdirectory(test07)
add_subdirectory(test08)
add_subdirectory(test09)
add_subdirectory(test10)
add_subdirectory(test11)
add_subdirectory(test12)
add_subdirectory(test13)
endif()
#
add_subdirectory(gtest01)
add_subdirectory(gtest02)
@@ -1,7 +1,13 @@
# add teting
add_test(gtest01 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest01
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
@@ -27,7 +27,7 @@ set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "gtest01")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${GEANT4_LIBRARIES_WITH_VIS} ${BOOST_PYTHON_LIB}
${PYTHON_LIBRARIES})
# install
@@ -69,7 +69,7 @@ class MyField(G4MagneticField):
bfield.y= 5.*tesla
bfield.z= 0.
return bfield
# ==================================================================
# main
# ==================================================================
@@ -89,7 +89,7 @@ gRunManager.SetUserAction(myPGA)
#myRA= MyRunAction()
#gRunManager.SetUserAction(myRA)
myEA= MyEventAction()
gRunManager.SetUserAction(myEA)
@@ -113,9 +113,6 @@ fieldMgr.CreateChordFinder(myField)
gRunManager.Initialize()
# visualization
gControlExecute("vis.mac")
# beamOn
gRunManager.BeamOn(10)
gTerminate()
@@ -1,7 +1,13 @@
# add teting
add_test(gtest02 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest02
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
@@ -1,7 +1,13 @@
# add teting
add_test(gtest03 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest03
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
@@ -1,7 +1,13 @@
# add teting
add_test(gtest04 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest04
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
@@ -1,7 +1,13 @@
# add teting
add_test(gtest05 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest05
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
+13 -12
View File
@@ -20,7 +20,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
self.air= gNistManager.FindOrBuildMaterial("G4_AIR")
self.lv_object= None
self.world= self.ConstructWorld()
self.va_red= G4VisAttributes(G4Color(1.,0.,0.))
self.va_cyan= G4VisAttributes(G4Color(0.,1.,1.))
self.va_green= G4VisAttributes(G4Color(0.,1.,0.))
@@ -34,7 +34,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
global sld_world, lv_world, pv_world, va_world
sld_world= G4Box("world", 1.*m, 1.*m, 1.*m)
lv_world= G4LogicalVolume(sld_world, self.air, "world")
lv_world= G4LogicalVolume(sld_world, self.air, "world")
pv_world= G4PVPlacement(G4Transform3D(), lv_world, "world",
None, False, 0)
@@ -58,7 +58,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
self.lv_object.SetSolid(sld_box)
self.lv_object.SetVisAttributes(self.va_red)
gRunManager.GeometryHasBeenModified()
# -----------------------------------------------------------------
def ConstructTubs(self):
global sld_tubs
@@ -66,7 +66,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
self.lv_object.SetSolid(sld_tubs)
self.lv_object.SetVisAttributes(self.va_cyan)
gRunManager.GeometryHasBeenModified()
# -----------------------------------------------------------------
def ConstructCons(self):
global sld_cons
@@ -114,7 +114,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def ConstructOrb(self):
global sld_orb
sld_orb= G4Orb("orb", 100.*cm)
sld_orb= G4Orb("orb", 100.*cm)
self.lv_object.SetSolid(sld_orb)
self.lv_object.SetVisAttributes(self.va_red)
gRunManager.GeometryHasBeenModified()
@@ -122,7 +122,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def ConstructTorus(self):
global sld_torus
sld_torus= G4Torus("torus", 40.*cm, 60.*cm, 200.*cm, 0., 90.*deg)
sld_torus= G4Torus("torus", 40.*cm, 60.*cm, 200.*cm, 0., 90.*deg)
self.lv_object.SetSolid(sld_torus)
self.lv_object.SetVisAttributes(self.va_magenta)
gRunManager.GeometryHasBeenModified()
@@ -164,7 +164,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def ConstructEllipticalTube(self):
global sld_et
sld_et= G4EllipticalTube("ellipticaltube", 5.*cm, 10.*cm, 20.*cm)
sld_et= G4EllipticalTube("ellipticaltube", 5.*cm, 10.*cm, 20.*cm)
self.lv_object.SetSolid(sld_et)
self.lv_object.SetVisAttributes(self.va_cyan)
gRunManager.GeometryHasBeenModified()
@@ -182,7 +182,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
def ConstructEllipticalCone(self):
global sld_ec
sld_ec= G4EllipticalCone("ellipticalcone", 30.*cm, 60.*cm,
50.*cm, 25.*cm)
50.*cm, 25.*cm)
self.lv_object.SetSolid(sld_ec)
self.lv_object.SetVisAttributes(self.va_magenta)
gRunManager.GeometryHasBeenModified()
@@ -249,8 +249,8 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def Construct(self): # return the world volume
return self.world
return self.world
# ==================================================================
# main
# ==================================================================
@@ -304,7 +304,8 @@ f_list= (
for s,f in f_list:
f.__call__()
gRunManager.BeamOn(1)
gRunManager.BeamOn(1)
fname= "%s.wrl" % (s)
os.rename("g4_00.wrl", fname)
gTerminate()
@@ -1,7 +1,13 @@
# add teting
add_test(gtest06 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest06
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
+11 -11
View File
@@ -19,7 +19,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
self.air= gNistManager.FindOrBuildMaterial("G4_AIR")
self.lv_object= None
self.world= self.ConstructWorld()
self.va_red= G4VisAttributes(G4Color(1.,0.,0.))
self.va_cyan= G4VisAttributes(G4Color(0.,1.,1.))
self.va_green= G4VisAttributes(G4Color(0.,1.,0.))
@@ -36,7 +36,7 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
global sld_world, lv_world, pv_world, va_world
sld_world= G4Box("world", 1.*m, 1.*m, 1.*m)
lv_world= G4LogicalVolume(sld_world, self.air, "world")
lv_world= G4LogicalVolume(sld_world, self.air, "world")
pv_world= G4PVPlacement(G4Transform3D(), lv_world, "world",
None, False, 0)
@@ -56,16 +56,16 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def ConstructUnion(self):
global sld_union
sld_union= G4UnionSolid("box+cylinder", self.sld_box, self.sld_cyl);
sld_union= G4UnionSolid("box+cylinder", self.sld_box, self.sld_cyl);
self.lv_object.SetSolid(sld_union)
self.lv_object.SetVisAttributes(self.va_blue)
gRunManager.GeometryHasBeenModified()
# -----------------------------------------------------------------
def ConstructIntersection(self):
offset= G4ThreeVector(20.*cm, 20.*cm, 0.)
global sld_intersection
global sld_intersection
sld_intersection= G4IntersectionSolid("box*cylinder",
self.sld_box, self.sld_cyl,
None, offset)
@@ -76,18 +76,18 @@ class MyDetectorConstruction(G4VUserDetectorConstruction):
# -----------------------------------------------------------------
def ConstructSubtraction(self):
global sld_subtraction
global sld_subtraction
sld_subtraction= G4SubtractionSolid("box-cylinder",
self.sld_box, self.sld_cyl)
self.lv_object.SetSolid(sld_subtraction)
self.lv_object.SetVisAttributes(self.va_red)
gRunManager.GeometryHasBeenModified()
# -----------------------------------------------------------------
def Construct(self): # return the world volume
return self.world
return self.world
# ==================================================================
# main
# ==================================================================
@@ -122,5 +122,5 @@ for s,f in f_list:
fname= "%s.jpg" % (s)
cmdstr= "/vis/rayTracer/trace " + fname
gApplyUICommand(cmdstr)
gTerminate()
@@ -1,7 +1,13 @@
# add teting
add_test(gtest07 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST gtest07
PROPERTY ENVIRONMENT
PYTHONPATH=./module:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
@@ -1,5 +1,11 @@
# add teting
add_test(test00 python test.py)
configure_file(test.py test.py)
if (${PYTHON_VERSION_MAJOR} MATCHES "2")
configure_file(test.py test.py)
elseif (${PYTHON_VERSION_MAJOR} MATCHES "3")
configure_file(python3/test.py test.py)
endif()
set_property(TEST test00 PROPERTY ENVIRONMENT PYTHONPATH=./module)
@@ -19,8 +19,7 @@ set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "test00")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
target_link_libraries (${_TARGET} boost_python ${PYTHON_LIBRARIES})
target_link_libraries (${_TARGET} ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${TEST_MODULES_INSTALL_DIR})

Some files were not shown because too many files have changed in this diff Show More