Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -57,96 +57,108 @@
|
||||
# definitions given to the sources.
|
||||
#
|
||||
|
||||
if(__GEANT4MACRODEFINEMODULE_ISLOADED)
|
||||
# - Include guard
|
||||
if(__geant4macrodefinemodule_isloaded)
|
||||
return()
|
||||
endif()
|
||||
set(__GEANT4MACRODEFINEMODULE_ISLOADED TRUE)
|
||||
set(__geant4macrodefinemodule_isloaded YES)
|
||||
|
||||
include(CMakeMacroParseArguments)
|
||||
|
||||
MACRO(GEANT4_DEFINE_MODULE)
|
||||
CMAKE_PARSE_ARGUMENTS(G4DEFMOD
|
||||
#-----------------------------------------------------------------------
|
||||
# macro geant4_define_module(NAME <name>
|
||||
# HEADERS <header1> <header2> ... <headerN>
|
||||
# SOURCES <source1> <source2> ... <sourceN>
|
||||
# GRANULAR_DEPENDENCIES <dep1> ... <depN>
|
||||
# GLOBAL_DEPENDENCIES <dep1> ... <depN>
|
||||
# LINK_LIBRARIES <lib1> ... <lib2>)
|
||||
# Define a Geant4 Module's sources and what internal and external
|
||||
# libraries it links to.
|
||||
#
|
||||
macro(geant4_define_module)
|
||||
cmake_parse_arguments(G4DEFMOD
|
||||
""
|
||||
"NAME"
|
||||
"HEADERS;SOURCES;GRANULAR_DEPENDENCIES;GLOBAL_DEPENDENCIES;LINK_LIBRARIES"
|
||||
${ARGN}
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
set(G4MODULENAME ${G4DEFMOD_NAME})
|
||||
set(G4MODULENAME ${G4DEFMOD_NAME})
|
||||
|
||||
get_filename_component(${G4MODULENAME}_BASEDIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
set(${G4MODULENAME}_SRCDIR ${${G4MODULENAME}_BASEDIR}/src)
|
||||
set(${G4MODULENAME}_INCDIR ${${G4MODULENAME}_BASEDIR}/include)
|
||||
get_filename_component(${G4MODULENAME}_BASEDIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
set(${G4MODULENAME}_SRCDIR ${${G4MODULENAME}_BASEDIR}/src)
|
||||
set(${G4MODULENAME}_INCDIR ${${G4MODULENAME}_BASEDIR}/include)
|
||||
|
||||
# We now create absolute paths to the headers and sources,
|
||||
# ignoring any already absolute paths
|
||||
foreach(_HDR ${G4DEFMOD_HEADERS})
|
||||
if(IS_ABSOLUTE ${_HDR})
|
||||
list(APPEND ${G4MODULENAME}_HEADERS ${_HDR})
|
||||
else()
|
||||
list(APPEND ${G4MODULENAME}_HEADERS ${${G4MODULENAME}_INCDIR}/${_HDR})
|
||||
endif()
|
||||
endforeach()
|
||||
# We now create absolute paths to the headers and sources,
|
||||
# ignoring any already absolute paths
|
||||
foreach(_HDR ${G4DEFMOD_HEADERS})
|
||||
if(IS_ABSOLUTE ${_HDR})
|
||||
list(APPEND ${G4MODULENAME}_HEADERS ${_HDR})
|
||||
else()
|
||||
list(APPEND ${G4MODULENAME}_HEADERS ${${G4MODULENAME}_INCDIR}/${_HDR})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_SRC ${G4DEFMOD_SOURCES})
|
||||
if(IS_ABSOLUTE ${_SRC})
|
||||
list(APPEND ${G4MODULENAME}_SOURCES ${_SRC})
|
||||
else()
|
||||
list(APPEND ${G4MODULENAME}_SOURCES ${${G4MODULENAME}_SRCDIR}/${_SRC})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_SRC ${G4DEFMOD_SOURCES})
|
||||
if(IS_ABSOLUTE ${_SRC})
|
||||
list(APPEND ${G4MODULENAME}_SOURCES ${_SRC})
|
||||
else()
|
||||
list(APPEND ${G4MODULENAME}_SOURCES ${${G4MODULENAME}_SRCDIR}/${_SRC})
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(_LIB ${G4DEFMOD_GRANULAR_DEPENDENCIES})
|
||||
list(APPEND ${G4MODULENAME}_GRANULAR_DEPENDENCIES ${_LIB})
|
||||
endforeach()
|
||||
|
||||
foreach(_LIB ${G4DEFMOD_GLOBAL_DEPENDENCIES})
|
||||
list(APPEND ${G4MODULENAME}_GLOBAL_DEPENDENCIES ${_LIB})
|
||||
endforeach()
|
||||
|
||||
foreach(_LIB ${G4DEFMOD_GRANULAR_DEPENDENCIES})
|
||||
list(APPEND ${G4MODULENAME}_GRANULAR_DEPENDENCIES ${_LIB})
|
||||
endforeach()
|
||||
foreach(_LIB ${G4DEFMOD_LINK_LIBRARIES})
|
||||
list(APPEND ${G4MODULENAME}_LINK_LIBRARIES ${_LIB})
|
||||
endforeach()
|
||||
|
||||
include_directories(${${G4MODULENAME}_INCDIR})
|
||||
endmacro()
|
||||
|
||||
foreach(_LIB ${G4DEFMOD_GLOBAL_DEPENDENCIES})
|
||||
list(APPEND ${G4MODULENAME}_GLOBAL_DEPENDENCIES ${_LIB})
|
||||
endforeach()
|
||||
|
||||
|
||||
foreach(_LIB ${G4DEFMOD_LINK_LIBRARIES})
|
||||
list(APPEND ${G4MODULENAME}_LINK_LIBRARIES ${_LIB})
|
||||
endforeach()
|
||||
|
||||
include_directories(${${G4MODULENAME}_INCDIR})
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# GEANT4_ADD_COMPILE_DEFINITIONS
|
||||
MACRO(GEANT4_ADD_COMPILE_DEFINITIONS)
|
||||
CMAKE_PARSE_ARGUMENTS(G4ADDDEF
|
||||
""
|
||||
""
|
||||
"SOURCES;COMPILE_DEFINITIONS"
|
||||
${ARGN}
|
||||
#-----------------------------------------------------------------------
|
||||
# macro geant4_add_compile_definitions(SOURCES <source1> ... <sourceN>
|
||||
# COMPILE_DEFINITIONS <def1> ... <defN>
|
||||
# )
|
||||
# Add extra compile definitions to a specific list of sources.
|
||||
# Macroized to handle the need to specify absolute paths.
|
||||
#
|
||||
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)
|
||||
# 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)
|
||||
|
||||
if(_acd_existing_properties)
|
||||
set(_acd_new_defs ${_acd_existing_properties}
|
||||
${G4ADDDEF_COMPILE_DEFINITIONS})
|
||||
else()
|
||||
set(_acd_new_defs ${G4ADDDEF_COMPILE_DEFINITIONS})
|
||||
endif()
|
||||
# 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)
|
||||
|
||||
# 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()
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user