Commit e9cbd6c2 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

fixed use of simplenn

parent 132fccee
Pipeline #3274333 passed with stage
in 35 seconds
......@@ -68,7 +68,6 @@ lhcb_add_subdirectories(
Phys/SelPy
PhysSel/PhysSelPython
Phys/FlavourTagging
Phys/FlavourTagging/src/Classification/simpleNN
Phys/GenericVertexFinder
Phys/HighPtJets
Phys/LoKiJets
......
......@@ -13,6 +13,23 @@ Phys/FlavourTagging
-------------------
#]=======================================================================]
# Get and make available the header only libraries simplenn and libfvm
include(FetchContent)
set(SIMPLENN_TAG version-0.1.0 CACHE STRING "simpleNN version")
set(LIBFVM_TAG version-0.1.0 CACHE STRING "libfvm version (to set according to simpleNN)")
mark_as_advanced(SIMPLENN_TAG LIBFVM_TAG)
FetchContent_Declare(libfvm
URL "https://gitlab.cern.ch/mschille/libfvm/-/archive/${LIBFVM_TAG}/libfvm-${LIBFVM_TAG}.tar.gz"
)
FetchContent_Declare(simplenn
URL "https://gitlab.cern.ch/mschille/simplenn/-/archive/${SIMPLENN_TAG}/simplenn-${SIMPLENN_TAG}.tar.gz"
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/simplenn.patch
)
FetchContent_MakeAvailable(libfvm simplenn)
# Normal business from here on
gaudi_add_header_only_library(FlavourTaggingLib
LINK
Gaudi::GaudiKernel
......
--- simplenn-src/CMakeLists.txt.orig 2021-11-23 13:16:41.184000000 +0100
+++ simplenn-src/CMakeLists.txt 2021-11-23 13:17:24.307331737 +0100
@@ -14,8 +14,7 @@
endif()
set(libfvm_MIN_VERSION 0.1)
-find_package(libfvm QUIET)
-if (NOT libfvm_FOUND)
+if (NOT TARGET libfvm)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libfvm/include)
message(STATUS getting libfvm from git submodule)
# libfvm is not installed on system, so build the submodule
###############################################################################
# (c) Copyright 2020-2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
set(SIMPLENN_TAG version-0.1.0)
set(LIBFVM_TAG version-0.1.0) # Set according to simpleNN!
set(SUBMODULE_SRC_DIR "${PROJECT_SOURCE_DIR}/Phys/FlavourTagging/src/Classification/simpleNN/submodule")
set(SIMPLENN_URL "https://gitlab.cern.ch/mschille/simplenn/-/archive/${SIMPLENN_TAG}/simplenn-${SIMPLENN_TAG}.tar.gz")
set(LIBFVM_URL "https://gitlab.cern.ch/mschille/libfvm/-/archive/${LIBFVM_TAG}/libfvm-${LIBFVM_TAG}.tar.gz")
if(NOT EXISTS ${SUBMODULE_SRC_DIR}/simplenn.tar.gz)
message(STATUS "Downloading simpleNN(${SIMPLENN_TAG}) sources")
file(DOWNLOAD ${SIMPLENN_URL} "${SUBMODULE_SRC_DIR}/simplenn.tar.gz"
SHOW_PROGRESS STATUS SIMPLENN_DOWNLOAD_STATUS)
list(GET SIMPLENN_DOWNLOAD_STATUS 0 SIMPLENN_DOWNLOAD_STATUS_CODE)
if(NOT SIMPLENN_DOWNLOAD_STATUS_CODE EQUAL 0)
list(GET SIMPLENN_DOWNLOAD_STATUS 1 SIMPLENN_DOWNLOAD_ERROR)
message(FATAL_ERROR "Could not download simpleNN. Reason: ${SIMPLENN_DOWNLOAD_ERROR}")
endif()
file(MAKE_DIRECTORY "${SUBMODULE_SRC_DIR}/simplenn")
execute_process(COMMAND tar -xf "${SUBMODULE_SRC_DIR}/simplenn.tar.gz" --directory "${SUBMODULE_SRC_DIR}/simplenn" --strip-components 1)
endif()
if(NOT EXISTS ${SUBMODULE_SRC_DIR}/libfvm.tar.gz)
message(STATUS "Downloading libfvm(${LIBFVM_TAG}) sources")
file(DOWNLOAD ${LIBFVM_URL} "${SUBMODULE_SRC_DIR}/libfvm.tar.gz"
SHOW_PROGRESS STATUS LIBFVM_DOWNLOAD_STATUS)
list(GET LIBFVM_DOWNLOAD_STATUS 0 LIBFVM_DOWNLOAD_STATUS_CODE)
if(NOT LIBFVM_DOWNLOAD_STATUS_CODE EQUAL 0)
list(GET LIBFVM_DOWNLOAD_STATUS 1 LIBFVM_DOWNLOAD_ERROR)
message(FATAL_ERROR "Could not download libfvm. Reason: ${LIBFVM_DOWNLOAD_ERROR}")
endif()
file(MAKE_DIRECTORY "${SUBMODULE_SRC_DIR}/simplenn/libfvm")
execute_process(COMMAND tar -xf "${SUBMODULE_SRC_DIR}/libfvm.tar.gz" --directory "${SUBMODULE_SRC_DIR}/simplenn/libfvm" --strip-components 1)
endif()
set(simplenn_disable_tests ON CACHE BOOL "Disable simplenn unit tests")
set(libfvm_disable_tests ON CACHE BOOL "Disable libfvm unit tests")
add_subdirectory(submodule/simplenn)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment