Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8724264
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
22 KB
Subscribers
None
View Options
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e77b1e9..7443c8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,255 +1,255 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project("HEJ" VERSION 2.0.4 LANGUAGES C CXX)
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
## Flags for the compiler. No warning allowed.
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /EHsc")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
## Create Version
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
## target directories for install
set(INSTALL_INCLUDE_DIR_BASE include)
set(INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR_BASE}/HEJ)
set(INSTALL_BIN_DIR bin)
set(INSTALL_LIB_DIR lib)
set(INSTALL_CONFIG_DIR lib/cmake/HEJ)
## Template files
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/Version.hh.in
${PROJECT_BINARY_DIR}/include/HEJ/Version.hh @ONLY )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/HEJ-config.cc.in
${PROJECT_BINARY_DIR}/src/bin/HEJ-config.cc @ONLY )
# Generate CMake config file
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/Templates/hej-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config.cmake
INSTALL_DESTINATION ${INSTALL_CONFIG_DIR}
PATH_VARS INSTALL_INCLUDE_DIR_BASE INSTALL_LIB_DIR
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config-version.cmake
COMPATIBILITY SameMajorVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config-version.cmake
DESTINATION ${INSTALL_CONFIG_DIR})
## Add directories and find dependences
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include)
find_package(fastjet REQUIRED)
include_directories(${fastjet_INCLUDE_DIRS})
-find_package(clhep 2.3 REQUIRED)
+find_package(CLHEP 2.3 REQUIRED)
include_directories(${CLHEP_INCLUDE_DIRS})
find_package(LHAPDF REQUIRED)
include_directories(${LHAPDF_INCLUDE_DIRS})
## Amend unintuitive behaviour of FindBoost.cmake
## Priority of BOOST_ROOT over BOOSTROOT matches FindBoost.cmake
## at least for cmake 3.12
if(DEFINED BOOST_ROOT)
message("BOOST_ROOT set - only looking for Boost in ${BOOST_ROOT}")
set(Boost_NO_BOOST_CMAKE ON)
elseif(DEFINED BOOSTROOT)
message("BOOSTROOT set - only looking for Boost in ${BOOSTROOT}")
set(Boost_NO_BOOST_CMAKE ON)
endif()
find_package(Boost REQUIRED COMPONENTS iostreams)
include_directories(${Boost_INCLUDE_DIRS})
find_package(yaml-cpp)
include_directories(${YAML_CPP_INCLUDE_DIR})
find_package(HepMC 2)
if(${HepMC_FOUND})
message (STATUS "HepMC installation found: ${HepMC_INCLUDE_DIRS}")
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DHEJ_BUILD_WITH_HepMC_VERSION=${HepMC_VERSION_MAJOR}"
)
include_directories(${HepMC_INCLUDE_DIRS})
find_package(rivet)
if(${rivet_FOUND})
include_directories(${rivet_INCLUDE_DIRS})
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DHEJ_BUILD_WITH_RIVET"
)
endif()
endif()
find_package(QCDloop 2)
if(${QCDloop_FOUND})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHEJ_BUILD_WITH_QCDLOOP")
include_directories(SYSTEM ${QCDloop_INCLUDE_DIRS})
endif()
add_subdirectory(src)
## define executable
add_executable(HEJ src/bin/HEJ.cc)
## link libraries
target_link_libraries(HEJ hejlib)
add_executable(HEJ-config src/bin/HEJ-config.cc)
file(GLOB hej_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/HEJ/*.hh ${PROJECT_BINARY_DIR}/include/HEJ/*.hh)
file(GLOB lhef_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/LHEF/*.h)
install(FILES ${hej_headers} DESTINATION ${INSTALL_INCLUDE_DIR})
install(FILES ${lhef_headers} DESTINATION include/LHEF/)
install(TARGETS HEJ HEJ-config DESTINATION ${INSTALL_BIN_DIR})
## tests
enable_testing()
set(tst_dir "${CMAKE_CURRENT_SOURCE_DIR}/t")
add_executable(test_classify ${tst_dir}/test_classify.cc)
add_executable(test_psp ${tst_dir}/test_psp.cc)
add_executable(test_ME_generic ${tst_dir}/test_ME_generic.cc)
add_executable(check_res ${tst_dir}/check_res.cc)
add_executable(check_lhe ${tst_dir}/check_lhe.cc)
add_library(scales SHARED ${tst_dir}/scales.cc)
add_executable(test_scale_import ${tst_dir}/test_scale_import)
add_executable(test_descriptions ${tst_dir}/test_descriptions)
add_executable(test_scale_arithmetics ${tst_dir}/test_scale_arithmetics)
target_link_libraries(test_classify hejlib)
target_link_libraries(test_psp hejlib)
target_link_libraries(test_ME_generic hejlib)
target_link_libraries(check_res hejlib)
target_link_libraries(check_lhe hejlib)
target_link_libraries(test_scale_import hejlib)
target_link_libraries(test_descriptions hejlib)
target_link_libraries(test_scale_arithmetics hejlib)
## add tests
add_test(
NAME t_classify
COMMAND test_classify ${tst_dir}/classify.lhe.gz
)
add_test(
NAME t_psp
COMMAND test_psp ${tst_dir}/psp_gen.lhe.gz
)
set(tst_ME_data_dir "${tst_dir}/ME_data")
add_test(
NAME t_ME_j
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_jets.dat ${tst_ME_data_dir}/PSP_jets.lhe.gz
)
add_test(
NAME t_ME_h
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_h_mtinf.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
if(${QCDloop_FOUND})
add_test(
NAME t_ME_h_mt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mt.yml ${tst_ME_data_dir}/ME_h_mt.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
add_test(
NAME t_ME_h_mtmb
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtmb.yml ${tst_ME_data_dir}/ME_h_mtmb.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
endif()
add_test(
NAME t_2j
COMMAND check_res ${tst_dir}/2j.lhe.gz 3.49391e+07 419684
)
add_test(
NAME t_3j
COMMAND check_res ${tst_dir}/3j.lhe.gz 2.37902e+06 25746.6
)
add_test(
NAME t_4j
COMMAND check_res ${tst_dir}/4j.lhe.gz 603713 72822.6
)
add_test(
NAME t_h_3j
COMMAND check_res ${tst_dir}/h_3j.lhe.gz 0.821622 0.0220334
)
add_test(
NAME t_h_3j_uno
COMMAND check_res ${tst_dir}/h_3j_uno.lhe.gz 0.0261968 0.000341549 uno
)
if(${HepMC_FOUND})
file(READ "${tst_dir}/jet_config.yml" config)
file(WRITE "${tst_dir}/jet_config_withHepMC.yml" "${config} - tst.hepmc")
if(${rivet_FOUND})
file(READ "${tst_dir}/jet_config_withHepMC.yml" config)
file(WRITE "${tst_dir}/jet_config_withRivet.yml" "${config}\n\nanalysis:\n rivet: MC_XS\n output: tst")
add_test(
NAME t_main
COMMAND HEJ ${tst_dir}/jet_config_withRivet.yml ${tst_dir}/2j.lhe.gz
)
else()
add_test(
NAME t_main
COMMAND HEJ ${tst_dir}/jet_config_withHepMC.yml ${tst_dir}/2j.lhe.gz
)
endif()
if(${HepMC_VERSION_MAJOR} GREATER 2)
add_executable(check_hepmc ${tst_dir}/check_hepmc.cc)
target_link_libraries(check_hepmc hejlib)
add_test(
NAME t_hepmc
COMMAND check_hepmc tst.hepmc
)
endif()
else()
add_test(
NAME t_main
COMMAND HEJ ${tst_dir}/jet_config.yml ${tst_dir}/2j.lhe.gz
)
endif()
add_test(
NAME t_lhe
COMMAND check_lhe tst.lhe
)
add_test(
NAME t_scale_import
COMMAND test_scale_import ${tst_dir}/jet_config_with_import.yml
)
add_test(
NAME t_descriptions
COMMAND test_descriptions
)
add_test(
NAME t_scale_arithmetics
COMMAND test_scale_arithmetics ${tst_dir}/jet_config.yml ${tst_dir}/2j.lhe.gz
)
diff --git a/FixedOrderGen/CMakeLists.txt b/FixedOrderGen/CMakeLists.txt
index 9abb7bd..7e289eb 100644
--- a/FixedOrderGen/CMakeLists.txt
+++ b/FixedOrderGen/CMakeLists.txt
@@ -1,121 +1,121 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project("HEJ Fixed Order Generation" VERSION 2.0.4 LANGUAGES C CXX)
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
## Flags for the compiler. No warning allowed.
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /EHsc")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
## Create Version
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/Version.hh.in
${PROJECT_BINARY_DIR}/include/Version.hh @ONLY )
## Add directories and find dependences
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/Modules/")
find_package(HEJ 2 REQUIRED)
include_directories(${HEJ_INCLUDE_DIR})
find_package(fastjet REQUIRED)
include_directories(${fastjet_INCLUDE_DIRS})
-find_package(clhep 2.3 REQUIRED)
+find_package(CLHEP 2.3 REQUIRED)
include_directories(${CLHEP_INCLUDE_DIRS})
find_package(LHAPDF REQUIRED)
include_directories(${LHAPDF_INCLUDE_DIRS})
## Amend unintuitive behaviour of FindBoost.cmake
## Priority of BOOST_ROOT over BOOSTROOT matches FindBoost.cmake
## at least for cmake 3.12
if(DEFINED BOOST_ROOT)
message("BOOST_ROOT set - only looking for Boost in ${BOOST_ROOT}")
set(Boost_NO_BOOST_CMAKE ON)
elseif(DEFINED BOOSTROOT)
message("BOOSTROOT set - only looking for Boost in ${BOOSTROOT}")
set(Boost_NO_BOOST_CMAKE ON)
endif()
find_package(Boost REQUIRED COMPONENTS iostreams)
include_directories(${Boost_INCLUDE_DIRS})
find_package(yaml-cpp)
include_directories(${YAML_CPP_INCLUDE_DIR})
find_package(QCDloop 2)
if(${QCDloop_FOUND})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHEJ_BUILD_WITH_QCDLOOP")
include_directories(SYSTEM ${QCDloop_INCLUDE_DIRS})
endif()
## define executable
file(GLOB HEJFOG_source ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
list(REMOVE_ITEM HEJFOG_source ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc)
add_library(hejfog STATIC ${HEJFOG_source})
add_executable(HEJFOG ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc)
## link libraries
set(libraries ${CMAKE_DL_LIBS} ${LHAPDF_LIBRARIES} ${CLHEP_LIBRARIES}
${fastjet_LIBRARIES} ${Boost_LIBRARIES} ${YAML_CPP_LIBRARIES} ${HEJ_LIBRARIES})
if(${QCDloop_FOUND})
list(APPEND libraries ${QCDloop_LIBRARIES} quadmath)
endif()
target_link_libraries(hejfog ${libraries})
target_link_libraries(HEJFOG hejfog)
install(TARGETS HEJFOG DESTINATION bin)
## tests
enable_testing()
set(tst_dir "${CMAKE_CURRENT_SOURCE_DIR}/t")
foreach(tst h_2j h_3j h_5j h_3j_uno1 h_3j_uno2 h_2j_decay 2j 4j)
add_executable(test_${tst} ${tst_dir}/${tst}.cc)
target_link_libraries(test_${tst} hejfog)
add_test(NAME t_${tst} COMMAND test_${tst} WORKING_DIRECTORY ${tst_dir})
endforeach()
add_test(
NAME t_main_2j
COMMAND HEJFOG ${tst_dir}/config_2j.yml
)
add_test(
NAME t_main_h2j
COMMAND HEJFOG ${tst_dir}/config_h_2j.yml
)
add_test(
NAME t_main_h2j_decay
COMMAND HEJFOG ${tst_dir}/config_h_2j_decay.yml
)
diff --git a/cmake/Modules/FindCLHEP.cmake b/cmake/Modules/FindCLHEP.cmake
new file mode 100644
index 0000000..3f4e4cc
--- /dev/null
+++ b/cmake/Modules/FindCLHEP.cmake
@@ -0,0 +1,219 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+# This is a slightly modified version of FindGSL.cmake taken from cmake 3.7
+
+#.rst:
+# FindCLHEP
+# --------
+#
+# Find the native CLHEP includes and libraries.
+#
+# CLHEP package is an object oriented, C++ event record for High Energy
+# Physics Monte Carlo generators and simulation. It is free software
+# under the GNU General Public License.
+#
+# Imported Targets
+# ^^^^^^^^^^^^^^^^
+#
+# If CLHEP is found, this module defines the following
+# :prop_tgt:`IMPORTED` target::
+#
+# CLHEP::CLHEP - The main CLHEP library.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module will set the following variables in your project::
+#
+# CLHEP_FOUND - True if CLHEP found on the local system
+# CLHEP_INCLUDE_DIRS - Location of CLHEP header files.
+# CLHEP_LIBRARIES - The CLHEP libraries.
+# CLHEP_VERSION - The version of the discovered CLHEP install.
+#
+# Hints
+# ^^^^^
+#
+# Set ``CLHEP_ROOT_DIR`` to a directory that contains a CLHEP installation.
+#
+# This script expects to find libraries at ``$CLHEP_ROOT_DIR/lib`` and the CLHEP
+# headers at ``$CLHEP_ROOT_DIR/include/CLHEP``. The library directory may
+# optionally provide Release and Debug folders. For Unix-like systems, this
+# script will use ``$CLHEP_ROOT_DIR/bin/CLHEP-config`` (if found) to aid in the
+# discovery CLHEP.
+#
+# Cache Variables
+# ^^^^^^^^^^^^^^^
+#
+# This module may set the following variables depending on platform and type
+# of CLHEP installation discovered. These variables may optionally be set to
+# help this module find the correct files::
+#
+# CLHEP_CONFIG_EXECUTABLE - Location of the ``CLHEP-config`` script (if any).
+# CLHEP_LIBRARY - Location of the CLHEP library.
+# CLHEP_LIBRARY_DEBUG - Location of the debug CLHEP library (if any).
+#
+
+# Include these modules to handle the QUIETLY and REQUIRED arguments.
+include(FindPackageHandleStandardArgs)
+
+#=============================================================================
+# If the user has provided ``CLHEP_ROOT_DIR``, use it! Choose items found
+# at this location over system locations.
+if( EXISTS "$ENV{CLHEP_ROOT_DIR}" )
+ file( TO_CMAKE_PATH "$ENV{CLHEP_ROOT_DIR}" CLHEP_ROOT_DIR )
+ set( CLHEP_ROOT_DIR "${CLHEP_ROOT_DIR}" CACHE PATH "Prefix for CLHEP installation." )
+endif()
+if( NOT EXISTS "${CLHEP_ROOT_DIR}" )
+ set( CLHEP_USE_PKGCONFIG ON )
+endif()
+
+#=============================================================================
+# As a first try, use the PkgConfig module. This will work on many
+# *NIX systems. See :module:`findpkgconfig`
+# This will return ``CLHEP_INCLUDEDIR`` and ``CLHEP_LIBDIR`` used below.
+if( CLHEP_USE_PKGCONFIG )
+ find_package(PkgConfig)
+ pkg_check_modules( CLHEP QUIET CLHEP )
+
+ if( EXISTS "${CLHEP_INCLUDEDIR}" )
+ get_filename_component( CLHEP_ROOT_DIR "${CLHEP_INCLUDEDIR}" DIRECTORY CACHE)
+ endif()
+endif()
+
+#=============================================================================
+# Set CLHEP_INCLUDE_DIRS and CLHEP_LIBRARIES. If we skipped the PkgConfig step, try
+# to find the libraries at $CLHEP_ROOT_DIR (if provided), in the directory
+# suggested by CLHEP-config (if available), or in standard system
+# locations. These find_library and find_path calls will prefer custom
+# locations over standard locations (HINTS). If the requested file is found
+# neither at the HINTS location nor via CLHEP-config, standard system locations
+# will be still be searched (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)).
+
+# If we didn't use PkgConfig, try to find the version via CLHEP-config
+if( NOT CLHEP_VERSION )
+ find_program( CLHEP_CONFIG_EXECUTABLE
+ NAMES clhep-config
+ HINTS "${CLHEP_ROOT_DIR}/bin"
+ )
+ if( EXISTS "${CLHEP_CONFIG_EXECUTABLE}" )
+ execute_process(
+ COMMAND "${CLHEP_CONFIG_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CLHEP_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ string(REGEX REPLACE "CLHEP " "" CLHEP_VERSION ${CLHEP_VERSION})
+ execute_process(
+ COMMAND "${CLHEP_CONFIG_EXECUTABLE}" --prefix
+ OUTPUT_VARIABLE CLHEP_CONFIG_ROOT_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ string (REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1"
+ CLHEP_CONFIG_ROOT_DIR ${CLHEP_CONFIG_ROOT_DIR} )
+ set(CLHEP_CONFIG_INCLUDEDIR ${CLHEP_CONFIG_ROOT_DIR}/include)
+ set(CLHEP_CONFIG_LIBDIR ${CLHEP_CONFIG_ROOT_DIR}/lib)
+ endif()
+endif()
+find_path( CLHEP_INCLUDE_DIR
+ NAMES CLHEP/ClhepVersion.h
+ HINTS ${CLHEP_ROOT_DIR}/include ${CLHEP_INCLUDEDIR} ${CLHEP_CONFIG_INCLUDEDIR}
+)
+find_library( CLHEP_LIBRARY
+ NAMES CLHEP
+ HINTS ${CLHEP_ROOT_DIR}/lib ${CLHEP_LIBDIR} ${CLHEP_CONFIG_LIBDIR}
+ PATH_SUFFIXES Release Debug
+)
+# Do we also have debug versions?
+find_library( CLHEP_LIBRARY_DEBUG
+ NAMES CLHEP
+ HINTS ${CLHEP_ROOT_DIR}/lib ${CLHEP_LIBDIR} ${CLHEP_CONFIG_LIBDIR}
+ PATH_SUFFIXES Debug
+)
+set( CLHEP_INCLUDE_DIRS ${CLHEP_INCLUDE_DIR} )
+set( CLHEP_LIBRARIES ${CLHEP_LIBRARY} )
+
+if( NOT CLHEP_VERSION )
+ if(IS_DIRECTORY ${CLHEP_INCLUDE_DIR})
+ file(STRINGS "${CLHEP_INCLUDE_DIR}/CLHEP/ClhepVersion.h" _CLHEP_VERS)
+ string(
+ REGEX MATCH
+ "static std::string String\\(\\) *{ *return *\"[^\"]*\""
+ _CLHEP_VERSION_STR "${_CLHEP_VERS}"
+ )
+ message(STATUS "_CLHEP_VERSION_STR ${_CLHEP_VERSION_STR}")
+ string(
+ REGEX MATCH
+ "[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*"
+ CLHEP_VERSION ${_CLHEP_VERSION_STR}
+ )
+ endif()
+endif()
+if( CLHEP_VERSION )
+ string(REPLACE "." ";" t_list ${CLHEP_VERSION})
+ list(APPEND t_list 0 0) # add a buffer in case supversion not set
+ list(GET t_list 0 CLHEP_VERSION_MAJOR)
+ list(GET t_list 1 CLHEP_VERSION_MINOR)
+ list(GET t_list 2 CLHEP_VERSION_PATCH)
+endif()
+#=============================================================================
+# handle the QUIETLY and REQUIRED arguments and set CLHEP_FOUND to TRUE if all
+# listed variables are TRUE
+find_package_handle_standard_args( CLHEP
+ FOUND_VAR
+ CLHEP_FOUND
+ REQUIRED_VARS
+ CLHEP_INCLUDE_DIR
+ CLHEP_LIBRARY
+ VERSION_VAR
+ CLHEP_VERSION
+ )
+
+mark_as_advanced( CLHEP_ROOT_DIR CLHEP_VERSION CLHEP_LIBRARY CLHEP_INCLUDE_DIR
+ CLHEP_LIBRARY_DEBUG CLHEP_USE_PKGCONFIG CLHEP_CONFIG )
+
+#=============================================================================
+# Register imported libraries:
+# 1. If we can find a Windows .dll file (or if we can find both Debug and
+# Release libraries), we will set appropriate target properties for these.
+# 2. However, for most systems, we will only register the import location and
+# include directory.
+
+# Look for dlls, or Release and Debug libraries.
+if(WIN32)
+ string( REPLACE ".lib" ".dll" CLHEP_LIBRARY_DLL "${CLHEP_LIBRARY}" )
+ string( REPLACE ".lib" ".dll" CLHEP_LIBRARY_DEBUG_DLL "${CLHEP_LIBRARY_DEBUG}" )
+endif()
+
+if( CLHEP_FOUND AND NOT TARGET CLHEP::CLHEP )
+ if( EXISTS "${CLHEP_LIBRARY_DLL}")
+
+ # Windows systems with dll libraries.
+ add_library( CLHEP::CLHEP SHARED IMPORTED )
+ add_library( CLHEP::CLHEPcblas SHARED IMPORTED )
+
+ # Windows with dlls, but only Release libraries.
+ set_target_properties( CLHEP::CLHEP PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${CLHEP_LIBRARY_DLL}"
+ IMPORTED_IMPLIB "${CLHEP_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CLHEP_INCLUDE_DIRS}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ )
+
+ # If we have both Debug and Release libraries
+ if( EXISTS "${CLHEP_LIBRARY_DEBUG_DLL}")
+ set_property( TARGET CLHEP::CLHEP APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( CLHEP::CLHEP PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${CLHEP_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${CLHEP_LIBRARY_DEBUG}" )
+ endif()
+
+ else()
+
+ # For all other environments (ones without dll libraries), create
+ # the imported library targets.
+ add_library( CLHEP::CLHEP UNKNOWN IMPORTED )
+ set_target_properties( CLHEP::CLHEP PROPERTIES
+ IMPORTED_LOCATION "${CLHEP_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CLHEP_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ )
+ endif()
+endif()
diff --git a/cmake/Modules/Findclhep.cmake b/cmake/Modules/Findclhep.cmake
deleted file mode 100644
index 93c796c..0000000
--- a/cmake/Modules/Findclhep.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-include (FindPackageMessage)
-include(FindPackageHandleStandardArgs)
-
-message (STATUS "Detecting clhep installation")
-execute_process (COMMAND clhep-config --prefix
- OUTPUT_VARIABLE clhep_PREFIX
- )
-if (clhep_PREFIX)
- string (REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" clhep_PREFIX ${clhep_PREFIX} )
- message (STATUS "clhep installation found: ${clhep_PREFIX}")
- EXECUTE_PROCESS(COMMAND clhep-config --libs OUTPUT_VARIABLE
- CLHEP_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
- EXECUTE_PROCESS(COMMAND clhep-config --version OUTPUT_VARIABLE
- clhep_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "CLHEP " "" clhep_VERSION ${clhep_VERSION})
- set (CLHEP_INCLUDE_DIRS ${clhep_PREFIX}/include)
- set (clhep_FOUND TRUE)
-else (clhep_PREFIX)
- set (clhep_FOUND FALSE)
-endif (clhep_PREFIX)
-
-find_package_handle_standard_args(clhep
- FOUND_VAR
- clhep_FOUND
- REQUIRED_VARS
- CLHEP_INCLUDE_DIRS
- CLHEP_LIBRARIES
- VERSION_VAR
- clhep_VERSION
- )
-
-mark_as_advanced(
- CLHEP_INCLUDE_DIRS
- CLHEP_LIBRARIES
-)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jan 20, 10:58 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242747
Default Alt Text
(22 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment