Import Geant4 10.7.0.beta source tree
This commit is contained in:
+99
-15
@@ -29,46 +29,130 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
|
||||
* Reverse chronological order (last date on top), please *
|
||||
|
||||
----------------------------------------------------------
|
||||
21st April 2020 - Ben Morgan (cmake-V10-05-39)
|
||||
- BUGFIX: Only store variables in Geant4PackageCache if they have
|
||||
a value.
|
||||
|
||||
6th April 2020 - Ben Morgan (cmake-V10-05-38)
|
||||
17th June 2020 - Jonathan Madsen (cmake-V10-06-25)
|
||||
- Moved TBB before PTL
|
||||
- Forced PTL_USE_TBB to be set to GEANT4_USE_TBB when not
|
||||
using system PTL
|
||||
- Added Geant4::G4ptl ALIAS targets for build tree testing
|
||||
- Added support for building G4ptl, GEANT4_USE_TBB option
|
||||
- Updated FindTBB.cmake to be more robust
|
||||
- Updates to PTL internal/external handling
|
||||
- fixed PTL find_dependency
|
||||
|
||||
15th June 2020 - Gunter Folger (cmake-V10-06-24)
|
||||
- Switch to G4EMLOW 7.12
|
||||
|
||||
8th June 2020 - Ben Morgan (cmake-V10-06-23)
|
||||
- Default GEANT4_USE_NEW_CMAKE to ON to use new build organization
|
||||
as the primary system.
|
||||
- Fix bug in setting of AUTOMOC
|
||||
- Handle install of G4clhep{-static} independently of main modules
|
||||
due it being built outside the category system.
|
||||
- Retain GEANT4_BUILDTREE_INCLUDE_DIRS in new CMake system to support
|
||||
clients that may not yet support CMake target usage requirements.
|
||||
- Protect recursion into tests module on existence of the directory
|
||||
|
||||
2nd June 2020 - Guilherme Amadio (cmake-V10-06-22)
|
||||
- Avoid warnings from propagating CMAKE_DISABLE_FIND_PACKAGE_ROOT
|
||||
down to tests.
|
||||
|
||||
30th May 2020 - Ben Morgan (cmake-V10-06-21)
|
||||
- Modules/Geant4DeveloperAPI.cmake: Import new "target" style API for
|
||||
declaring and composing libraries from modules of source code.
|
||||
Provide GEANT4_USE_NEW_CMAKE option, OFF by default, to switch between
|
||||
systems.
|
||||
|
||||
28th May 2020 - Gunter Folger (cmake-V10-06-20)
|
||||
- Switch to G4EMLOW 7.11
|
||||
|
||||
26th May 2020 - Ben Morgan (cmake-V10-06-19)
|
||||
- Use "VecGeom::vecgeom" as imported target name for VecGeom library
|
||||
to bring in line with upstream master of VecGeom. Export VecCore_DIR
|
||||
if it is set to package cache file, as new VecGeomConfig needs to refind
|
||||
VecCore.
|
||||
|
||||
20 May 2020 - Frederick Jones (cmake-V10-06-18)
|
||||
- Modules/G4InterfaceOptions.cmake: added GEANT4_USE_XM to Open
|
||||
Inventor X driver code block to correct Xm and Xt link order.
|
||||
|
||||
19th May 2020 - Guilherme Amadio (cmake-V10-06-17)
|
||||
- Propagate value of CMAKE_DISABLE_FIND_PACKAGE_ROOT down to tests
|
||||
that optionally support ROOT to allow testing Geant4 with ROOT support
|
||||
disabled. This is necessary when testing Geant4 with a different C++
|
||||
standard than ROOT when it's installed.
|
||||
|
||||
29th April 2020 - Ben Morgan (cmake-V10-06-16)
|
||||
- Add GEANT4_USE_NEW_CMAKE option in preparation for testing of modular
|
||||
build updates. Added now to suppress Continuous warnings
|
||||
|
||||
22 April 2020 - Frederick Jones (cmake-V10-06-15)
|
||||
- Modules/G4InterfaceOptions.cmake, Templates/Geant4Config.cmake.in:
|
||||
Added support for Open Inventor Qt Vis driver to be built
|
||||
and used in applications. The library can be built with the
|
||||
OIQT driver, or with the OIX/OIXE drivers, but not both.
|
||||
|
||||
6th April 2020 - Ben Morgan (cmake-V10-06-14)
|
||||
- Activate build of geant4py when GEANT4_USE_PYTHON is set
|
||||
Check that MT builds use global-dynamic TLS to allow Python
|
||||
module loading of the Geant4 dynamic libraries.
|
||||
|
||||
3rd April 2020 - Guilherme Amadio (cmake-V10-05-37)
|
||||
21st April 2020 - Ben Morgan (cmake-V10-06-13)
|
||||
- BUGFIX: Only store variables in Geant4PackageCache if they have
|
||||
a value.
|
||||
|
||||
20th April 2020 - Ben Morgan (cmake-V10-06-12)
|
||||
- Remove Qt4 support
|
||||
|
||||
17th April 2020 - Ben Morgan (cmake-V10-06-11)
|
||||
- Add GEANT4_USE_PYTHON option to suppress Continuous warnings
|
||||
|
||||
3rd April 2020 - Guilherme Amadio (cmake-V10-06-10)
|
||||
- Use full path to datasets if GEANT4_INSTALL_DATADIR is an absolute path
|
||||
|
||||
2nd April 2020 - Guilherme Amadio (cmake-V10-05-36)
|
||||
2nd April 2020 - Guilherme Amadio (cmake-V10-06-09)
|
||||
- Customize CMAKE_INSTALL_DATADIR in a single location
|
||||
|
||||
18th March 2020 - Gunter Folger (cmake-V10-05-35)
|
||||
18th March 2020 - Gunter Folger (cmake-V10-06-08)
|
||||
- In Modules/G4CPack.cmake suppress warnings about icc libraries not existing
|
||||
for Intel icc version 19.
|
||||
|
||||
14th February 2020 - Ben Morgan (cmake-V10-05-34)
|
||||
16th March 2020 - Gunter Folger (cmake-V10-06-07)
|
||||
- Switch to G4EMLOW 7.10
|
||||
|
||||
14th February 2020 - Ben Morgan (cmake-V10-06-06)
|
||||
- No longer create gnumake symlinks on Windows
|
||||
Windows permissions may prevent creation of symlinks, leading to
|
||||
errors at install time. As gnumake is no longer supported on
|
||||
Windows, protect symlink creation with test on host platform.
|
||||
|
||||
5th February 2020 - Ben Morgan (cmake-V10-05-33)
|
||||
- Apply patch from TXCorp to allow compilation on Windows using Clang
|
||||
|
||||
4th February 2020 - Ben Morgan (cmake-V10-05-32)
|
||||
4th February 2020 - Ben Morgan (cmake-V10-06-05)
|
||||
- BUGFIX 2221
|
||||
Use "${FOO:-}" variable expansion and "-z" test to check for
|
||||
undefined variables in Bourne Shell scripts. Prevents errors when
|
||||
shell is in "set -u" mode. Report and patch supplied by Michael Reilly
|
||||
|
||||
28th January 2020 - Gunter Folger (cmake-V10-05-31)
|
||||
- Switch to patched dataset for G4EMLOW 7.9.1
|
||||
27th January 2020 - Gunter Folger (cmake-V10-06-04)
|
||||
- Switch to G4EMLOW 7.9.1
|
||||
|
||||
15th January 2020 - Ben Morgan (cmake-V10-05-30)
|
||||
15th January 2020 - Ben Morgan (cmake-V10-06-03)
|
||||
- Quote VECGEOM_COMPILE_DEFINITIONS to avoid incorrect argument errors
|
||||
|
||||
6th January 2020 - Ben Morgan (cmake-V10-06-02)
|
||||
- Apply patch from TXCorp to allow compilation on Windows using Clang
|
||||
|
||||
12th December 2019 - Ben Morgan (cmake-V10-06-01)
|
||||
- Remove requirement on presence of XQuartz GLU library
|
||||
- No longer save glu related variables in the package cache
|
||||
|
||||
6th December 2019 - Ben Morgan (cmake-V10-06-00)
|
||||
- Remove obsolete Geant4Wrapping module in preparation for full G4Py
|
||||
build support
|
||||
- Rename remaining internal "Geant4..." modules to "G4" convention
|
||||
Retain Geant4DefineModule and Geant4LibraryTargets until new modularization
|
||||
scheme in place.
|
||||
- Format G4ClangFormat
|
||||
|
||||
25th November 2019 - Ben Morgan (cmake-V10-05-29)
|
||||
- Disable configuration of Wt UI/Vis driver due to it no longer
|
||||
compiling with recent Wt versions
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
function(WRITE_UNINSTALL_TARGET_SCRIPT)
|
||||
function(write_uninstall_target_script)
|
||||
# Create uninstall target template file, if it doesn't exist...
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in)
|
||||
set(__uninstall_filename ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake.in)
|
||||
@@ -42,10 +42,8 @@ endforeach(file)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# Call the file writing function, if needed
|
||||
WRITE_UNINSTALL_TARGET_SCRIPT()
|
||||
write_uninstall_target_script()
|
||||
|
||||
# Configure the file that reads the install manifest and processes the files
|
||||
configure_file(
|
||||
@@ -56,5 +54,3 @@ configure_file(
|
||||
# Add the uninstall target
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# - Find StatTest
|
||||
# This module tries to find the StatTest application
|
||||
# Once done this will define
|
||||
#
|
||||
#
|
||||
# STATTEST_FOUND - Application found
|
||||
# STATTEST_APP - Application
|
||||
# STATTEST_CMD - Command line to run the application
|
||||
# STATTEST_ADD_TEST - Helper function to define a ctest using
|
||||
# StatTest (Only if we are using for G4 testing)
|
||||
#
|
||||
# Variables used by this module, which can change the default behaviour
|
||||
# Variables used by this module, which can change the default behaviour
|
||||
# and need to be set before calling find_package
|
||||
#
|
||||
# STATTEST_ROOT_DIR Root directory to StatTest package
|
||||
@@ -22,7 +22,7 @@ if(NOT GEANT4_ENABLE_TESTING)
|
||||
endif()
|
||||
|
||||
#Search application
|
||||
#Note that the second suggested path is G4 specific...
|
||||
#Note that the second suggested path is G4 specific...
|
||||
find_path(STATTEST_APP_DIR
|
||||
NAMES StatTestVersion.py
|
||||
PATHS ${STATTEST_ROOT_DIR} ${CMAKE_SOURCE_DIR}/verification/StatTest
|
||||
@@ -43,7 +43,7 @@ if(NOT ROOT_FOUND)
|
||||
set(_root_isok FALSE)
|
||||
else()
|
||||
set(_root_isok TRUE)
|
||||
# - Check if python interpreter is correct version
|
||||
# - Check if python interpreter is correct version
|
||||
# (the one compatible with root)
|
||||
find_package(PythonInterp ${ROOT_PYTHONVER} QUIET)
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
@@ -70,9 +70,9 @@ if(STATTEST_FOUND)
|
||||
set(STATTEST_APP ${STATTEST_APP_DIR}/runtests.py)
|
||||
set(STATTEST_CMD ${PYTHON_EXECUTABLE} ${STATTEST_APP})
|
||||
|
||||
# Let's create a function that helps in building tests for
|
||||
# Let's create a function that helps in building tests for
|
||||
# regression testing
|
||||
# function STATTEST_ADD_TEST(<name>
|
||||
# function STATTEST_ADD_TEST(<name>
|
||||
# G4TEST testname
|
||||
# CONFIG conffile
|
||||
# INPUT inputfile
|
||||
@@ -82,7 +82,7 @@ if(STATTEST_FOUND)
|
||||
# [LABELS label1 label2 ...]
|
||||
# [IMG filename])
|
||||
function(STATTEST_ADD_TEST stattest)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;TEXT"
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;TEXT"
|
||||
"CONFIG;INPUT;REFERENCE;G4TEST;IMG"
|
||||
"LABELS" ${ARGN}
|
||||
)
|
||||
@@ -91,12 +91,12 @@ if(STATTEST_FOUND)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: conffile is mandatory")
|
||||
endif()
|
||||
|
||||
|
||||
list(LENGTH ARG_INPUT _len)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: inputfile is mandatory")
|
||||
endif()
|
||||
|
||||
|
||||
list(LENGTH ARG_G4TEST _len)
|
||||
if(_len LESS 1)
|
||||
message(FATAL_ERROR "STATTEST_ADD_TEST: testname is mandatory")
|
||||
@@ -108,10 +108,10 @@ if(STATTEST_FOUND)
|
||||
else()
|
||||
set(_command ${STATTEST_CMD})
|
||||
endif()
|
||||
|
||||
|
||||
if(ARG_TEXT)
|
||||
set(_command ${_command} "-T")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#Mandatory parameters
|
||||
set(_command ${_command} ${ARG_CONFIG} ${ARG_INPUT})
|
||||
@@ -125,10 +125,10 @@ if(STATTEST_FOUND)
|
||||
set(_labels "")
|
||||
endif()
|
||||
|
||||
include(Geant4CTest)
|
||||
|
||||
include(G4CTest)
|
||||
|
||||
#Now build G4 test
|
||||
GEANT4_ADD_TEST(${stattest}
|
||||
GEANT4_ADD_TEST(${stattest}
|
||||
COMMAND ${_command}
|
||||
DEPENDS ${ARG_G4TEST}
|
||||
LABELS ${_labels}
|
||||
|
||||
+234
-171
@@ -43,13 +43,19 @@
|
||||
|
||||
INCLUDE (FindPackageHandleStandardArgs)
|
||||
|
||||
IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
|
||||
SET (_TBB_CHECK_COMPONENTS FALSE)
|
||||
ELSE (CMAKE_VERSION VERSION_GREATER 2.8.7)
|
||||
SET (_TBB_CHECK_COMPONENTS TRUE)
|
||||
ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.7)
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# Paths
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
FIND_PATH (TBB_ROOT_DIR
|
||||
IF(CMAKE_VERSION VERSION_GREATER 2.8.7)
|
||||
SET(_TBB_CHECK_COMPONENTS ON)
|
||||
ELSE()
|
||||
SET(_TBB_CHECK_COMPONENTS OFF)
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(TBB_ROOT_DIR
|
||||
NAMES include/tbb/tbb.h
|
||||
PATHS ENV TBBROOT
|
||||
ENV TBB40_INSTALL_DIR
|
||||
@@ -59,229 +65,286 @@ FIND_PATH (TBB_ROOT_DIR
|
||||
ENV TBB_ROOT_DIR
|
||||
DOC "TBB root directory")
|
||||
|
||||
FIND_PATH (TBB_INCLUDE_DIR
|
||||
FIND_PATH(TBB_INCLUDE_DIR
|
||||
NAMES tbb/tbb.h
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "TBB include directory")
|
||||
|
||||
IF (MSVC11)
|
||||
SET (_TBB_COMPILER vc11)
|
||||
ELSEIF (MSVC10)
|
||||
SET (_TBB_COMPILER vc10)
|
||||
ELSEIF (MSVC90)
|
||||
SET (_TBB_COMPILER vc9)
|
||||
ELSEIF (MSVC80)
|
||||
SET (_TBB_COMPILER vc8)
|
||||
ELSEIF (WIN32)
|
||||
SET (_TBB_COMPILER vc_mt)
|
||||
ENDIF (MSVC11)
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# Library suffixes
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/${_TBB_COMPILER})
|
||||
SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/intel64/${_TBB_COMPILER})
|
||||
ELSE (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/${_TBB_COMPILER})
|
||||
SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/ia32/${_TBB_COMPILER})
|
||||
ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
IF(MSVC11)
|
||||
SET(_TBB_COMPILER vc11)
|
||||
ELSEIF(MSVC10)
|
||||
SET(_TBB_COMPILER vc10)
|
||||
ELSEIF(MSVC90)
|
||||
SET(_TBB_COMPILER vc9)
|
||||
ELSEIF(MSVC80)
|
||||
SET(_TBB_COMPILER vc8)
|
||||
ELSEIF(WIN32)
|
||||
SET(_TBB_COMPILER vc_mt)
|
||||
ENDIF(MSVC11)
|
||||
|
||||
LIST (APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/$ENV{TBB_ARCH_PLATFORM})
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(_TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/${_TBB_COMPILER})
|
||||
SET(_TBB_POSSIBLE_BIN_SUFFIXES bin/intel64/${_TBB_COMPILER})
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(_TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/${_TBB_COMPILER})
|
||||
SET(_TBB_POSSIBLE_BIN_SUFFIXES bin/ia32/${_TBB_COMPILER})
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
|
||||
FIND_LIBRARY (TBB_LIBRARY_RELEASE
|
||||
LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/$ENV{TBB_ARCH_PLATFORM})
|
||||
|
||||
IF(UNIX)
|
||||
FOREACH(_VERSION 4.7 4.4 4.1)
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/gcc${_VERSION})
|
||||
ELSE()
|
||||
LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/gcc${_VERSION})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# TBB library
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
FIND_LIBRARY(TBB_LIBRARY_RELEASE
|
||||
NAMES tbb
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB release library")
|
||||
|
||||
FIND_LIBRARY (TBB_LIBRARY_DEBUG
|
||||
FIND_LIBRARY(TBB_LIBRARY_DEBUG
|
||||
NAMES tbb_debug
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB debug library")
|
||||
|
||||
IF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
|
||||
IF (NOT TBB_LIBRARY)
|
||||
SET (TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG}
|
||||
CACHE DOC "TBB library" FORCE)
|
||||
ENDIF (NOT TBB_LIBRARY)
|
||||
ELSEIF (TBB_LIBRARY_RELEASE)
|
||||
IF (NOT TBB_LIBRARY)
|
||||
SET (TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE DOC "TBB library" FORCE)
|
||||
ENDIF (NOT TBB_LIBRARY)
|
||||
ENDIF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
|
||||
IF(TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
|
||||
IF(NOT TBB_LIBRARY)
|
||||
SET(TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG}
|
||||
CACHE DOC "TBB library" FORCE)
|
||||
ENDIF(NOT TBB_LIBRARY)
|
||||
LIST(APPEND _TBB_ALL_LIBS optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG})
|
||||
ELSE()
|
||||
IF(TBB_LIBRARY_DEBUG)
|
||||
IF(NOT TBB_LIBRARY)
|
||||
SET(TBB_LIBRARY ${TBB_LIBRARY_DEBUG} CACHE FILEPATH "TBB library" FORCE)
|
||||
ENDIF(NOT TBB_LIBRARY)
|
||||
LIST(APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_DEBUG})
|
||||
ENDIF(TBB_LIBRARY_DEBUG)
|
||||
|
||||
IF (TBB_LIBRARY_DEBUG)
|
||||
LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_DEBUG})
|
||||
ENDIF (TBB_LIBRARY_DEBUG)
|
||||
IF(TBB_LIBRARY_RELEASE)
|
||||
IF(NOT TBB_LIBRARY)
|
||||
SET(TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE FILEPATH "TBB library" FORCE)
|
||||
ENDIF(NOT TBB_LIBRARY)
|
||||
LIST(APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_RELEASE})
|
||||
ENDIF()
|
||||
ENDIF(TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
|
||||
|
||||
IF (TBB_LIBRARY_RELEASE)
|
||||
LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_RELEASE})
|
||||
ENDIF (TBB_LIBRARY_RELEASE)
|
||||
|
||||
FOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
|
||||
STRING (TOUPPER ${_TBB_COMPONENT} _TBB_COMPONENT_UPPER)
|
||||
SET (_TBB_LIBRARY_BASE TBB_${_TBB_COMPONENT_UPPER}_LIBRARY)
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# Components
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
IF (${_TBB_COMPONENT} STREQUAL preview)
|
||||
SET (_TBB_LIBRARY_NAME tbb_${_TBB_COMPONENT})
|
||||
ELSE (${_TBB_COMPONENT} STREQUAL preview)
|
||||
SET (_TBB_LIBRARY_NAME tbb${_TBB_COMPONENT})
|
||||
message(STATUS " FindTBB.cmake: Trying to find component " ${_TBB_COMPONENT} " using name " ${_TBB_LIBRARY_NAME} " " )
|
||||
ENDIF (${_TBB_COMPONENT} STREQUAL preview)
|
||||
SET(_TBB_POSSIBLE_COMPONENTS preview malloc malloc_proxy)
|
||||
|
||||
FIND_LIBRARY (${_TBB_LIBRARY_BASE}_RELEASE
|
||||
NAMES ${_TBB_LIBRARY_NAME}
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB ${_TBB_COMPONENT} release library")
|
||||
FOREACH(_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
|
||||
|
||||
FIND_LIBRARY (${_TBB_LIBRARY_BASE}_DEBUG
|
||||
NAMES ${_TBB_LIBRARY_NAME}_debug
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB ${_TBB_COMPONENT} debug library")
|
||||
STRING(REPLACE "_debug" "" _TBB_COMPONENT ${_TBB_COMPONENT})
|
||||
STRING(TOUPPER ${_TBB_COMPONENT} _TBB_COMPONENT_UPPER)
|
||||
SET(_TBB_LIBRARY_BASE TBB_${_TBB_COMPONENT_UPPER}_LIBRARY)
|
||||
|
||||
MARK_AS_ADVANCED (${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
IF(${_TBB_COMPONENT} MATCHES "malloc*")
|
||||
SET(_TBB_LIBRARY_NAME tbb${_TBB_COMPONENT})
|
||||
ELSE()
|
||||
SET(_TBB_LIBRARY_NAME tbb_${_TBB_COMPONENT})
|
||||
ENDIF()
|
||||
|
||||
SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND TRUE)
|
||||
FIND_LIBRARY(${_TBB_LIBRARY_BASE}_RELEASE
|
||||
NAMES ${_TBB_LIBRARY_NAME}
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB ${_TBB_COMPONENT} release library")
|
||||
|
||||
IF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
SET (${_TBB_LIBRARY_BASE}
|
||||
debug ${${_TBB_LIBRARY_BASE}_DEBUG}
|
||||
optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE DOC
|
||||
"TBB ${_TBB_COMPONENT} library")
|
||||
ELSEIF (${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
ELSEIF (${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE}
|
||||
CACHE DOC "TBB ${_TBB_COMPONENT} library")
|
||||
ELSE (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
# Component missing: record it for a later report
|
||||
LIST (APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT})
|
||||
SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND FALSE)
|
||||
ENDIF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
FIND_LIBRARY(${_TBB_LIBRARY_BASE}_DEBUG
|
||||
NAMES ${_TBB_LIBRARY_NAME}_debug
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "TBB ${_TBB_COMPONENT} debug library")
|
||||
|
||||
IF (${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
ENDIF (${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
MARK_AS_ADVANCED (${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
|
||||
IF (${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_RELEASE})
|
||||
ENDIF (${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
# default assumption
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_FOUND ON)
|
||||
SET(TBB_${_TBB_COMPONENT}_FOUND ON)
|
||||
|
||||
SET (TBB_${_TBB_COMPONENT}_FOUND ${TBB_${_TBB_COMPONENT_UPPER}_FOUND})
|
||||
IF(${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
SET(${_TBB_LIBRARY_BASE}
|
||||
debug ${${_TBB_LIBRARY_BASE}_DEBUG}
|
||||
optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE STRING
|
||||
"TBB ${_TBB_COMPONENT} library")
|
||||
LIST(APPEND _TBB_ALL_LIBS
|
||||
optimized ${${_TBB_LIBRARY_BASE}_RELEASE}
|
||||
debug ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_debug)
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_RELEASE})
|
||||
ELSEIF(${_TBB_LIBRARY_BASE}_DEBUG)
|
||||
SET(${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
LIST(APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE})
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_DEBUG})
|
||||
ELSEIF(${_TBB_LIBRARY_BASE}_RELEASE)
|
||||
SET(${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE}
|
||||
CACHE FILEPATH "TBB ${_TBB_COMPONENT} library")
|
||||
LIST(APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_RELEASE})
|
||||
LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE}_debug)
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_RELEASE})
|
||||
ELSE()
|
||||
# Component missing: record it for a later report
|
||||
LIST(APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT})
|
||||
SET(TBB_${_TBB_COMPONENT}_FOUND OFF)
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_FOUND OFF)
|
||||
ENDIF()
|
||||
|
||||
IF (${_TBB_LIBRARY_BASE})
|
||||
# setup the TBB_<COMPONENT>_LIBRARIES variable
|
||||
SET (TBB_${_TBB_COMPONENT_UPPER}_LIBRARIES ${${_TBB_LIBRARY_BASE}})
|
||||
LIST (APPEND TBB_LIBRARIES ${${_TBB_LIBRARY_BASE}})
|
||||
ELSE (${_TBB_LIBRARY_BASE})
|
||||
LIST (APPEND _TBB_MISSING_LIBRARIES ${_TBB_LIBRARY_BASE})
|
||||
ENDIF (${_TBB_LIBRARY_BASE})
|
||||
ENDFOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
|
||||
IF(${_TBB_LIBRARY_BASE})
|
||||
# setup the TBB_<COMPONENT>_LIBRARIES variable
|
||||
SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARIES ${${_TBB_LIBRARY_BASE}})
|
||||
ELSE()
|
||||
LIST(APPEND _TBB_MISSING_LIBRARIES ${_TBB_LIBRARY_BASE})
|
||||
ENDIF()
|
||||
|
||||
LIST (APPEND TBB_LIBRARIES ${TBB_LIBRARY})
|
||||
SET (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
|
||||
ENDFOREACH(_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
|
||||
|
||||
IF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
|
||||
IF (NOT TBB_FIND_QUIETLY)
|
||||
MESSAGE (STATUS "One or more TBB components were not found:")
|
||||
# Display missing components indented, each on a separate line
|
||||
FOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
|
||||
MESSAGE (STATUS " " ${_TBB_MISSING_COMPONENT})
|
||||
ENDFOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
|
||||
ENDIF (NOT TBB_FIND_QUIETLY)
|
||||
ENDIF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# Standard variables
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
IF(_TBB_ALL_LIBS)
|
||||
SET(TBB_LIBRARIES ${_TBB_ALL_LIBS})
|
||||
ENDIF()
|
||||
|
||||
# Determine library's version
|
||||
IF(TBB_INCLUDE_DIR)
|
||||
SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET (_TBB_VERSION_HEADER ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h)
|
||||
IF(DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
|
||||
IF(NOT TBB_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "One or more TBB components were not found:")
|
||||
# Display missing components indented, each on a separate line
|
||||
FOREACH(_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
|
||||
MESSAGE(STATUS " " ${_TBB_MISSING_COMPONENT})
|
||||
ENDFOREACH(_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
|
||||
ENDIF(NOT TBB_FIND_QUIETLY)
|
||||
ENDIF(DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
|
||||
|
||||
IF (EXISTS ${_TBB_VERSION_HEADER})
|
||||
FILE (READ ${_TBB_VERSION_HEADER} _TBB_VERSION_CONTENTS)
|
||||
#------------------------------------------------------------------------------#
|
||||
#
|
||||
# Library's version
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
STRING (REGEX REPLACE ".*#define TBB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
|
||||
TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}")
|
||||
STRING (REGEX REPLACE ".*#define TBB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
|
||||
TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}")
|
||||
SET(_TBB_VERSION_HEADER ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h)
|
||||
|
||||
SET (TBB_VERSION ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR})
|
||||
SET (TBB_VERSION_COMPONENTS 2)
|
||||
ENDIF (EXISTS ${_TBB_VERSION_HEADER})
|
||||
IF(EXISTS ${_TBB_VERSION_HEADER})
|
||||
FILE(READ ${_TBB_VERSION_HEADER} _TBB_VERSION_CONTENTS)
|
||||
|
||||
IF (WIN32)
|
||||
FIND_PROGRAM (LIB_EXECUTABLE NAMES lib
|
||||
HINTS "$ENV{VS110COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS100COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS90COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS71COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS80COMNTOOLS}/../../VC/bin"
|
||||
DOC "Library manager")
|
||||
STRING(REGEX REPLACE ".*#define TBB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
|
||||
TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}")
|
||||
STRING(REGEX REPLACE ".*#define TBB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
|
||||
TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}")
|
||||
|
||||
MARK_AS_ADVANCED (LIB_EXECUTABLE)
|
||||
ENDIF (WIN32)
|
||||
SET(TBB_VERSION ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR})
|
||||
SET(TBB_VERSION_COMPONENTS 2)
|
||||
ENDIF()
|
||||
|
||||
MACRO (GET_LIB_REQUISITES LIB REQUISITES)
|
||||
IF (LIB_EXECUTABLE)
|
||||
GET_FILENAME_COMPONENT (_LIB_PATH ${LIB_EXECUTABLE} PATH)
|
||||
IF(WIN32)
|
||||
FIND_PROGRAM(LIB_EXECUTABLE NAMES lib
|
||||
HINTS
|
||||
"$ENV{VS110COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS100COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS90COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS71COMNTOOLS}/../../VC/bin"
|
||||
"$ENV{VS80COMNTOOLS}/../../VC/bin"
|
||||
DOC "Library manager")
|
||||
|
||||
IF (MSVC)
|
||||
MARK_AS_ADVANCED (LIB_EXECUTABLE)
|
||||
ENDIF()
|
||||
|
||||
MACRO(GET_LIB_REQUISITES LIB REQUISITES)
|
||||
IF(LIB_EXECUTABLE)
|
||||
GET_FILENAME_COMPONENT(_LIB_PATH ${LIB_EXECUTABLE} PATH)
|
||||
|
||||
IF(MSVC)
|
||||
# Do not redirect the output
|
||||
UNSET (ENV{VS_UNICODE_OUTPUT})
|
||||
ENDIF (MSVC)
|
||||
UNSET(ENV{VS_UNICODE_OUTPUT})
|
||||
ENDIF()
|
||||
|
||||
EXECUTE_PROCESS (COMMAND ${LIB_EXECUTABLE} /nologo /list ${LIB}
|
||||
EXECUTE_PROCESS(COMMAND ${LIB_EXECUTABLE} /nologo /list ${LIB}
|
||||
WORKING_DIRECTORY ${_LIB_PATH}/../../Common7/IDE
|
||||
OUTPUT_VARIABLE _LIB_OUTPUT ERROR_QUIET)
|
||||
|
||||
STRING (REPLACE "\n" ";" "${REQUISITES}" "${_LIB_OUTPUT}")
|
||||
LIST (REMOVE_DUPLICATES ${REQUISITES})
|
||||
ENDIF (LIB_EXECUTABLE)
|
||||
ENDMACRO (GET_LIB_REQUISITES)
|
||||
STRING(REPLACE "\n" ";" "${REQUISITES}" "${_LIB_OUTPUT}")
|
||||
LIST(REMOVE_DUPLICATES ${REQUISITES})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF (_TBB_ALL_LIBS)
|
||||
# collect lib requisites using the lib tool
|
||||
FOREACH (_TBB_COMPONENT ${_TBB_ALL_LIBS})
|
||||
GET_LIB_REQUISITES (${_TBB_COMPONENT} _TBB_REQUISITES)
|
||||
ENDFOREACH (_TBB_COMPONENT)
|
||||
ENDIF (_TBB_ALL_LIBS)
|
||||
IF(_TBB_ALL_LIBS)
|
||||
# collect lib requisites using the lib tool
|
||||
FOREACH(_TBB_COMPONENT ${_TBB_ALL_LIBS})
|
||||
GET_LIB_REQUISITES(${_TBB_COMPONENT} _TBB_REQUISITES)
|
||||
ENDFOREACH(_TBB_COMPONENT)
|
||||
ENDIF()
|
||||
|
||||
IF (NOT TBB_BINARY_DIR)
|
||||
SET (_TBB_UPDATE_BINARY_DIR TRUE)
|
||||
ELSE (NOT TBB_BINARY_DIR)
|
||||
SET (_TBB_UPDATE_BINARY_DIR FALSE)
|
||||
ENDIF (NOT TBB_BINARY_DIR)
|
||||
IF(NOT TBB_BINARY_DIR)
|
||||
SET(_TBB_UPDATE_BINARY_DIR ON)
|
||||
ELSE()
|
||||
SET(_TBB_UPDATE_BINARY_DIR OFF)
|
||||
ENDIF()
|
||||
|
||||
SET (_TBB_BINARY_DIR_HINTS ${_TBB_POSSIBLE_BIN_SUFFIXES})
|
||||
SET(_TBB_BINARY_DIR_HINTS ${_TBB_POSSIBLE_BIN_SUFFIXES})
|
||||
|
||||
IF (_TBB_REQUISITES)
|
||||
FIND_FILE (TBB_BINARY_DIR NAMES ${_TBB_REQUISITES}
|
||||
IF(_TBB_REQUISITES)
|
||||
FIND_FILE(TBB_BINARY_DIR NAMES ${_TBB_REQUISITES}
|
||||
HINTS ${TBB_ROOT_DIR}
|
||||
PATH_SUFFIXES ${_TBB_BINARY_DIR_HINTS} NO_DEFAULT_PATH)
|
||||
ENDIF (_TBB_REQUISITES)
|
||||
ENDIF()
|
||||
|
||||
IF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
|
||||
SET (_TBB_BINARY_DIR ${TBB_BINARY_DIR})
|
||||
UNSET (TBB_BINARY_DIR CACHE)
|
||||
IF(TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
|
||||
SET(_TBB_BINARY_DIR ${TBB_BINARY_DIR})
|
||||
UNSET(TBB_BINARY_DIR CACHE)
|
||||
|
||||
IF (_TBB_BINARY_DIR)
|
||||
GET_FILENAME_COMPONENT (TBB_BINARY_DIR ${_TBB_BINARY_DIR} PATH)
|
||||
ENDIF (_TBB_BINARY_DIR)
|
||||
ENDIF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
|
||||
IF(_TBB_BINARY_DIR)
|
||||
GET_FILENAME_COMPONENT(TBB_BINARY_DIR ${_TBB_BINARY_DIR} PATH)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET (TBB_BINARY_DIR ${TBB_BINARY_DIR} CACHE PATH "TBB binary directory")
|
||||
SET(TBB_BINARY_DIR ${TBB_BINARY_DIR} CACHE PATH "TBB binary directory")
|
||||
|
||||
MARK_AS_ADVANCED (TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_RELEASE
|
||||
MARK_AS_ADVANCED(TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_RELEASE
|
||||
TBB_LIBRARY_DEBUG TBB_BINARY_DIR)
|
||||
|
||||
IF (NOT _TBB_CHECK_COMPONENTS)
|
||||
SET (_TBB_FPHSA_ADDITIONAL_ARGS HANDLE_COMPONENTS)
|
||||
ENDIF (NOT _TBB_CHECK_COMPONENTS)
|
||||
IF(NOT _TBB_CHECK_COMPONENTS)
|
||||
SET(_TBB_FPHSA_ADDITIONAL_ARGS HANDLE_COMPONENTS)
|
||||
ENDIF()
|
||||
|
||||
IF (CMAKE_VERSION VERSION_GREATER 2.8.2)
|
||||
LIST (APPEND _TBB_FPHSA_ADDITIONAL_ARGS VERSION_VAR TBB_VERSION)
|
||||
ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.2)
|
||||
LIST(APPEND _TBB_FPHSA_ADDITIONAL_ARGS VERSION_VAR TBB_VERSION)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS (TBB REQUIRED_VARS TBB_ROOT_DIR
|
||||
TBB_INCLUDE_DIR TBB_LIBRARY ${_TBB_MISSING_LIBRARIES}
|
||||
${_TBB_FPHSA_ADDITIONAL_ARGS})
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB
|
||||
REQUIRED_VARS
|
||||
TBB_ROOT_DIR
|
||||
TBB_INCLUDE_DIR
|
||||
TBB_LIBRARY
|
||||
${_TBB_MISSING_LIBRARIES}
|
||||
HANDLE_COMPONENTS
|
||||
${_TBB_FPHSA_ADDITIONAL_ARGS})
|
||||
|
||||
@@ -23,7 +23,7 @@ Result Variables
|
||||
This module sets the following variables:
|
||||
|
||||
``XQuartzGL_FOUND``
|
||||
True, if the XQuartz GL/GLU libraries were located
|
||||
True, if the XQuartz GL libraries were located
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
@@ -72,7 +72,6 @@ find_package_handle_standard_args(XQuartzGL
|
||||
REQUIRED_VARS
|
||||
XQuartzGL_INCLUDE_DIR
|
||||
XQuartzGL_gl_LIBRARY
|
||||
XQuartzGL_glu_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRARY)
|
||||
@@ -86,7 +85,7 @@ if(XQuartzGL_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET XQuartzGL::GLU)
|
||||
if(NOT TARGET XQuartzGL::GLU AND XQuartzGL_glu_LIBRARY)
|
||||
add_library(XQuartzGL::GLU UNKNOWN IMPORTED)
|
||||
set_target_properties(XQuartzGL::GLU PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Geant4 libraries and tests,
|
||||
#
|
||||
# In addition to the core compiler/linker flags (configured in the
|
||||
# Geant4MakeRules_<LANG>.cmake files) for Geant4, the build may require
|
||||
# G4MakeRules_<LANG>.cmake files) for Geant4, the build may require
|
||||
# further configuration. This module performs this task whicj includes:
|
||||
#
|
||||
# 1) Extra build modes for developers
|
||||
@@ -273,8 +273,6 @@ if(GEANT4_BUILD_MULTITHREADED)
|
||||
set(GEANT4_MULTITHREADED_CXX_FLAGS "${GEANT4_MULTITHREADED_CXX_FLAGS} ${${GEANT4_BUILD_TLS_MODEL}_TLSMODEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
# Set Defs/Compiler Flags
|
||||
# TODO: Migrate def to header
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
@@ -424,5 +422,3 @@ foreach(_conftype ${CMAKE_CONFIGURATION_TYPES})
|
||||
"${BASE_OUTPUT_DIRECTORY}/${_conftype}/${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
|
||||
|
||||
@@ -56,19 +56,18 @@ include(G4BuildSettings)
|
||||
include(G4DeveloperAPI)
|
||||
|
||||
# - Provide interface to control use of optional components
|
||||
include(Geant4OptionalComponents)
|
||||
include(G4OptionalComponents)
|
||||
|
||||
# - Provide interface to control use of UI/Vis components
|
||||
# Written in a separate module from other optional components because
|
||||
# there are many complex options to handle.
|
||||
include(Geant4InterfaceOptions)
|
||||
include(G4InterfaceOptions)
|
||||
|
||||
# - Installation of optional read-only architecture independent data files.
|
||||
include(Geant4InstallData)
|
||||
include(G4InstallData)
|
||||
|
||||
# - Include testing up front so both source and environments can use it if required
|
||||
include(Geant4CTest)
|
||||
|
||||
include(G4CTest)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Add the source and environments subdirectories
|
||||
@@ -95,8 +94,6 @@ endif()
|
||||
# these tasks can be performed.
|
||||
#
|
||||
# - Generate any Use/Config/Support files here once everything else has
|
||||
# been processed e.g. "UseGeant4.cmake", "Geant4Config.cmake", library
|
||||
# dependencies etc.
|
||||
# - Geant4Make.gmk
|
||||
include(G4ConfigureGNUMakeHelpers)
|
||||
|
||||
@@ -110,7 +107,9 @@ include(G4ConfigureCMakeHelpers)
|
||||
# - Testing configuration.
|
||||
# Done here, as projects under 'tests' require Geant4Config.
|
||||
if(GEANT4_ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/tests)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/benchmarks)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
@@ -137,11 +136,11 @@ endif()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# - CPack-aging
|
||||
include(Geant4CPackBase)
|
||||
include(G4CPack)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Final output - show what's been enabled so that user knows what's
|
||||
# happening - also useful for later problem solving!
|
||||
#
|
||||
GEANT4_PRINT_ENABLED_FEATURES()
|
||||
geant4_print_enabled_features()
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
# Integration and unit tests
|
||||
# - "ENABLE_TESTING" means all tests under tests/
|
||||
option(GEANT4_ENABLE_TESTING "Enable and define all the tests of the project" OFF)
|
||||
GEANT4_ADD_FEATURE(GEANT4_ENABLE_TESTING "Enable and define all the tests of the project")
|
||||
geant4_add_feature(GEANT4_ENABLE_TESTING "Enable and define all the tests of the project")
|
||||
mark_as_advanced(GEANT4_ENABLE_TESTING)
|
||||
|
||||
# - "BUILD_TESTS" means all 'tests' in individual categories.
|
||||
option(GEANT4_BUILD_TESTS "Build all the tests of the project" OFF)
|
||||
GEANT4_ADD_FEATURE(GEANT4_BUILD_TESTS "Build all the tests of the project")
|
||||
geant4_add_feature(GEANT4_BUILD_TESTS "Build all the tests of the project")
|
||||
mark_as_advanced(GEANT4_BUILD_TESTS)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -33,7 +33,7 @@ if(GEANT4_ENABLE_TESTING)
|
||||
endforeach()
|
||||
|
||||
# - Add base URL for test reference files
|
||||
set (GEANT4_TEST_REFERENCES_URL "http://cern.ch/geant4-data/stt/references/" CACHE
|
||||
set(GEANT4_TEST_REFERENCES_URL "http://cern.ch/geant4-data/stt/references/" CACHE
|
||||
STRING "base URL for test reference files")
|
||||
mark_as_advanced(GEANT4_TEST_REFERENCES_URL)
|
||||
|
||||
+138
-143
@@ -1,168 +1,163 @@
|
||||
################################################################################
|
||||
#.rst
|
||||
# G4ClangFormat
|
||||
# =============
|
||||
#
|
||||
# Creates a 'format' target that runs clang-format
|
||||
#
|
||||
################################################################################
|
||||
# Functions and helper targets for formatting sources of a target using
|
||||
# clang-format
|
||||
|
||||
# - Include guard
|
||||
if(NOT __G4CLANGFORMAT_INCLUDED)
|
||||
set(__G4CLANGFORMAT_INCLUDED 1)
|
||||
set(__G4CLANGFORMAT_INCLUDED 1)
|
||||
else()
|
||||
return()
|
||||
return()
|
||||
endif()
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
# Default logging directory
|
||||
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)
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Find clang-format (optional)
|
||||
find_program(CLANG_FORMATTER NAMES
|
||||
clang-format-6 # prefer clang-format version 6.0
|
||||
clang-format-6.0
|
||||
clang-format-mp-6.0 # Apple macports version
|
||||
clang-format)
|
||||
|
||||
function(exclude_from_format)
|
||||
cmake_parse_arguments(ARG
|
||||
"" "" "HEADERS;SOURCES;FILES" ${ARGN})
|
||||
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})
|
||||
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()
|
||||
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()
|
||||
if(NOT CLANG_FORMATTER)
|
||||
return()
|
||||
endif()
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
cmake_parse_arguments(G4FMTTARGET "" "NAME" "SOURCES" ${ARGN})
|
||||
string(REGEX REPLACE "-format$" "" G4TARGET_NAME "${G4FMTTARGET_NAME}")
|
||||
|
||||
# ensure not empty list
|
||||
if("${G4FMTTARGET_SOURCES}" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
endfunction()
|
||||
|
||||
@@ -63,7 +63,7 @@ set(GEANT4_THIRD_PARTY_IMPORT_SETUP )
|
||||
# Externals libraries that may be present
|
||||
set(GEANT4_EXTERNALS_TARGETS )
|
||||
|
||||
# - Stuff from Geant4OptionalComponents.cmake
|
||||
# - Stuff from G4OptionalComponents.cmake
|
||||
# - CLHEP
|
||||
# If it's internal, add it to the externals list
|
||||
if(NOT GEANT4_USE_SYSTEM_CLHEP)
|
||||
@@ -82,13 +82,20 @@ if(NOT GEANT4_USE_SYSTEM_ZLIB)
|
||||
list(APPEND GEANT4_EXTERNALS_TARGETS G4zlib)
|
||||
endif()
|
||||
|
||||
# - PTL
|
||||
# If it's internal, add it to the externals list
|
||||
if(NOT GEANT4_USE_SYSTEM_PTL)
|
||||
list(APPEND GEANT4_EXTERNALS_TARGETS G4ptl)
|
||||
set(PTL_BUILDTREE_PREFIX "${PROJECT_BINARY_DIR}/source/externals/ptl")
|
||||
set(PTL_INSTALLTREE_PREFIX "\${_geant4_thisdir}/../PTL")
|
||||
endif()
|
||||
|
||||
# - USolids
|
||||
# Compile definitions
|
||||
if(GEANT4_USE_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
|
||||
set(GEANT4_USE_USOLIDS_EITHER ON)
|
||||
endif()
|
||||
|
||||
# - Stuff from Geant4InterfaceOptions.cmake
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# - Common Build/Install Tree Configuration files
|
||||
@@ -124,7 +131,8 @@ 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}\")
|
||||
")
|
||||
|
||||
# Builtin PTL is self located
|
||||
set(PACKAGE_PTL_PREFIX "${PTL_BUILDTREE_PREFIX}")
|
||||
# Geant4 data used in build tree
|
||||
geant4_export_datasets(BUILD GEANT4_DATASET_DESCRIPTIONS)
|
||||
|
||||
@@ -238,7 +246,8 @@ else()
|
||||
get_filename_component(Geant4_INCLUDE_DIR \"\${_geant4_thisdir}/${GEANT4_RELATIVE_HEADER_PATH}\" ABSOLUTE)
|
||||
")
|
||||
endif()
|
||||
|
||||
# Builtin PTL is self located
|
||||
set(PACKAGE_PTL_PREFIX "${PTL_INSTALLTREE_PREFIX}")
|
||||
# Geant4 data used in install tree
|
||||
geant4_export_datasets(INSTALL GEANT4_DATASET_DESCRIPTIONS)
|
||||
|
||||
|
||||
@@ -507,6 +507,13 @@ macro(_g4tc_configure_tc_variables SHELL_FAMILY SCRIPT_NAME)
|
||||
_g4tc_setenv_command(GEANT4_TC_G4LIB_USE_ZLIB ${SHELL_FAMILY} G4LIB_USE_ZLIB 1)
|
||||
endif()
|
||||
|
||||
# - PTL...
|
||||
if(GEANT4_USE_SYSTEM_PTL)
|
||||
set(GEANT4_TC_G4LIB_USE_PTL "# USING SYSTEM PTL")
|
||||
else()
|
||||
_g4tc_setenv_command(GEANT4_TC_G4LIB_USE_PTL ${SHELL_FAMILY} G4LIB_USE_PTL 1)
|
||||
endif()
|
||||
|
||||
# - GDML...
|
||||
if(GEANT4_USE_GDML)
|
||||
_g4tc_setenv_command(GEANT4_TC_G4LIB_USE_GDML ${SHELL_FAMILY} G4LIB_USE_GDML 1)
|
||||
|
||||
@@ -167,12 +167,21 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
set(G4_BUILTWITH_ZLIB "yes")
|
||||
endif()
|
||||
|
||||
# - PTL
|
||||
if(GEANT4_USE_SYSTEM_PTL)
|
||||
set(G4_BUILTWITH_PTL "no")
|
||||
else()
|
||||
set(G4_BUILTWITH_PTL "yes")
|
||||
endif()
|
||||
|
||||
# - GDML
|
||||
if(GEANT4_USE_GDML)
|
||||
set(G4_BUILTWITH_GDML "yes")
|
||||
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})
|
||||
if(_cxx_compiler_dirs)
|
||||
list(REMOVE_ITEM G4_XERCESC_INCLUDE_DIRS ${_cxx_compiler_dirs})
|
||||
endif()
|
||||
|
||||
set(G4_XERCESC_CFLAGS )
|
||||
foreach(_dir ${G4_XERCESC_INCLUDE_DIRS})
|
||||
@@ -194,7 +203,9 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
set(G4_BUILTWITH_USOLIDS "yes")
|
||||
set(G4_USOLIDS_INCLUDE_DIRS "${USOLIDS_INCLUDE_DIRS} ${VECGEOM_EXTERNAL_INCLUDES}")
|
||||
list(REMOVE_DUPLICATES G4_USOLIDS_INCLUDE_DIRS)
|
||||
list(REMOVE_ITEM G4_USOLIDS_INCLUDE_DIRS ${_cxx_compiler_dirs})
|
||||
if(_cxx_compiler_dirs)
|
||||
list(REMOVE_ITEM G4_USOLIDS_INCLUDE_DIRS ${_cxx_compiler_dirs})
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " G4_USOLIDS_CFLAGS "${VECGEOM_DEFINITIONS}")
|
||||
foreach(_dir ${G4_USOLIDS_INCLUDE_DIRS})
|
||||
@@ -221,14 +232,12 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
# - Qt
|
||||
if(GEANT4_USE_QT)
|
||||
set(G4_BUILTWITH_QT "yes")
|
||||
if(QT4_FOUND)
|
||||
set(G4_QT_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR})
|
||||
else()
|
||||
set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS})
|
||||
endif()
|
||||
set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS})
|
||||
|
||||
list(REMOVE_DUPLICATES G4_QT_INCLUDE_DIRS)
|
||||
list(REMOVE_ITEM G4_QT_INCLUDE_DIRS ${_cxx_compiler_dirs})
|
||||
if(_cxx_compiler_dirs)
|
||||
list(REMOVE_ITEM G4_QT_INCLUDE_DIRS ${_cxx_compiler_dirs})
|
||||
endif()
|
||||
|
||||
set(G4_QT_CFLAGS )
|
||||
foreach(_dir ${G4_QT_INCLUDE_DIRS})
|
||||
@@ -289,7 +298,9 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
|
||||
if(G4_CONFIG_NEEDS_X11)
|
||||
set(_raw_x11_includes ${X11_INCLUDE_DIR})
|
||||
list(REMOVE_DUPLICATES _raw_x11_includes)
|
||||
list(REMOVE_ITEM _raw_x11_includes ${_cxx_compiler_dirs})
|
||||
if(_cxx_compiler_dirs)
|
||||
list(REMOVE_ITEM _raw_x11_includes ${_cxx_compiler_dirs})
|
||||
endif()
|
||||
set(G4_X11_CFLAGS )
|
||||
foreach(_p ${_raw_x11_includes})
|
||||
set(G4_X11_CFLAGS "-I${_p} ${G4_X11_CFLAGS}")
|
||||
|
||||
+2
-2
@@ -18,11 +18,11 @@ geant4_add_dataset(
|
||||
# - Low energy electromagnetics
|
||||
geant4_add_dataset(
|
||||
NAME G4EMLOW
|
||||
VERSION 7.9.1
|
||||
VERSION 7.12
|
||||
FILENAME G4EMLOW
|
||||
EXTENSION tar.gz
|
||||
ENVVAR G4LEDATA
|
||||
MD5SUM 1308dc5d73b5539557e2ec6b96f7e5ef
|
||||
MD5SUM 0d3d46eeb7420f2b996242fec756ee52
|
||||
)
|
||||
|
||||
# - Photon evaporation
|
||||
@@ -9,9 +9,6 @@
|
||||
# CMake functions and macros for declaring and working with build
|
||||
# products of Geant4.
|
||||
#
|
||||
# WIP: At present, this simply forwards to the old implementation
|
||||
# Eventually will allow switch between the old and the new,
|
||||
# then just the new once transition complete.
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# License and Disclaimer
|
||||
@@ -44,4 +41,965 @@ else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(G4DeveloperAPI_OLD)
|
||||
# Whilst we test, allow switching between old and new implementations
|
||||
option(GEANT4_USE_NEW_CMAKE "Use new CMake module/library implementation" ON)
|
||||
mark_as_advanced(GEANT4_USE_NEW_CMAKE)
|
||||
|
||||
if(NOT GEANT4_USE_NEW_CMAKE)
|
||||
include(G4DeveloperAPI_OLD)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Needed modules
|
||||
include(G4ClangFormat)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Module Commands
|
||||
# ^^^^^^^^^^^^^^^
|
||||
#
|
||||
# .. cmake:command:: geant4_add_module
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_add_module(<name>
|
||||
# PUBLIC_HEADERS header1 [header2 ...]
|
||||
# [SOURCES source1 [source2 ...]])
|
||||
#
|
||||
# Add a Geant4 module called ``<name>`` to the project, composed
|
||||
# of the source files listed in the ``PUBLIC_HEADERS`` and ``SOURCES``
|
||||
# arguments. The ``<name>`` must be unique within the project.
|
||||
# The directory in which the module is added (i.e. ``CMAKE_CURRENT_LIST_DIR``
|
||||
# for the CMake script in which ``geant4_add_module`` is called) must contain:
|
||||
#
|
||||
# * An ``include`` subdirectory for the public headers
|
||||
# * A ``src`` subdirectory for source files if the module provides these
|
||||
#
|
||||
# The ``PUBLIC_HEADERS`` argument must list the headers comprising the
|
||||
# public interface of the module. If a header is supplied as a relative path,
|
||||
# this is interpreted as being relative to the ``include`` subdirectory of the module.
|
||||
# Absolute paths may also be supplied, e.g. if headers are generated by the project.
|
||||
#
|
||||
# The ``SOURCES`` argument should list any source files for the module.
|
||||
# If a source is is supplied as a relative path, this is interpreted as being
|
||||
# relative to the ``src`` subdirectory of the module. Absolute paths may
|
||||
# also be supplied, e.g. if sources are generated by the project.
|
||||
#
|
||||
function(geant4_add_module _name)
|
||||
__geant4_module_assert_not_exists(${_name})
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_DEFINED_MODULES ${_name})
|
||||
cmake_parse_arguments(G4ADDMOD
|
||||
""
|
||||
""
|
||||
"PUBLIC_HEADERS;SOURCES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# - Check required directory structure at definition point
|
||||
# Headers always
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||
message(FATAL_ERROR "Missing required 'include' subdirectory for module '${_name}' at '${CMAKE_CURRENT_LIST_DIR}'")
|
||||
endif()
|
||||
|
||||
# Sources if defined
|
||||
if(G4ADDMOD_SOURCES AND (NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/src"))
|
||||
message(FATAL_ERROR "Missing required 'src' subdirectory for module '${_name}' at '${CMAKE_CURRENT_LIST_DIR}'")
|
||||
endif()
|
||||
|
||||
# Compose header/source lists
|
||||
set(__tmp_HEADERS)
|
||||
foreach(__elem ${G4ADDMOD_PUBLIC_HEADERS})
|
||||
if(IS_ABSOLUTE "${__elem}")
|
||||
list(APPEND __tmp_HEADERS "${__elem}")
|
||||
else()
|
||||
list(APPEND __tmp_HEADERS "${CMAKE_CURRENT_LIST_DIR}/include/${__elem}")
|
||||
endif()
|
||||
endforeach()
|
||||
geant4_set_module_property(${_name} PROPERTY PUBLIC_HEADERS ${__tmp_HEADERS})
|
||||
|
||||
set(__tmp_SOURCES)
|
||||
foreach(__elem ${G4ADDMOD_SOURCES})
|
||||
if(IS_ABSOLUTE "${__elem}")
|
||||
list(APPEND __tmp_SOURCES "${__elem}")
|
||||
else()
|
||||
list(APPEND __tmp_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/${__elem}")
|
||||
endif()
|
||||
endforeach()
|
||||
geant4_set_module_property(${_name} PROPERTY SOURCES ${__tmp_SOURCES})
|
||||
|
||||
# Set the default include directory for this module
|
||||
geant4_module_include_directories(${_name} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
|
||||
|
||||
# Backward compatibility shim for direct usage of build directory
|
||||
# Not all clients (esp. those using ROOT) may not fully support usage requirements
|
||||
# and expect GEANT4_INCLUDE_DIRS to be complete
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||
|
||||
# Record where we're defined so we can pop the file into IDEs
|
||||
geant4_set_module_property(${_name} PROPERTY CMAKE_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_module_include_directories
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_module_include_directories(<module>
|
||||
# [PUBLIC pub1 [pub2 ...]
|
||||
# [PRIVATE pri1 [pri2 ...]
|
||||
# [INTERFACE int1 [int2 ...])
|
||||
#
|
||||
# Add include directories to given module.
|
||||
#
|
||||
function(geant4_module_include_directories _module)
|
||||
__geant4_module_assert_exists(${_module})
|
||||
cmake_parse_arguments(G4MODINCDIR
|
||||
""
|
||||
""
|
||||
"PUBLIC;PRIVATE;INTERFACE"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
foreach(_dir ${G4MODINCDIR_PUBLIC})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_dir})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INCLUDE_DIRECTORIES ${_dir})
|
||||
endforeach()
|
||||
|
||||
foreach(_dir ${G4MODINCDIR_PRIVATE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INCLUDE_DIRECTORIES ${_dir})
|
||||
endforeach()
|
||||
|
||||
foreach(_dir ${G4MODINCDIR_INTERFACE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_dir})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_module_link_libraries
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_module_link_libraries(<module>
|
||||
# [PUBLIC pub1 [pub2 ...]
|
||||
# [PRIVATE pri1 [pri2 ...]
|
||||
# [INTERFACE int1 [int2 ...])
|
||||
#
|
||||
# Link ``<module>`` to given targets.
|
||||
#
|
||||
function(geant4_module_link_libraries _module)
|
||||
__geant4_module_assert_exists(${_module})
|
||||
cmake_parse_arguments(G4MODLINKLIB
|
||||
""
|
||||
""
|
||||
"PUBLIC;PRIVATE;INTERFACE"
|
||||
${ARGN}
|
||||
)
|
||||
foreach(_lib ${G4MODLINKLIB_PUBLIC})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_lib})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY LINK_LIBRARIES ${_lib})
|
||||
endforeach()
|
||||
|
||||
foreach(_lib ${G4MODLINKLIB_PRIVATE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY LINK_LIBRARIES ${_lib})
|
||||
endforeach()
|
||||
|
||||
foreach(_dir ${G4MODLINKLIB_INTERFACE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_lib})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_module_compile_definitions
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_module_compile_definitions(<module>
|
||||
# [PUBLIC pub1 [pub2 ...]
|
||||
# [PRIVATE pri1 [pri2 ...]
|
||||
# [INTERFACE int1 [int2 ...])
|
||||
#
|
||||
# Add compile definitions for this module
|
||||
#
|
||||
# Use cases:
|
||||
# 1. workarounds when a config header isn't suitable
|
||||
#
|
||||
# Needs care with DLLs if used for import/export declspecs
|
||||
# Application of specific defs to single files not considered
|
||||
# Expected that uses cases here minimal, and developers should
|
||||
# in that case use set_source_files_properties or similar
|
||||
# directly.
|
||||
#
|
||||
function(geant4_module_compile_definitions _module)
|
||||
__geant4_module_assert_exists(${_module})
|
||||
cmake_parse_arguments(G4MODCOMPILEDEF
|
||||
""
|
||||
""
|
||||
"PUBLIC;PRIVATE;INTERFACE"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
foreach(_lib ${G4MODCOMPILEDEF_PUBLIC})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS ${_lib})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY COMPILE_DEFINITIONS ${_lib})
|
||||
endforeach()
|
||||
|
||||
foreach(_lib ${G4MODCOMPILEDEF_PRIVATE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY COMPILE_DEFINITIONS ${_lib})
|
||||
endforeach()
|
||||
|
||||
foreach(_dir ${G4MODCOMPILEDEF_INTERFACE})
|
||||
geant4_set_module_property(${_module} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS ${_lib})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_get_modules
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_get_modules(<result>)
|
||||
#
|
||||
# Store the list of currently defined modules in the variable ``<result>``.
|
||||
#
|
||||
function(geant4_get_modules _result)
|
||||
get_property(__tmp GLOBAL PROPERTY GEANT4_DEFINED_MODULES)
|
||||
set(${_result} ${__tmp} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_has_module
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_has_module(<result> <name>)
|
||||
#
|
||||
# Set variable ``<result>`` to a boolean which will be true if the module
|
||||
# ``<name>`` is defined.
|
||||
#
|
||||
function(geant4_has_module _result _name)
|
||||
set(__exists FALSE)
|
||||
|
||||
geant4_get_modules(__tmp)
|
||||
if(__tmp)
|
||||
list(FIND __tmp ${_name} __index)
|
||||
if(__index GREATER -1)
|
||||
set(__exists TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${_result} ${__exists} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Module Properties
|
||||
# =================
|
||||
#
|
||||
# A Geant4 module stores its build and usage requirements in a series
|
||||
# of properties:
|
||||
#
|
||||
# * ``PUBLIC_HEADERS``
|
||||
# * ``PRIVATE_HEADERS``
|
||||
# * ``SOURCES``
|
||||
# * ``INTERFACE_COMPILE_DEFINITIONS``
|
||||
# * ``COMPILE_DEFINITIONS``
|
||||
# * ``INTERFACE_INCLUDE_DIRECTORIES``
|
||||
# * ``INCLUDE_DIRECTORIES``
|
||||
# * ``INTERFACE_LINK_LIBRARIES``
|
||||
# * ``LINK_LIBRARIES``
|
||||
# * ``PARENT_TARGET``
|
||||
# * ``CMAKE_LIST_FILE``
|
||||
# * ``GLOBAL_DEPENDENCIES``
|
||||
#
|
||||
# The properties of a module may be queried and set using the following
|
||||
# commands.
|
||||
|
||||
# .. cmake:command:: geant4_get_module_property
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_get_module_property(<result> <module> <property>)
|
||||
#
|
||||
# Store value of property ``<property>`` for ``<module>`` in variable
|
||||
# ``<result>``.
|
||||
#
|
||||
# If ``<property>`` is not a valid module property, a FATAL_ERROR is
|
||||
# emitted.
|
||||
#
|
||||
function(geant4_get_module_property _output _module _propertyname)
|
||||
__geant4_module_assert_exists(${_module})
|
||||
__geant4_module_validate_property(${_propertyname})
|
||||
get_property(__result GLOBAL PROPERTY ${_module}_${_propertyname})
|
||||
set(${_output} ${__result} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_set_module_property
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_set_module_property(<module>
|
||||
# [APPEND | APPEND_STRING]
|
||||
# PROPERTY <property> <value>)
|
||||
#
|
||||
# Set property ``<property>`` of module ``<module>`` to ``<value>``.
|
||||
#
|
||||
# If ``APPEND`` is supplied, ``<value>`` will be appended to any existing
|
||||
# value for the property as a list.
|
||||
#
|
||||
# If ``APPEND_STRING`` is supplied, ``<value>`` will be appended to any existing
|
||||
# value for the property as a string. This option is mutually exclusive with
|
||||
# ``APPEND``.
|
||||
#
|
||||
# If ``<property>`` is not a valid module property, a FATAL_ERROR is
|
||||
# emitted.
|
||||
#
|
||||
function(geant4_set_module_property _module)
|
||||
cmake_parse_arguments(G4SMP
|
||||
"APPEND;APPEND_STRING"
|
||||
""
|
||||
"PROPERTY"
|
||||
${ARGN}
|
||||
)
|
||||
# module must exist!
|
||||
__geant4_module_assert_exists(${_module})
|
||||
|
||||
# Append/Append_string are mutually exclusive
|
||||
if(G4SMP_APPEND AND G4SMP_APPEND_STRING)
|
||||
message(FATAL_ERROR "geant4_set_module_property: cannot set both APPEND and APPEND_STRING")
|
||||
elseif(G4SMP_APPEND)
|
||||
set(G4SMP_APPEND_MODE "APPEND")
|
||||
elseif(G4SMP_APPEND_MODE)
|
||||
set(G4SMP_APPEND_MODE "APPEND_STRING")
|
||||
endif()
|
||||
|
||||
# First element of PROPERTY list is prop name
|
||||
list(GET G4SMP_PROPERTY 0 G4SMP_PROPERTY_NAME)
|
||||
if(NOT G4SMP_PROPERTY_NAME)
|
||||
message(FATAL_ERROR "geant4_set_module_property: Required PROPERTY argument is missing")
|
||||
endif()
|
||||
|
||||
__geant4_module_validate_property(${G4SMP_PROPERTY_NAME})
|
||||
# Remainder is arguments, so strip first element
|
||||
list(REMOVE_AT G4SMP_PROPERTY 0)
|
||||
|
||||
set_property(GLOBAL ${G4SMP_APPEND_MODE} PROPERTY ${_module}_${G4SMP_PROPERTY_NAME} ${G4SMP_PROPERTY})
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Category Commands
|
||||
# ^^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# .. cmake:command:: geant4_add_category
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_add_category(<name> MODULES <module> [<module> ...])
|
||||
#
|
||||
# Add a Geant4 category ``<name>`` to the project, composed of the modules
|
||||
# supplied in the ``MODULES`` list.
|
||||
#
|
||||
# Calling this function does not create an actual CMake library target.
|
||||
# Because modules declare dependencies on modules rather than libraries, we
|
||||
# defer creation of library targets to after creation of categories, which
|
||||
# allows resolution of module <-> category use. Additionally, category specific
|
||||
# actions such as install may be added.
|
||||
#
|
||||
function(geant4_add_category _name)
|
||||
# Check existence? final add_library will warn, but may wish to double check
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_DEFINED_CATEGORIES ${_name})
|
||||
cmake_parse_arguments(G4ADDCAT
|
||||
""
|
||||
""
|
||||
"MODULES"
|
||||
${ARGN}
|
||||
)
|
||||
# - Modules must not be empty (Could also just be ARGN)
|
||||
if(NOT G4ADDCAT_MODULES)
|
||||
message(FATAL_ERROR "geant4_add_category: Missing/empty 'MODULES' argument")
|
||||
endif()
|
||||
|
||||
# Compose Category from Modules
|
||||
foreach(__g4module ${G4ADDCAT_MODULES})
|
||||
# Module must not have been composed already
|
||||
geant4_get_module_property(_parent ${__g4module} PARENT_TARGET)
|
||||
if(${_parent})
|
||||
message(FATAL_ERROR "geant4_add_category: trying to compose category '${_name}' using module '${__g4module}' which is already composed into category '${_parent}'")
|
||||
endif()
|
||||
|
||||
# Compose it
|
||||
geant4_set_module_property(${__g4module} PROPERTY PARENT_TARGET ${_name})
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_CATEGORIES_${_name}_MODULES ${__g4module})
|
||||
|
||||
geant4_get_module_property(_headers ${__g4module} PUBLIC_HEADERS)
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_CATEGORIES_${_name}_PUBLIC_HEADERS ${_headers})
|
||||
endforeach()
|
||||
|
||||
# As we do not create a physical target, store the script in which we're called
|
||||
set_property(GLOBAL PROPERTY GEANT4_CATEGORIES_${_name}_CMAKE_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Resolve a list of links
|
||||
# These may include Geant4 modules as well as standard targets or other expressions
|
||||
# Resolve Modules to PARENT_TARGET, removing duplicates
|
||||
# Leave other links unchanged
|
||||
function(geant4_resolve_link_libraries _list)
|
||||
set(_resolved_list )
|
||||
foreach(__lib ${${_list}})
|
||||
# If "library" is a module, resolve it to PARENT_TARGET
|
||||
geant4_has_module(__is_module ${__lib})
|
||||
if(__is_module)
|
||||
geant4_get_module_property(__parent_lib ${__lib} PARENT_TARGET)
|
||||
list(APPEND _resolved_list ${__parent_lib})
|
||||
else()
|
||||
list(APPEND _resolved_list ${__lib})
|
||||
endif()
|
||||
endforeach()
|
||||
if(_resolved_list)
|
||||
list(REMOVE_DUPLICATES _resolved_list)
|
||||
endif()
|
||||
set(${_list} ${_resolved_list} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_compose_targets
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_compose_targets()
|
||||
#
|
||||
# Create physical SHARED/STATIC library targets from the defined Geant4
|
||||
# categories and modules.
|
||||
#
|
||||
# Can only be called once, and must be done so after all Geant4 libraries
|
||||
# and modules are defined.
|
||||
#
|
||||
function(geant4_compose_targets)
|
||||
get_property(__alreadyCalled GLOBAL PROPERTY GEANT4_COMPOSE_TARGETS_CALLED)
|
||||
if(__alreadyCalled)
|
||||
get_property(__callsite GLOBAL PROPERTY GEANT4_COMPOSE_TARGETS_LIST_FILE)
|
||||
message(FATAL_ERROR "geant4_compose_targets already called from ${__callsite}")
|
||||
endif()
|
||||
|
||||
# Check that every defined module is composed
|
||||
geant4_get_modules(__g4definedmodules)
|
||||
foreach(__module ${__g4definedmodules})
|
||||
geant4_get_module_property(__iscomposed ${__module} PARENT_TARGET)
|
||||
if(NOT __iscomposed)
|
||||
message(FATAL_ERROR "Geant4 module '${__module}' is not composed into any category")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Process all defined libraries, except for G4clhep{-static}
|
||||
# G4clhep/G4ptl are a corner cases because its call to add_library happens
|
||||
# at a different (lower) directory level than all the other targets
|
||||
# This means we cannot install it here. That's left to it
|
||||
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
|
||||
list(REMOVE_ITEM __g4definedlibraries G4clhep G4clhep-static G4ptl G4ptl-static)
|
||||
set(__g4builtlibraries)
|
||||
set(__g4public_headers)
|
||||
|
||||
foreach(__g4lib ${__g4definedlibraries})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
__geant4_add_library(${__g4lib} SHARED)
|
||||
list(APPEND __g4builtlibraries ${__g4lib})
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
__geant4_add_library(${__g4lib} STATIC)
|
||||
list(APPEND __g4builtlibraries ${__g4lib}-static)
|
||||
endif()
|
||||
|
||||
get_property(__headers GLOBAL PROPERTY GEANT4_CATEGORIES_${__g4lib}_PUBLIC_HEADERS)
|
||||
list(APPEND __g4public_headers ${__headers})
|
||||
endforeach()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# TEMP INSTALL - do here purely to review exported links. Should be
|
||||
# factored out into separate function later.
|
||||
install(TARGETS ${__g4builtlibraries}
|
||||
EXPORT Geant4LibraryDepends
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Development
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Runtime
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Runtime
|
||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
|
||||
install(FILES ${__g4public_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}" COMPONENT Development)
|
||||
|
||||
set_property(GLOBAL PROPERTY GEANT4_COMPOSE_TARGETS_CALLED ON)
|
||||
set_property(GLOBAL PROPERTY GEANT4_COMPOSE_TARGETS_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Backward Compatibility Commands
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# These commands implement the old module/library definition macros in
|
||||
# terms of the new command set. They provide a facade allowing migration
|
||||
# to the new interfaces with a controlled transition.
|
||||
#
|
||||
# As migration progresses, these commands will gradually be deprecated,
|
||||
# with warnings issued about what to do at each stage.
|
||||
#
|
||||
# .. cmake:command:: geant4_define_module
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_define_module(NAME <name>
|
||||
# HEADERS header1 [header2 ...]
|
||||
# SOURCES source1 [source2 ...]
|
||||
# GRANULAR_DEPENDENCIES lib1 [lib2 ...]
|
||||
# GLOBAL_DEPENDENCIES lib1 [lib2 ...]
|
||||
# LINK_LIBRARIES lib1 [lib2 ...])
|
||||
#
|
||||
# DEPRECATED: Use :cmake:command:`geant4_add_module` to add a module with headers/sources,
|
||||
# and :cmake:command:`geant4_module_link_libraries` to declare internal and external
|
||||
# libraries to link to.
|
||||
#
|
||||
function(geant4_define_module)
|
||||
cmake_parse_arguments(G4DEFMOD
|
||||
""
|
||||
"NAME"
|
||||
"HEADERS;SOURCES;GRANULAR_DEPENDENCIES;GLOBAL_DEPENDENCIES;LINK_LIBRARIES;HEADERS_EXCLUDE_FORMAT;SOURCES_EXCLUDE_FORMAT"
|
||||
${ARGN}
|
||||
)
|
||||
# HEADERS -> PUBLIC_HEADERS
|
||||
# SOURCES -> SOURCES
|
||||
# Don't support clang-formatting yet.
|
||||
geant4_add_module(${G4DEFMOD_NAME}
|
||||
PUBLIC_HEADERS ${G4DEFMOD_HEADERS}
|
||||
SOURCES ${G4DEFMOD_SOURCES}
|
||||
)
|
||||
|
||||
# GRANULAR_DEPENDENCIES -> geant4_module_link_libraries(mod PUBLIC ...)
|
||||
# GLOBAL_DEPENDENCIES -> new property... Just record it for now, later
|
||||
# we need to link these to the physical library the module is composed into
|
||||
# checking that
|
||||
# i) Granular -> Global link is complete, i.e. resolving granular deps results
|
||||
# in same global link list.
|
||||
# Has to be stored separately because we want/need to check for full resolution of
|
||||
# the granular libs to the same set of global libs. That's needed to ensure we
|
||||
# can correct any missing links in existing GRANULAR_DEPENDENCIES lists.
|
||||
# (i.e. it's a transtional property)
|
||||
# LINK_LIBRARIES -> geant4_module_link_libraries(mod PUBLIC ...)
|
||||
|
||||
geant4_module_link_libraries(${G4DEFMOD_NAME} PUBLIC ${G4DEFMOD_GRANULAR_DEPENDENCIES} ${G4DEFMOD_LINK_LIBRARIES})
|
||||
geant4_set_module_property(${G4DEFMOD_NAME} PROPERTY GLOBAL_DEPENDENCIES ${G4DEFMOD_GLOBAL_DEPENDENCIES})
|
||||
|
||||
# When we are ready, start issuing a deprecation warning here, including instructions for
|
||||
# migration...
|
||||
# message(WARNING "Use of geant4_define_module is deprecated, please use... instead")
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_global_library_target
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_global_library_target(NAME <name>
|
||||
# COMPONENTS file1 [file2 ...])
|
||||
#
|
||||
# DEPRECATED: Use :cmake:command:`geant4_add_library` to add a library with a list
|
||||
# of modules.
|
||||
#
|
||||
# This function provides a facade around :cmake:command:`geant4_add_library` to
|
||||
# allow back compatibility with the older module/library functions
|
||||
#
|
||||
function(geant4_global_library_target)
|
||||
cmake_parse_arguments(G4GLOBLIB
|
||||
""
|
||||
"NAME"
|
||||
"COMPONENTS"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Because components are sources.cmake files, must know currently defined modules
|
||||
# so we can pick up the newly defined ones
|
||||
geant4_get_modules(__oldmodules)
|
||||
|
||||
# Load components
|
||||
foreach(__comp ${G4GLOBLIB_COMPONENTS})
|
||||
include(${__comp})
|
||||
endforeach()
|
||||
# Reset directory scope include dirs so we enforce usage requirements
|
||||
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
|
||||
|
||||
# List modules now defined, and filter out old from new
|
||||
geant4_get_modules(__newmodules)
|
||||
|
||||
if(__oldmodules)
|
||||
list(REMOVE_ITEM __newmodules ${__oldmodules})
|
||||
endif()
|
||||
|
||||
# Old function allowed optional NAME argument, in which case it should
|
||||
# be the first element in the module list
|
||||
if(NOT G4GLOBLIB_NAME)
|
||||
list(GET __newmodules 0 G4GLOBLIB_NAME)
|
||||
endif()
|
||||
|
||||
# Some compile definitions are still transported via directory level
|
||||
# "add_definitions" calls at the site of the geant4_global_library call
|
||||
# These, if they exist, are equivalent to PRIVATE level compile defs.
|
||||
get_directory_property(__local_compile_defs COMPILE_DEFINITIONS)
|
||||
foreach(__module ${__newmodules})
|
||||
geant4_module_compile_definitions(${__module} PRIVATE ${__local_compile_defs})
|
||||
endforeach()
|
||||
|
||||
# Compose the modules into the category
|
||||
geant4_add_category(${G4GLOBLIB_NAME} MODULES ${__newmodules})
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: geant4_library_target
|
||||
#
|
||||
# .. code-block::
|
||||
#
|
||||
# geant4_library_target(NAME <name>
|
||||
# SOURCES source1 [source2 ...]
|
||||
# GEANT4_LINK_LIBRARIES lib1 [lib2 ...]
|
||||
# LINK_LIBRARIES lib1 [lib2 ...])
|
||||
#
|
||||
# DEPRECATED: Maintained only for building internal G4clhep target because of its
|
||||
# different include structure.
|
||||
#
|
||||
function(geant4_library_target)
|
||||
cmake_parse_arguments(G4GLOBLIB
|
||||
""
|
||||
"NAME"
|
||||
"SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
|
||||
${ARGN}
|
||||
)
|
||||
# Currently a hack to get G4clhep to build, so an error if used elsewhere
|
||||
if(NOT (${G4GLOBLIB_NAME} STREQUAL "G4clhep"))
|
||||
message(FATAL_ERROR "geant4_library_target called for '${G4GLOBLIB_NAME}' in '${CMAKE_CURRENT_LIST_DIR}'")
|
||||
endif()
|
||||
|
||||
geant4_format_target(NAME ${G4GLOBLIB_NAME}-format SOURCES ${G4GLOBLIB_SOURCES})
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(${G4GLOBLIB_NAME} SHARED ${G4GLOBLIB_SOURCES})
|
||||
add_library(Geant4::${G4GLOBLIB_NAME} ALIAS ${G4GLOBLIB_NAME})
|
||||
target_compile_features(${G4GLOBLIB_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
|
||||
target_compile_definitions(${G4GLOBLIB_NAME} PUBLIC G4LIB_BUILD_DLL)
|
||||
target_include_directories(${G4GLOBLIB_NAME}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
|
||||
)
|
||||
set_target_properties(${G4GLOBLIB_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
install(TARGETS ${G4GLOBLIB_NAME}
|
||||
EXPORT Geant4LibraryDepends
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
add_library(${G4GLOBLIB_NAME}-static STATIC ${G4GLOBLIB_SOURCES})
|
||||
add_library(Geant4::${G4GLOBLIB_NAME}-static ALIAS ${G4GLOBLIB_NAME}-static)
|
||||
target_compile_features(${G4GLOBLIB_NAME}-static PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
|
||||
target_include_directories(${G4GLOBLIB_NAME}-static
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
set_target_properties(${G4GLOBLIB_NAME}-static PROPERTIES OUTPUT_NAME ${G4GLOBLIB_NAME})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${G4GLOBLIB_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
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
# Needs to be in defined category list for static/shared to be linked correctly.
|
||||
set_property(GLOBAL APPEND PROPERTY GEANT4_DEFINED_CATEGORIES ${G4GLOBLIB_NAME})
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# .rst:
|
||||
# .. cmake:command:: geant4_add_compile_definitions
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# geant4_add_compile_definitions(SOURCES <source1> ... <sourceN>
|
||||
# COMPILE_DEFINITIONS <def1> ... <defN>)
|
||||
#
|
||||
# Add extra compile definitions to a specific list of sources
|
||||
# in the current module. Macroized to handle the need to specify absolute paths.
|
||||
# and *must* be called at the same level as geant4_define_module
|
||||
#
|
||||
macro(geant4_add_compile_definitions)
|
||||
cmake_parse_arguments(G4ADDDEF
|
||||
""
|
||||
""
|
||||
"SOURCES;COMPILE_DEFINITIONS"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# We assume that the sources have been added at the level of a
|
||||
# a sources.cmake, so are inside the src subdir of the sources.cmake
|
||||
get_filename_component(_ACD_BASE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
# Now for each file, add the definitions
|
||||
foreach(_acd_source ${G4ADDDEF_SOURCES})
|
||||
# Extract any existing compile definitions
|
||||
get_source_file_property(
|
||||
_acd_existing_properties
|
||||
${_ACD_BASE_PATH}/src/${_acd_source}
|
||||
COMPILE_DEFINITIONS)
|
||||
|
||||
if(_acd_existing_properties)
|
||||
set(_acd_new_defs ${_acd_existing_properties}
|
||||
${G4ADDDEF_COMPILE_DEFINITIONS})
|
||||
else()
|
||||
set(_acd_new_defs ${G4ADDDEF_COMPILE_DEFINITIONS})
|
||||
endif()
|
||||
|
||||
# quote compile defs because this must epand to space separated list
|
||||
set_source_files_properties(${_ACD_BASE_PATH}/src/${_acd_source}
|
||||
PROPERTIES COMPILE_DEFINITIONS "${_acd_new_defs}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# Internal Helper Commands
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# These macros and functions are for use in the implementation of the
|
||||
# module and library functions. They should never be used directly
|
||||
# in developer-level scripts.
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#.rst:
|
||||
# .. cmake:command:: __geant4_module_assert_exists
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# __geant4_module_assert_exists(<name>)
|
||||
#
|
||||
# Emit a ``FATAL_ERROR`` if the module ``<name>`` is not defined.
|
||||
#
|
||||
# This is a macro intended for use in G4DeveloperAPI functions when
|
||||
# the existence of a module is required for further processing
|
||||
#
|
||||
macro(__geant4_module_assert_exists _module)
|
||||
geant4_has_module(__geant4_module_assert_exists_tmp ${_module})
|
||||
if(NOT __geant4_module_assert_exists_tmp)
|
||||
message(FATAL_ERROR "Geant4 module '${_module}' has not been created")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
#.rst:
|
||||
# .. cmake:command:: __geant4_module_assert_not_exists
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# __geant4_module_assert_not_exists(<name>)
|
||||
#
|
||||
# Emit a ``FATAL_ERROR`` if the module ``<name>`` is defined
|
||||
#
|
||||
# This is a macro intended for use in G4DeveloperAPI functions when
|
||||
# the non-existence of a module is required for further processing
|
||||
#
|
||||
macro(__geant4_module_assert_not_exists _module)
|
||||
geant4_has_module(__geant4_module_assert_not_exists_tmp ${_module})
|
||||
if(__geant4_module_assert_not_exists_tmp)
|
||||
geant4_get_module_property(__previous_cmake_list ${_module} CMAKE_LIST_FILE)
|
||||
message(FATAL_ERROR "Geant4 module '${_module}' has already been created by call in '${__previous_cmake_list}'")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
#.rst:
|
||||
# .. cmake:command:: __geant4_module_validate_property
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# __geant4_module_validate_property(<property>)
|
||||
#
|
||||
# Emit a ``FATAL_ERROR`` if the ``<property>`` is not one of the valid
|
||||
# properties for a module:
|
||||
#
|
||||
# This is used internally by the property get/set functions.
|
||||
#
|
||||
function(__geant4_module_validate_property _property)
|
||||
if(NOT (${_property} MATCHES "PUBLIC_HEADERS|PRIVATE_HEADERS|SOURCES|INTERFACE_COMPILE_DEFINITIONS|COMPILE_DEFINITIONS|INTERFACE_INCLUDE_DIRECTORIES|INCLUDE_DIRECTORIES|INTERFACE_LINK_LIBRARIES|LINK_LIBRARIES|PARENT_TARGET|CMAKE_LIST_FILE|GLOBAL_DEPENDENCIES"))
|
||||
message(FATAL_ERROR "Undefined property '${_property}'")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
#.rst:
|
||||
# .. cmake:command:: __geant4_add_library
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# __geant4_add_library(<libraryname> <mode>)
|
||||
#
|
||||
# Compose an actual CMake library target
|
||||
#
|
||||
# This is used internally by the ``geant4_compose_targets`` command.
|
||||
#
|
||||
function(__geant4_add_library _name _type)
|
||||
# TEMP HACK: G4clhep/G4ptl are a special cases, and build is handled separately
|
||||
if(_name MATCHES "G4clhep|G4ptl")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT (${_type} MATCHES "SHARED|STATIC"))
|
||||
message(FATAL_ERROR "Invalid library type '${_type}'")
|
||||
endif()
|
||||
|
||||
# Get targets
|
||||
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
|
||||
|
||||
set(_target_name ${_name})
|
||||
if(_type STREQUAL "STATIC")
|
||||
set(_target_name ${_name}-static)
|
||||
endif()
|
||||
|
||||
# - General target creation/properties
|
||||
add_library(${_target_name} ${_type} "")
|
||||
# Alias for transparent use with imported targets
|
||||
add_library(Geant4::${_target_name} ALIAS ${_target_name})
|
||||
target_compile_features(${_target_name} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
|
||||
|
||||
if(_type STREQUAL "SHARED")
|
||||
# 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(${_target_name} PUBLIC G4LIB_BUILD_DLL)
|
||||
set_target_properties(${_target_name} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
# MacOS
|
||||
# Use '@rpath' in install names of libraries on macOS to provide relocatibility
|
||||
# Add '@loader_path' to INSTALL_RPATH on macOS so that Geant4
|
||||
# libraries self-locate each other whilst remaining relocatable
|
||||
set_target_properties(${_target_name} PROPERTIES MACOSX_RPATH 1)
|
||||
if(APPLE)
|
||||
set_property(TARGET ${G4LIBTARGET_NAME} APPEND PROPERTY INSTALL_RPATH "@loader_path")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((_type STREQUAL "STATIC") AND NOT WIN32)
|
||||
set_target_properties(${_target_name} PROPERTIES OUTPUT_NAME ${_name})
|
||||
endif()
|
||||
|
||||
# Compose target sources and links from its constituent modules
|
||||
set(__sources_to_format)
|
||||
|
||||
get_property(__g4modules GLOBAL PROPERTY GEANT4_CATEGORIES_${_name}_MODULES)
|
||||
foreach(__g4mod ${__g4modules})
|
||||
# - Process sources...
|
||||
geant4_get_module_property(_headers ${__g4mod} PUBLIC_HEADERS)
|
||||
geant4_get_module_property(_srcs ${__g4mod} SOURCES)
|
||||
geant4_get_module_property(_cmakescript ${__g4mod} CMAKE_LIST_FILE)
|
||||
|
||||
# Store sources to be formatted (one mode only)
|
||||
if(_type STREQUAL "SHARED")
|
||||
list(APPEND __sources_to_format ${_headers} ${_srcs})
|
||||
endif()
|
||||
|
||||
# - Group sources and scripts for IDEs
|
||||
# NB: Seemingly has to be done at same level we define target.
|
||||
# TODO: If lib name is same as mod name, don't group avoid extra
|
||||
# folder layer.
|
||||
source_group(${__g4mod}\\Headers FILES ${_headers})
|
||||
source_group(${__g4mod}\\Sources FILES ${_srcs})
|
||||
source_group(${__g4mod} FILES ${_cmakescript})
|
||||
|
||||
# - Add sources to target - PRIVATE, because consuming targets don't need them
|
||||
target_sources(${_target_name} PRIVATE ${_headers} ${_srcs} ${_cmakescript})
|
||||
|
||||
# - Process usage properties
|
||||
# Include dirs and compile definitions can be handled together
|
||||
# Important to note that these promote PUBLIC/PRIVATE/INTERFACE
|
||||
# from module level to library level. I.e. other modules in the
|
||||
# library can see each other's PRIVATE include paths/compile defs.
|
||||
# The only known way to fully wall things off is OBJECT libs,
|
||||
# but then run into issues mentioned at start - linking and
|
||||
# use in IDEs.
|
||||
# This "promotion" is probably correct though - interfaces are
|
||||
# at physical library level rather than module, and in Geant4
|
||||
# all files must have globally unique names (no nested hedaers
|
||||
# nor namespaces). Also, DLL export symbols may need this
|
||||
# behaviour (esp. ALLOC_EXPORT).
|
||||
# Only really an issue if header names/definitions aren't
|
||||
# globally (in Geant4) unique. Or if a module is moved and hasn't
|
||||
# declared its deps correctly (but then an error will occur
|
||||
# anyway, and point is that libs are linked, not modules!)
|
||||
# "Module" level really means "Source file" level, so same
|
||||
# sets of rules should apply (i.e. can't specify inc dirs
|
||||
# at source level).
|
||||
foreach(_prop IN ITEMS INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES COMPILE_DEFINITIONS INTERFACE_COMPILE_DEFINITIONS)
|
||||
geant4_get_module_property(_value ${__g4mod} ${_prop})
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY ${_prop} ${_value})
|
||||
endforeach()
|
||||
|
||||
# Link libraries
|
||||
foreach(_link_prop IN ITEMS LINK_LIBRARIES INTERFACE_LINK_LIBRARIES)
|
||||
geant4_get_module_property(_linklibs ${__g4mod} ${_link_prop})
|
||||
geant4_resolve_link_libraries(_linklibs)
|
||||
# Remove self-linking
|
||||
if(_linklibs)
|
||||
list(REMOVE_ITEM _linklibs ${_name})
|
||||
endif()
|
||||
|
||||
# Filter list for internal static targets
|
||||
if(_type STREQUAL "STATIC")
|
||||
set(_g4linklibs )
|
||||
foreach(_linklib ${_linklibs})
|
||||
# If the linklib is a G4Library, change name to "name-static"
|
||||
list(FIND __g4definedlibraries ${_linklib} _isg4lib)
|
||||
if(_isg4lib GREATER -1)
|
||||
list(APPEND _g4linklibs "${_linklib}-static")
|
||||
else()
|
||||
list(APPEND _g4linklibs "${_linklib}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(_linklibs ${_g4linklibs})
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY ${_link_prop} ${_linklibs})
|
||||
|
||||
# Temp workaround for modules needing Qt. We use AUTOMOC, but can't yet set
|
||||
# it on a per module basis. However, only have three modules that require
|
||||
# moc-ing, so hard code for now.
|
||||
# TODO: likely need an additional "module target properties" to hold things
|
||||
# that can be passed to set_target_properties
|
||||
if(__g4mod MATCHES "G4UIbasic|G4OpenGL|G4OpenInventor" AND GEANT4_USE_QT)
|
||||
set_target_properties(${_target_name} PROPERTIES AUTOMOC ON)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# - Use stored total list of sources to create format target for one mode only
|
||||
if(_type STREQUAL "SHARED")
|
||||
geant4_format_target(NAME ${_name}-format SOURCES ${__sources_to_format})
|
||||
endif()
|
||||
|
||||
# - Postprocess target properties to remove duplicates
|
||||
foreach(_link_prop IN ITEMS LINK_LIBRARIES INTERFACE_LINK_LIBRARIES INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES COMPILE_DEFINITIONS INTERFACE_COMPILE_DEFINITIONS)
|
||||
get_target_property(__g4lib_link_libs ${_target_name} ${_link_prop})
|
||||
if(__g4lib_link_libs)
|
||||
list(SORT __g4lib_link_libs)
|
||||
list(REMOVE_DUPLICATES __g4lib_link_libs)
|
||||
set_property(TARGET ${_target_name} PROPERTY ${_link_prop} ${__g4lib_link_libs})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
@@ -239,9 +239,13 @@ macro(geant4_library_target)
|
||||
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})
|
||||
|
||||
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES} ${G4LIBTARGET_LINK_LIBRARIES})
|
||||
if(__sorted_link_libs)
|
||||
list(SORT __sorted_link_libs)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${G4LIBTARGET_NAME} ${__sorted_link_libs})
|
||||
# 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
|
||||
@@ -305,14 +309,16 @@ macro(geant4_library_target)
|
||||
# Because externals like clhep appear in G4LIBTARGET_LINK_LIBRARIES,
|
||||
# filter this list to replace shared builtins with their static variant
|
||||
string(REGEX REPLACE
|
||||
"(G4clhep|G4expat|G4zlib|G4geomUSolids)(;|$)" "\\1-static\\2"
|
||||
"(G4clhep|G4expat|G4zlib|G4ptl|G4geomUSolids)(;|$)" "\\1-static\\2"
|
||||
G4LIBTARGET_LINK_LIBRARIES_STATIC
|
||||
"${G4LIBTARGET_LINK_LIBRARIES}"
|
||||
)
|
||||
|
||||
target_link_libraries(${G4LIBTARGET_NAME}-static PUBLIC
|
||||
${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC}
|
||||
${G4LIBTARGET_LINK_LIBRARIES_STATIC})
|
||||
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC} ${G4LIBTARGET_LINK_LIBRARIES_STATIC})
|
||||
if(__sorted_link_libs)
|
||||
list(SORT __sorted_link_libs)
|
||||
endif()
|
||||
target_link_libraries(${G4LIBTARGET_NAME}-static PUBLIC ${__sorted_link_libs})
|
||||
|
||||
# But we can rename the output library to the correct name
|
||||
# On WIN32 we *retain* the -static postfix to avoid name clashes
|
||||
|
||||
@@ -108,7 +108,7 @@ set(GEANT4_BUILD_FULL_DATADIR ${PROJECT_BINARY_DIR}/data)
|
||||
set(GEANT4_INSTALL_DATADIR_DEFAULT "${CMAKE_INSTALL_DATADIR}/data")
|
||||
|
||||
# File containing dataset list
|
||||
set(GEANT4_DATASETS_DEFINITIONS "Geant4DatasetDefinitions")
|
||||
set(GEANT4_DATASETS_DEFINITIONS "G4DatasetDefinitions")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
+34
-60
@@ -42,6 +42,12 @@ set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
# Configure OpenInventor support
|
||||
#
|
||||
option(GEANT4_USE_INVENTOR "Build Geant4 OpenInventor Visualization Driver" OFF)
|
||||
option(GEANT4_USE_INVENTOR_QT "Build Geant4 OpenInventor Qt Visualization Driver" OFF)
|
||||
|
||||
if(GEANT4_USE_INVENTOR_QT)
|
||||
set(GEANT4_USE_INVENTOR ON)
|
||||
set(GEANT4_USE_QT ON)
|
||||
endif()
|
||||
|
||||
if(GEANT4_USE_INVENTOR)
|
||||
# Always need Inventor and OpenGL
|
||||
@@ -50,16 +56,20 @@ if(GEANT4_USE_INVENTOR)
|
||||
|
||||
# On UNIX, we also require Xm and X11 (inc. Xpm)...
|
||||
if(UNIX)
|
||||
if(NOT INVENTOR_SOXT_LIBRARY OR NOT INVENTOR_SOXT_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "Could not find SoXt library and/or headers")
|
||||
endif()
|
||||
if (GEANT4_USE_INVENTOR_QT)
|
||||
if (NOT INVENTOR_SOQT_LIBRARY OR NOT INVENTOR_SOQT_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "Could not find SoQt library and/or headers")
|
||||
endif()
|
||||
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOQT_INCLUDE_DIR}")
|
||||
else()
|
||||
if(NOT INVENTOR_SOXT_LIBRARY OR NOT INVENTOR_SOXT_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "Could not find SoXt library and/or headers")
|
||||
endif()
|
||||
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOXT_INCLUDE_DIR}")
|
||||
set(GEANT4_USE_XM ON)
|
||||
find_package(Motif REQUIRED)
|
||||
endif()
|
||||
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOXT_INCLUDE_DIR}")
|
||||
find_package(Motif REQUIRED)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
if(NOT X11_Xpm_FOUND)
|
||||
@@ -74,63 +84,27 @@ endif()
|
||||
#-----------------------------------------------------------------------
|
||||
# Configure Qt Support if needed (CROSSPLATFORM).
|
||||
#
|
||||
option(GEANT4_USE_QT "Build Geant4 with Qt support (Qt5 preferred, Qt4 fallback)" OFF)
|
||||
option(GEANT4_USE_QT "Build Geant4 with Qt support" OFF)
|
||||
|
||||
if(GEANT4_USE_QT)
|
||||
# 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)
|
||||
# Find and configure Qt and OpenGL
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5OpenGL REQUIRED)
|
||||
find_package(Qt5PrintSupport REQUIRED)
|
||||
|
||||
if(Qt5Core_FOUND
|
||||
AND Qt5Gui_FOUND
|
||||
AND Qt5Widgets_FOUND
|
||||
AND Qt5OpenGL_FOUND
|
||||
AND Qt5PrintSupport_FOUND)
|
||||
# Compatibility
|
||||
macro(qt4_wrap_cpp)
|
||||
qt5_wrap_cpp(${ARGN})
|
||||
endmacro()
|
||||
|
||||
# 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()
|
||||
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)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
|
||||
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
|
||||
|
||||
# Variables for export
|
||||
# Variables for export to GNUmake
|
||||
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX OUTPUT_VARIABLE G4QTHOME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS OUTPUT_VARIABLE G4QTLIBPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
@@ -157,7 +131,7 @@ set(GEANT4_USE_WT OFF)
|
||||
# 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)
|
||||
# geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
|
||||
#
|
||||
# set(WT_DEFINITIONS "-DQT_NO_KEYWORDS")
|
||||
#
|
||||
@@ -238,12 +212,12 @@ if(UNIX)
|
||||
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)
|
||||
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
|
||||
|
||||
# - If we're on Apple, also find the XQuartz GL libraries and append t.
|
||||
if(APPLE)
|
||||
find_package(XQuartzGL REQUIRED)
|
||||
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRARY)
|
||||
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY)
|
||||
endif()
|
||||
|
||||
# Add feature for X11 GL
|
||||
@@ -278,7 +252,7 @@ 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_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
|
||||
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+43
-2
@@ -153,6 +153,41 @@ endif()
|
||||
|
||||
geant4_add_feature(GEANT4_USE_SYSTEM_ZLIB "Using system zlib library")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# TBB support
|
||||
#
|
||||
set(_default_use_tbb OFF)
|
||||
if(TBB_DIR)
|
||||
set(_default_use_tbb ON)
|
||||
endif()
|
||||
|
||||
option(GEANT4_USE_TBB "Enable (optional) use of TBB as a tasking backend" ${_default_use_tbb})
|
||||
if(GEANT4_USE_TBB)
|
||||
find_package(TBB REQUIRED)
|
||||
geant4_save_package_variables(TBB TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_DEBUG
|
||||
TBB_LIBRARY_RELEASE TBB_ROOT_DIR)
|
||||
endif()
|
||||
|
||||
geant4_add_feature(GEANT4_USE_TBB "Enable (optional) use of TBB as a tasking backend")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Find required PTL package, defaulting in internal
|
||||
# Rely on PTL::PTL imported target (since CMake 3.1)
|
||||
option(GEANT4_USE_SYSTEM_PTL "Use system zlib library" OFF)
|
||||
if(GEANT4_USE_SYSTEM_PTL)
|
||||
find_package(PTL REQUIRED)
|
||||
# Backward compatibility for sources.cmake using the variable
|
||||
set(PTL_LIBRARIES PTL::PTL)
|
||||
geant4_save_package_variables(PTL PTL_DIR)
|
||||
else()
|
||||
set(PTL_USE_TBB ${GEANT4_USE_TBB})
|
||||
set(PTL_FOUND TRUE)
|
||||
set(GEANT4_USE_BUILTIN_PTL TRUE)
|
||||
set(PTL_LIBRARIES G4ptl)
|
||||
endif()
|
||||
|
||||
geant4_add_feature(GEANT4_USE_SYSTEM_PTL "Using system PTL library")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Optional Support for GDML - requires Xerces-C package
|
||||
# Relies on XercesC::XercesC imported target (since CMake 3.5)
|
||||
@@ -191,7 +226,7 @@ geant4_add_feature(GEANT4_USE_SMARTSTACK "Use smart track stack")
|
||||
# easily installed via:
|
||||
# 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)"`
|
||||
# and prepending CMAKE_PREFIX_PATH with `python -c "import sys; print(sys.prefix)"`
|
||||
#
|
||||
set(_default_use_timemory OFF)
|
||||
if(TiMemory_DIR)
|
||||
@@ -295,10 +330,16 @@ if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
|
||||
# Shim until VecGeom supports config mode properly
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
|
||||
# Backward Compatibility
|
||||
set(VECGEOM_LIBRARIES VecGeom::VecGeom)
|
||||
set(VECGEOM_LIBRARIES VecGeom::vecgeom)
|
||||
|
||||
geant4_save_package_variables(VecGeom VecGeom_DIR)
|
||||
|
||||
# If VecCore_DIR is set, means updated VecGeom install used, so
|
||||
# also store VecCore_DIR
|
||||
if(VecCore_DIR)
|
||||
geant4_save_package_variables(VecGeom VecCore_DIR)
|
||||
endif()
|
||||
|
||||
if(GEANT4_USE_ALL_USOLIDS)
|
||||
set(G4GEOM_USE_USOLIDS TRUE)
|
||||
GEANT4_ADD_FEATURE(GEANT4_USE_USOLIDS "Replacing Geant4 solids with all VecGeom equivalents (EXPERIMENTAL)")
|
||||
@@ -1,7 +1,7 @@
|
||||
# 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)
|
||||
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)$")
|
||||
@@ -10,7 +10,7 @@ if(VecGeom_FOUND)
|
||||
endforeach()
|
||||
|
||||
string(REGEX REPLACE "^\-D|;-D" ";" VECGEOM_COMPILE_DEFINITIONS "${VECGEOM_DEFINITIONS}")
|
||||
set_target_properties(VecGeom::VecGeom PROPERTIES
|
||||
set_target_properties(VecGeom::vecgeom PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${VECGEOM_COMPILE_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${VECGEOM_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${VECGEOM_LIBRARIES}"
|
||||
|
||||
@@ -25,6 +25,4 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
# ui_win32 (WIN32 Style Application Command Line Interface)
|
||||
#
|
||||
# motif (Motif-X11/OpenGL Graphical User Interface)
|
||||
# qt (Qt4/OpenGL Graphical User Interface)
|
||||
# qt (Qt5/OpenGL Graphical User Interface)
|
||||
#
|
||||
# vis_network_dawn (Client/Server network interface to DAWN visualization)
|
||||
# vis_network_vrml (Client/Server network interface to VRML visualization)
|
||||
@@ -265,6 +265,20 @@ if(NOT Geant4_builtin_zlib_FOUND)
|
||||
find_dependency(ZLIB @ZLIB_VERSION_STRING@)
|
||||
endif()
|
||||
|
||||
set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM_PTL@)
|
||||
if(Geant4_system_ptl_FOUND)
|
||||
set(Geant4_builtin_ptl_FOUND FALSE)
|
||||
find_dependency(PTL @PTL_VERSION_STRING@)
|
||||
else()
|
||||
# We know exactly where PTL is
|
||||
set(Geant4_builtin_ptl_FOUND TRUE)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.8.9999)
|
||||
find_dependency(PTL @PTL_VERSION_STRING@ NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
|
||||
else()
|
||||
find_package(PTL @PTL_VERSION_STRING@ REQUIRED NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# - Multithreading
|
||||
set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@)
|
||||
if(Geant4_multithreaded_FOUND)
|
||||
@@ -284,6 +298,12 @@ endif()
|
||||
# - Smart track stack
|
||||
set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
|
||||
|
||||
# - TBB
|
||||
set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)
|
||||
if(Geant4_TBB_FOUND)
|
||||
find_dependency(TBB @TBB_VERSION@)
|
||||
endif()
|
||||
|
||||
# - TiMemory
|
||||
set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@)
|
||||
if(Geant4_timemory_FOUND)
|
||||
@@ -395,19 +415,14 @@ endif()
|
||||
|
||||
# - Qt (UI and Vis!)
|
||||
set(Geant4_qt_FOUND @GEANT4_USE_QT@)
|
||||
set(Geant4_USES_QT5 @Qt5Core_FOUND@)
|
||||
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_dependency(Qt5Core REQUIRED)
|
||||
find_dependency(Qt5Gui REQUIRED)
|
||||
find_dependency(Qt5Widgets REQUIRED)
|
||||
find_dependency(Qt5OpenGL REQUIRED)
|
||||
find_dependency(Qt5PrintSupport REQUIRED)
|
||||
else()
|
||||
find_dependency(Qt4 REQUIRED QtCore QtGui QtOpenGL)
|
||||
endif()
|
||||
find_dependency(Qt5Core REQUIRED)
|
||||
find_dependency(Qt5Gui REQUIRED)
|
||||
find_dependency(Qt5Widgets REQUIRED)
|
||||
find_dependency(Qt5OpenGL REQUIRED)
|
||||
find_dependency(Qt5PrintSupport REQUIRED)
|
||||
|
||||
# Also require OpenGL
|
||||
find_dependency(OpenGL)
|
||||
@@ -498,14 +513,22 @@ endif()
|
||||
|
||||
# - OpenInventor
|
||||
set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
|
||||
set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
|
||||
if(Geant4_vis_openinventor_FOUND)
|
||||
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
|
||||
-DG4VIS_USE_OI
|
||||
-DG4VIS_USE_OIX
|
||||
if(Geant4_vis_openinventor_qt_FOUND)
|
||||
list(APPEND Geant4_DEFINITIONS
|
||||
-DG4VIS_USE_OI
|
||||
-DG4VIS_USE_OIQT
|
||||
)
|
||||
else()
|
||||
list(APPEND Geant4_DEFINITIONS
|
||||
-DG4INTY_USE_XT
|
||||
-DG4VIS_USE_OI
|
||||
-DG4VIS_USE_OIX
|
||||
)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
list(APPEND Geant4_DEFINITIONS
|
||||
-G4INTY_USE_WIN32
|
||||
@@ -640,6 +663,7 @@ list(APPEND _geant4_internal_libraries
|
||||
${_geant4_physicslists_library}
|
||||
Geant4::G4run${_geant4_lib_use_suffix}
|
||||
Geant4::G4event${_geant4_lib_use_suffix}
|
||||
Geant4::G4tasking${_geant4_lib_use_suffix}
|
||||
Geant4::G4tracking${_geant4_lib_use_suffix}
|
||||
Geant4::G4parmodels${_geant4_lib_use_suffix}
|
||||
Geant4::G4processes${_geant4_lib_use_suffix}
|
||||
|
||||
@@ -182,9 +182,9 @@ function(geant4_add_test test)
|
||||
endif()
|
||||
|
||||
#- Locate the test driver
|
||||
set(_driver ${CMAKE_SOURCE_DIR}/cmake/Modules/Geant4TestDriver.cmake)
|
||||
set(_driver ${CMAKE_SOURCE_DIR}/cmake/Modules/G4TestDriver.cmake)
|
||||
if(NOT EXISTS ${_driver})
|
||||
message(FATAL_ERROR "GEANT4_ADD_TEST: Geant4TestDriver.cmake not found!")
|
||||
message(FATAL_ERROR "GEANT4_ADD_TEST: G4TestDriver.cmake not found!")
|
||||
endif()
|
||||
set(_command ${_command} -P ${_driver})
|
||||
|
||||
@@ -211,6 +211,7 @@ function(geant4_add_test test)
|
||||
--build-project ${ARG_PROJECT}
|
||||
--build-config $<CONFIGURATION>
|
||||
--build-noclean
|
||||
--build-options --no-warn-unused-cli -DCMAKE_DISABLE_FIND_PACKAGE_ROOT=$<BOOL:${CMAKE_DISABLE_FIND_PACKAGE_ROOT}>
|
||||
--test-command ${_command} )
|
||||
set_property(TEST ${test} PROPERTY ENVIRONMENT Geant4_DIR=${CMAKE_BINARY_DIR})
|
||||
if(ARG_FAILREGEX)
|
||||
|
||||
Reference in New Issue
Block a user