Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8724269
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
23 KB
Subscribers
None
View Options
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8cb81d..e77b1e9 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)
include_directories(${CLHEP_INCLUDE_DIRS})
-find_package(lhapdf REQUIRED)
-include_directories(${lhapdf_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 75ddbc7..f12bc17 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)
include_directories(${CLHEP_INCLUDE_DIRS})
-find_package(lhapdf REQUIRED)
-include_directories(${lhapdf_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/FindLHAPDF.cmake b/cmake/Modules/FindLHAPDF.cmake
new file mode 100644
index 0000000..5b425cd
--- /dev/null
+++ b/cmake/Modules/FindLHAPDF.cmake
@@ -0,0 +1,218 @@
+# 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:
+# FindLHAPDF
+# --------
+#
+# Find the native LHAPDF includes and libraries.
+#
+# LHAPDF 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 LHAPDF is found, this module defines the following
+# :prop_tgt:`IMPORTED` target::
+#
+# LHAPDF::LHAPDF - The main LHAPDF library.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module will set the following variables in your project::
+#
+# LHAPDF_FOUND - True if LHAPDF found on the local system
+# LHAPDF_INCLUDE_DIRS - Location of LHAPDF header files.
+# LHAPDF_LIBRARIES - The LHAPDF libraries.
+# LHAPDF_VERSION - The version of the discovered LHAPDF install.
+#
+# Hints
+# ^^^^^
+#
+# Set ``LHAPDF_ROOT_DIR`` to a directory that contains a LHAPDF installation.
+#
+# This script expects to find libraries at ``$LHAPDF_ROOT_DIR/lib`` and the LHAPDF
+# headers at ``$LHAPDF_ROOT_DIR/include/LHAPDF``. The library directory may
+# optionally provide Release and Debug folders. For Unix-like systems, this
+# script will use ``$LHAPDF_ROOT_DIR/bin/LHAPDF-config`` (if found) to aid in the
+# discovery LHAPDF.
+#
+# Cache Variables
+# ^^^^^^^^^^^^^^^
+#
+# This module may set the following variables depending on platform and type
+# of LHAPDF installation discovered. These variables may optionally be set to
+# help this module find the correct files::
+#
+# LHAPDF_CONFIG_EXECUTABLE - Location of the ``LHAPDF-config`` script (if any).
+# LHAPDF_LIBRARY - Location of the LHAPDF library.
+# LHAPDF_LIBRARY_DEBUG - Location of the debug LHAPDF library (if any).
+#
+
+# Include these modules to handle the QUIETLY and REQUIRED arguments.
+include(FindPackageHandleStandardArgs)
+
+#=============================================================================
+# If the user has provided ``LHAPDF_ROOT_DIR``, use it! Choose items found
+# at this location over system locations.
+if( EXISTS "$ENV{LHAPDF_ROOT_DIR}" )
+ file( TO_CMAKE_PATH "$ENV{LHAPDF_ROOT_DIR}" LHAPDF_ROOT_DIR )
+ set( LHAPDF_ROOT_DIR "${LHAPDF_ROOT_DIR}" CACHE PATH "Prefix for LHAPDF installation." )
+endif()
+if( NOT EXISTS "${LHAPDF_ROOT_DIR}" )
+ set( LHAPDF_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 ``LHAPDF_INCLUDEDIR`` and ``LHAPDF_LIBDIR`` used below.
+if( LHAPDF_USE_PKGCONFIG )
+ find_package(PkgConfig)
+ pkg_check_modules( LHAPDF QUIET LHAPDF )
+
+ if( EXISTS "${LHAPDF_INCLUDEDIR}" )
+ get_filename_component( LHAPDF_ROOT_DIR "${LHAPDF_INCLUDEDIR}" DIRECTORY CACHE)
+ endif()
+endif()
+
+#=============================================================================
+# Set LHAPDF_INCLUDE_DIRS and LHAPDF_LIBRARIES. If we skipped the PkgConfig step, try
+# to find the libraries at $LHAPDF_ROOT_DIR (if provided), in the directory
+# suggested by LHAPDF-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 LHAPDF-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 LHAPDF-config
+if( NOT LHAPDF_VERSION )
+ find_program( LHAPDF_CONFIG_EXECUTABLE
+ NAMES lhapdf-config
+ HINTS "${LHAPDF_ROOT_DIR}/bin"
+ )
+ if( EXISTS "${LHAPDF_CONFIG_EXECUTABLE}" )
+ execute_process(
+ COMMAND "${LHAPDF_CONFIG_EXECUTABLE}" --version
+ OUTPUT_VARIABLE LHAPDF_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ execute_process(
+ COMMAND "${LHAPDF_CONFIG_EXECUTABLE}" --incdir
+ OUTPUT_VARIABLE LHAPDF_CONFIG_INCLUDEDIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ execute_process(
+ COMMAND "${LHAPDF_CONFIG_EXECUTABLE}" --libdir
+ OUTPUT_VARIABLE LHAPDF_CONFIG_LIBDIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ endif()
+endif()
+find_path( LHAPDF_INCLUDE_DIR
+ NAMES LHAPDF/LHAPDF.h LHAPDF/LHAPDFDefs.h
+ HINTS ${LHAPDF_ROOT_DIR}/include ${LHAPDF_INCLUDEDIR} ${LHAPDF_CONFIG_INCLUDEDIR}
+)
+find_library( LHAPDF_LIBRARY
+ NAMES LHAPDF
+ HINTS ${LHAPDF_ROOT_DIR}/lib ${LHAPDF_LIBDIR} ${LHAPDF_CONFIG_LIBDIR}
+ PATH_SUFFIXES Release Debug
+)
+# Do we also have debug versions?
+find_library( LHAPDF_LIBRARY_DEBUG
+ NAMES LHAPDF
+ HINTS ${LHAPDF_ROOT_DIR}/lib ${LHAPDF_LIBDIR} ${LHAPDF_CONFIG_LIBDIR}
+ PATH_SUFFIXES Debug
+)
+set( LHAPDF_INCLUDE_DIRS ${LHAPDF_INCLUDE_DIR} )
+set( LHAPDF_LIBRARIES ${LHAPDF_LIBRARY} )
+
+if( NOT LHAPDF_VERSION )
+ if(IS_DIRECTORY ${LHAPDF_INCLUDE_DIR})
+ file(STRINGS "${LHAPDF_INCLUDE_DIR}/LHAPDF/LHAPDFDefs.h" _LHAPDF_DEFS)
+ file(STRINGS "${LHAPDF_INCLUDE_DIR}/LHAPDF/Version.h" _LHAPDF_VERS)
+ string(
+ REGEX MATCH
+ "#define *LHAPDF_VERSION *\"[^\"]*\""
+ _LHAPDF_VERSION_STR "${_LHAPDF_DEFS} ${_LHAPDF_VERS}"
+ )
+ string(
+ REGEX MATCH
+ "[0-9]*\\.[0-9]*\\.[0-9]*"
+ LHAPDF_VERSION ${_LHAPDF_VERSION_STR}
+ )
+ endif()
+endif()
+if( LHAPDF_VERSION )
+ string(REPLACE "." ";" t_list ${LHAPDF_VERSION})
+ list(APPEND t_list 0 0) # add a buffer in case supversion not set
+ list(GET t_list 0 LHAPDF_VERSION_MAJOR)
+ list(GET t_list 1 LHAPDF_VERSION_MINOR)
+ list(GET t_list 2 LHAPDF_VERSION_PATCH)
+endif()
+#=============================================================================
+# handle the QUIETLY and REQUIRED arguments and set LHAPDF_FOUND to TRUE if all
+# listed variables are TRUE
+find_package_handle_standard_args( LHAPDF
+ FOUND_VAR
+ LHAPDF_FOUND
+ REQUIRED_VARS
+ LHAPDF_INCLUDE_DIR
+ LHAPDF_LIBRARY
+ VERSION_VAR
+ LHAPDF_VERSION
+ )
+
+mark_as_advanced( LHAPDF_ROOT_DIR LHAPDF_VERSION LHAPDF_LIBRARY LHAPDF_INCLUDE_DIR
+ LHAPDF_LIBRARY_DEBUG LHAPDF_USE_PKGCONFIG LHAPDF_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" LHAPDF_LIBRARY_DLL "${LHAPDF_LIBRARY}" )
+ string( REPLACE ".lib" ".dll" LHAPDF_LIBRARY_DEBUG_DLL "${LHAPDF_LIBRARY_DEBUG}" )
+endif()
+
+if( LHAPDF_FOUND AND NOT TARGET LHAPDF::LHAPDF )
+ if( EXISTS "${LHAPDF_LIBRARY_DLL}")
+
+ # Windows systems with dll libraries.
+ add_library( LHAPDF::LHAPDF SHARED IMPORTED )
+ add_library( LHAPDF::LHAPDFcblas SHARED IMPORTED )
+
+ # Windows with dlls, but only Release libraries.
+ set_target_properties( LHAPDF::LHAPDF PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${LHAPDF_LIBRARY_DLL}"
+ IMPORTED_IMPLIB "${LHAPDF_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LHAPDF_INCLUDE_DIRS}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ )
+
+ # If we have both Debug and Release libraries
+ if( EXISTS "${LHAPDF_LIBRARY_DEBUG_DLL}")
+ set_property( TARGET LHAPDF::LHAPDF APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( LHAPDF::LHAPDF PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${LHAPDF_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${LHAPDF_LIBRARY_DEBUG}" )
+ endif()
+
+ else()
+
+ # For all other environments (ones without dll libraries), create
+ # the imported library targets.
+ add_library( LHAPDF::LHAPDF UNKNOWN IMPORTED )
+ set_target_properties( LHAPDF::LHAPDF PROPERTIES
+ IMPORTED_LOCATION "${LHAPDF_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LHAPDF_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ )
+ endif()
+endif()
diff --git a/cmake/Modules/Findlhapdf.cmake b/cmake/Modules/Findlhapdf.cmake
deleted file mode 100644
index 90eb8ad..0000000
--- a/cmake/Modules/Findlhapdf.cmake
+++ /dev/null
@@ -1,26 +0,0 @@
-include (FindPackageMessage)
-
-message (STATUS "Detecting lhapdf installation")
-execute_process (COMMAND lhapdf-config --prefix
- OUTPUT_VARIABLE lhapdf_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-if (lhapdf_PREFIX)
- string (STRIP ${lhapdf_PREFIX} lhapdf_PREFIX)
- message (STATUS "lhapdf installation found: ${lhapdf_PREFIX}")
- EXECUTE_PROCESS(COMMAND lhapdf-config --ldflags OUTPUT_VARIABLE
- LHAPDF_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
- # set (lhapdf_LIBRARIES ${lhapdf_LIBRARIES} )
- set (lhapdf_INCLUDE_DIRS ${lhapdf_PREFIX}/include)
- set (lhapdf_FOUND TRUE)
-else (lhapdf_PREFIX)
- set (lhapdf_FOUND FALSE)
-endif (lhapdf_PREFIX)
-
-if (NOT lhapdf_FOUND)
- message(FATAL_ERROR "lhapdf installation not found!")
-endif (NOT lhapdf_FOUND)
-
-mark_as_advanced(
- lhapdf_INCLUDE_DIRS
- lhapdf_LIBRARIES
-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e54b15..b369c4c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,19 +1,28 @@
file(GLOB src_files *.cc)
add_library(hejlib SHARED ${src_files})
set_target_properties(hejlib PROPERTIES OUTPUT_NAME "HEJ")
+message(STATUS "LHAPDF_LIBRARIES ${LHAPDF_LIBRARIES}")
+message(STATUS "CLHEP_LIBRARIES ${CLHEP_LIBRARIES}")
+message(STATUS "FASTJET_LIBRARIES ${FASTJET_LIBRARIES}")
+message(STATUS "Boost_LIBRARIES ${Boost_LIBRARIES}")
+message(STATUS "YAML_CPP_LIBRARIES ${YAML_CPP_LIBRARIES}")
+message(STATUS "QCDloop_LIBRARIES ${QCDloop_LIBRARIES}")
+message(STATUS "HepMC_LIBRARIES ${HepMC_LIBRARIES}")
+message(STATUS "rivet_LIBRARIES ${rivet_LIBRARIES}")
+
set(libraries ${CMAKE_DL_LIBS} ${LHAPDF_LIBRARIES} ${CLHEP_LIBRARIES}
${FASTJET_LIBRARIES} ${Boost_LIBRARIES} ${YAML_CPP_LIBRARIES} yaml-cpp)
if(${QCDloop_FOUND})
list(APPEND libraries ${QCDloop_LIBRARIES} quadmath)
endif()
if(${HepMC_FOUND})
list(APPEND libraries ${HepMC_LIBRARIES})
if(${rivet_FOUND})
list(APPEND libraries ${rivet_LIBRARIES})
endif()
endif()
target_link_libraries(hejlib ${libraries})
install(TARGETS hejlib DESTINATION ${INSTALL_LIB_DIR})
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
4242751
Default Alt Text
(23 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment