-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f060a2e
commit 5cae00b
Showing
11 changed files
with
425 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
function(install_correctionlib) | ||
execute_process(COMMAND "${Python_EXECUTABLE}" "-c" "import correctionlib; print(correctionlib.__version__)" | ||
RESULT_VARIABLE PACKAGE_NOT_FOUND | ||
OUTPUT_VARIABLE PACKAGE_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
if(${PACKAGE_NOT_FOUND} EQUAL 1) | ||
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install ${_pip_args} git+https://github.com/cms-nanoAOD/correctionlib.git) | ||
endif() | ||
message(STATUS "Found correctionlib !") | ||
execute_process( | ||
COMMAND "${Python_EXECUTABLE}" "-c" | ||
"import correctionlib; print(correctionlib.__version__)" | ||
RESULT_VARIABLE PACKAGE_NOT_FOUND | ||
OUTPUT_VARIABLE PACKAGE_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
if(${PACKAGE_NOT_FOUND} EQUAL 1) | ||
execute_process( | ||
COMMAND ${Python_EXECUTABLE} -m pip install ${_pip_args} | ||
git+https://github.com/cms-nanoAOD/correctionlib.git) | ||
endif() | ||
message(STATUS "Found correctionlib !") | ||
endfunction() | ||
|
||
# Adding correctionlib for scale factor evaluation | ||
# for now the official pip package has some problem | ||
# in the future "find_python_package(correctionlib correctionlib X.X)" should hopefully work | ||
# Adding correctionlib for scale factor evaluation for now the official pip | ||
# package has some problem in the future "find_python_package(correctionlib | ||
# correctionlib X.X)" should hopefully work | ||
install_correctionlib() | ||
message(STATUS "Setting up correctionlib ...") | ||
execute_process(COMMAND correction config --cmake | ||
OUTPUT_VARIABLE CORRECTION_LIB_ARGS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process( | ||
COMMAND correction config --cmake | ||
OUTPUT_VARIABLE CORRECTION_LIB_ARGS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
string(REPLACE -Dcorrectionlib_DIR= "" CORRECTIONLIBPATH ${CORRECTION_LIB_ARGS}) | ||
# if correctionlib comes from cvmfs, change the correctionlibpath accordingly | ||
if (${CORRECTIONLIBPATH} MATCHES "^/cvmfs/") | ||
message(STATUS "Setting up correctionlib from cvmfs ...") | ||
set(USING_CVMFS TRUE) | ||
find_package(correctionlib) | ||
find_library(CORRECTION_LIB_PATH correctionlib) | ||
if(${CORRECTIONLIBPATH} MATCHES "^/cvmfs/") | ||
message(STATUS "Setting up correctionlib from cvmfs ...") | ||
set(USING_CVMFS TRUE) | ||
find_package(correctionlib) | ||
find_library(CORRECTION_LIB_PATH correctionlib) | ||
else() | ||
message(STATUS "Setting up correctionlib from local setup ...") | ||
set(USING_CVMFS FALSE) | ||
find_package(correctionlib REQUIRED PATHS ${CORRECTIONLIBPATH}) | ||
set(CORRECTION_LIB_PATH "${CORRECTIONLIBPATH}/../lib/libcorrectionlib.so") | ||
message(STATUS "Setting up correctionlib from local setup ...") | ||
set(USING_CVMFS FALSE) | ||
find_package(correctionlib REQUIRED PATHS ${CORRECTIONLIBPATH}) | ||
set(CORRECTION_LIB_PATH "${CORRECTIONLIBPATH}/../lib/libcorrectionlib.so") | ||
endif() | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
|
||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
message(STATUS "Correctionlib library path: ${CORRECTION_LIB_PATH}") | ||
message(STATUS "Correctionlib library path: ${CORRECTION_LIB_PATH}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
message(STATUS "Including spdlog.") | ||
# Build the logging library | ||
include(ExternalProject) | ||
ExternalProject_Add(spdlog | ||
PREFIX spdlog | ||
GIT_REPOSITORY https://github.com/gabime/spdlog.git | ||
GIT_SHALLOW 1 | ||
GIT_TAG v1.8.5 | ||
CMAKE_ARGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} | ||
-DCMAKE_CXX_FLAGS=-fpic | ||
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 | ||
BUILD_BYPRODUCTS ${CMAKE_INSTALL_PREFIX}/lib64/libspdlog.a | ||
BUILD_BYPRODUCTS ${CMAKE_INSTALL_PREFIX}/lib/libspdlog.a | ||
) | ||
ExternalProject_Add( | ||
spdlog | ||
PREFIX spdlog | ||
GIT_REPOSITORY https://github.com/gabime/spdlog.git | ||
GIT_SHALLOW 1 | ||
GIT_TAG v1.8.5 | ||
CMAKE_ARGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DCMAKE_CXX_FLAGS=-fpic | ||
LOG_DOWNLOAD 1 | ||
LOG_CONFIGURE 1 | ||
LOG_BUILD 1 | ||
LOG_INSTALL 1 | ||
BUILD_BYPRODUCTS ${CMAKE_INSTALL_PREFIX}/lib64/libspdlog.a | ||
BUILD_BYPRODUCTS ${CMAKE_INSTALL_PREFIX}/lib/libspdlog.a) | ||
|
||
message(STATUS "Configuring spdlog.") | ||
# Make an imported target out of the build logging library | ||
add_library(logging STATIC IMPORTED) | ||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include") # required because the include dir must be existent for INTERFACE_INCLUDE_DIRECTORIES | ||
include(GNUInstallDirs) # required to populate CMAKE_INSTALL_LIBDIR with lib or lib64 required for the destination of libspdlog.a | ||
set_target_properties(logging PROPERTIES | ||
IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libspdlog.a" | ||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/include") | ||
add_dependencies(logging spdlog) # enforces to build spdlog before making the imported target | ||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include" | ||
)# required because the include dir must be existent for | ||
# INTERFACE_INCLUDE_DIRECTORIES | ||
include(GNUInstallDirs) # required to populate CMAKE_INSTALL_LIBDIR with lib or | ||
# lib64 required for the destination of libspdlog.a | ||
set_target_properties( | ||
logging | ||
PROPERTIES IMPORTED_LOCATION | ||
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libspdlog.a" | ||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/include") | ||
add_dependencies(logging spdlog) # enforces to build spdlog before making the | ||
# imported target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
# Find ONNXRuntime | ||
# first check if we have an LCG stack via LCG_VERSION environment variable | ||
if (DEFINED ENV{LCG_VERSION}) | ||
string(REPLACE ":" ";" RUNTIME_PATH "$ENV{LD_LIBRARY_PATH}") | ||
message(STATUS "Found LCG stack, using it to find ONNXRuntime") | ||
find_library(ONNX_RUNTIME_LIB_PATH | ||
NAMES onnxruntime | ||
HINTS ${RUNTIME_PATH} | ||
) | ||
if (ONNX_RUNTIME_LIB_PATH) | ||
# get the real path of the library to find the include directory | ||
get_filename_component(ONNX_RUNTIME_LIB_PATH ${ONNX_RUNTIME_LIB_PATH} REALPATH) | ||
get_filename_component(ONNX_RUNTIME_INCLUDE_PATH ${ONNX_RUNTIME_LIB_PATH}/../../include REALPATH) | ||
message(STATUS "ONNXRuntime include path: ${ONNX_RUNTIME_INCLUDE_PATH}") | ||
include_directories("${ONNX_RUNTIME_INCLUDE_PATH}/core/session") | ||
endif() | ||
# Find ONNXRuntime first check if we have an LCG stack via LCG_VERSION | ||
# environment variable | ||
if(DEFINED ENV{LCG_VERSION}) | ||
string(REPLACE ":" ";" RUNTIME_PATH "$ENV{LD_LIBRARY_PATH}") | ||
message(STATUS "Found LCG stack, using it to find ONNXRuntime") | ||
find_library( | ||
ONNX_RUNTIME_LIB_PATH | ||
NAMES onnxruntime | ||
HINTS ${RUNTIME_PATH}) | ||
if(ONNX_RUNTIME_LIB_PATH) | ||
# get the real path of the library to find the include directory | ||
get_filename_component(ONNX_RUNTIME_LIB_PATH ${ONNX_RUNTIME_LIB_PATH} | ||
REALPATH) | ||
get_filename_component(ONNX_RUNTIME_INCLUDE_PATH | ||
${ONNX_RUNTIME_LIB_PATH}/../../include REALPATH) | ||
message(STATUS "ONNXRuntime include path: ${ONNX_RUNTIME_INCLUDE_PATH}") | ||
include_directories("${ONNX_RUNTIME_INCLUDE_PATH}/core/session") | ||
endif() | ||
|
||
message(STATUS "ONNXRuntime library path: ${ONNX_RUNTIME_LIB_PATH}") | ||
message(STATUS "ONNXRuntime library path: ${ONNX_RUNTIME_LIB_PATH}") | ||
else() | ||
message(STATUS "No LCG stack found, not adding ONNXRuntime") | ||
endif() | ||
message(STATUS "No LCG stack found, not adding ONNXRuntime") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.