diff --git a/CMakeLists.txt b/CMakeLists.txt index 788f54a491680d0f918d707afe552119c9a28abd..249aa244a478a78ff56ed7f9c98ccbff5ceb8170 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,11 +18,12 @@ ENABLE_LANGUAGE(CXX) ENABLE_LANGUAGE(C) SET(Online_DIR ${CMAKE_SOURCE_DIR} CACHE STRING "Online directory") -option(SUPPORT_GAUDI "Build Online dataflow stuff and GaudiOnline components" ON) -option(HAVE_EB "Include event builder library in build" ON) -option(PLUGIN_SOURCES "[Standalone build] Path to the Gaudi Plugin manager sources" OFF) -option(LCG_VIEW "[Standalone build] Path to LCG View" OFF) -option(BINARY_TAG "[Standalone build] Binary tag of packages used from LCG View" OFF) +option(SUPPORT_GAUDI "Build Online dataflow stuff and GaudiOnline components" ON) +option(HAVE_EB "Include event builder library in build" ON) +option(PLUGIN_SOURCES "[Standalone build] Path to the Gaudi Plugin manager sources" OFF) +option(LCG_VIEW "[Standalone build] Path to LCG View" OFF) +option(BINARY_TAG "[Standalone build] Binary tag of packages used from LCG View" OFF) +option(EVENTBUILDER_ONLY "[Standalone build] Build eventbuilder and dependencies only" OFF) list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) @@ -62,6 +63,9 @@ else() message ( STATUS "+++===========================================================================================+++" ) include(OnlineStandalone) # + if ( NOT BINARY_TAG ) + get_filename_component(BINARY_TAG "${LCG_VIEW}" NAME) + endif() set(ONLINE_PREREQUISITES) online_check_prerequisites(ONLINE_PREREQUISITES) if ( NOT "${ONLINE_PREREQUISITES}" STREQUAL "OK" ) @@ -70,11 +74,23 @@ else() endif() # online_set_compiler_flags() + if ( EXISTS ${PLUGIN_SOURCES}/src/PluginServiceV1.cpp ) + # Import plugin manager from Gaudi + online_locate_dependencies() + online_build_pluginmanager(${PLUGIN_SOURCES}) + else() + # Import plugin manager from the LCG View + set(_view "${LCG_VIEW}") + set(ONLINE_LCG_VIEW_SETUP "${_view}/setup.sh") + set(CMAKE_PREFIX_PATH "${_view}:${_view}/lib:${_view}/lib64:${CMAKE_PREFIX_PATH}") + online_env(SET ONLINE_RUNTIME_PATH "${_view}/bin") + online_env(SET ONLINE_LIBRARY_PATH "${_view}/lib:${_view}/lib64") + online_import_pluginmanager(${LCG_VIEW}) + endif() online_locate_dependencies() # ======================================================================= include(OnlineDependencies) online_print_setup() - online_build_pluginmanager(${PLUGIN_SOURCES}) endif() # # ======================================================================= @@ -108,31 +124,35 @@ if ( 1 ) # # Dataflow components add_subdirectory(Online/HTTP) + add_subdirectory(Online/RPC) + add_subdirectory(Online/RPCServer) + add_subdirectory(Online/ROMon) add_subdirectory(Online/sqldb) add_subdirectory(Online/Storage) add_subdirectory(Online/Parsers) add_subdirectory(Online/Dataflow) add_subdirectory(Online/DataflowExample) - if ( HAVE_EB ) + if ( HAVE_EB OR EVENTBUILDER_ONLY ) add_subdirectory(Online/EventBuilding) endif() # # Other online monitoring, logger and controller stuff - add_subdirectory(Online/UPI) - add_subdirectory(Online/ROMon) - add_subdirectory(Online/RPC) - add_subdirectory(Online/RPCServer) - add_subdirectory(Online/GauchoServer) - add_subdirectory(Online/DefHLTUtils) - add_subdirectory(Online/IPMI) - add_subdirectory(Online/MBMDump) - add_subdirectory(Online/PcSrv) - add_subdirectory(Online/PyDIM) - add_subdirectory(Online/ROLogger) - add_subdirectory(Online/smixx) - add_subdirectory(Online/SmiController) - add_subdirectory(Online/TestBeam) - add_subdirectory(Online/Checkpointing) + if ( NOT EVENTBUILDER_ONLY ) + add_subdirectory(Online/UPI) + add_subdirectory(Online/GauchoServer) + add_subdirectory(Online/DefHLTUtils) + add_subdirectory(Online/IPMI) + add_subdirectory(Online/MBMDump) + add_subdirectory(Online/PcSrv) + add_subdirectory(Online/PyDIM) + add_subdirectory(Online/ROLogger) + # SMI controller + add_subdirectory(Online/smixx) + add_subdirectory(Online/SmiController) + # Debug utilities + add_subdirectory(Online/TestBeam) + add_subdirectory(Online/Checkpointing) + endif() endif() # ======================================================================= # Standalone build ends here: diff --git a/MyOnline/ROMon.xml/EBSCIFI.xml b/MyOnline/ROMon.xml/EBSCIFI.xml index 0c39cb432ea41f001885ebb799bc1cc3e1d6f671..7852ca65e64432066d7845e51e97e12e048c4315 100644 --- a/MyOnline/ROMon.xml/EBSCIFI.xml +++ b/MyOnline/ROMon.xml/EBSCIFI.xml @@ -51,5 +51,6 @@ <Node name="SCEB23" type="EventBuilder"/> <Node name="SCEB24" type="EventBuilder"/> + <Node name="SUEB02" type="EventBuilder"/> </NodeList> </TaskInventory> diff --git a/MyOnline/ROMon.xml/TaskInventory.xml b/MyOnline/ROMon.xml/TaskInventory.xml index e21c840b626fbbd2a252745588b8ec0e7ff989e7..5541662e11a3be873b10b36f955413a879a138ec 100644 --- a/MyOnline/ROMon.xml/TaskInventory.xml +++ b/MyOnline/ROMon.xml/TaskInventory.xml @@ -165,10 +165,6 @@ <!-- =================================================== --> <!-- =============== Event builder nodes =============== --> -<ConnectionList name="StandardEB"> - <Connection name="ecs03"/> -</ConnectionList> - <ConnectionList name="EventBuilder"> <Connection name="DATAFLOW01"/> <Connection name="DATAFLOW02"/> @@ -183,7 +179,7 @@ <Task name="TANServ"/> <Task name="ROcollect"/> <Task name="pingSrv"/> - <ConnectionList name="StandardEB"/> + <ConnectionList name="Standard"/> <ConnectionList name="EventBuilder"/> </NodeType> @@ -210,7 +206,7 @@ <Task name="ROpublish_VELO"/> <Task name="ROpublish_DATAFLOW"/> - <ConnectionList name="StandardEB"/> + <ConnectionList name="Standard"/> <ConnectionList name="EventBuilder"/> </NodeType> <!-- =================================================== --> diff --git a/Online/FarmConfig/job/BU.sh b/Online/FarmConfig/job/BU.sh index 03ab7c719695372a86ba6e981cee1e3d3966fe01..77592344dd547d799d6db2e1f438c687b76946b3 100755 --- a/Online/FarmConfig/job/BU.sh +++ b/Online/FarmConfig/job/BU.sh @@ -13,8 +13,8 @@ unset PYTHONPATH; unset PYTHONHOME; eval `/usr/bin/python2 -c "import os;s=os.environ['UTGID'];print 'export BU_OPTIONS='+s[s.find('BU'):]+'.opts'"`; # . /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64-centos7-gcc9-opt.vars; -. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-do0.vars; -#. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-opt.vars; +#. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-do0.vars; +. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-opt.vars; # . /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.${CMTCONFIG}.vars; cd ${FARMCONFIGROOT}/job; # diff --git a/Online/FarmConfig/job/RU.sh b/Online/FarmConfig/job/RU.sh index b95211bc333daf24726a1c142f62cb8f120342b0..ec85e7845b79ff3ed9b6ea4de9980b2da65f0352 100755 --- a/Online/FarmConfig/job/RU.sh +++ b/Online/FarmConfig/job/RU.sh @@ -9,8 +9,8 @@ # # ========================================================================= # -#. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-opt.vars; -. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-do0.vars; +. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-opt.vars; +#. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64_v2-centos7-gcc10-do0.vars; # . /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.x86_64-centos7-gcc9-opt.vars; #. /group/online/dataflow/EventBuilder/EventBuilderRelease/setup.${CMTCONFIG}.vars; cd ${EVENTBUILDINGROOT}/options; diff --git a/Online/ROLogger/kafka/KafkaConsumer.cpp b/Online/ROLogger/kafka/KafkaConsumer.cpp index ff41b72d7e7ab0bdf4d80883463462ce6ca49919..9bfe0ccb0ede52e48b3b56da84780a55274b8699 100644 --- a/Online/ROLogger/kafka/KafkaConsumer.cpp +++ b/Online/ROLogger/kafka/KafkaConsumer.cpp @@ -22,6 +22,9 @@ /// Framework include files #include "LogServer.h" +/// Kafka include file +#include "rdkafka.h" /* for Kafka driver */ + /// C/C++ include files #include <map> #include <memory> diff --git a/Online/ROLogger/kafka/KafkaProducer.cpp b/Online/ROLogger/kafka/KafkaProducer.cpp index cf34041f9d24814656dd9172ac5baf1c7ec47976..bfc92117baf9a61e1717a1fb2be8ee308d406088 100644 --- a/Online/ROLogger/kafka/KafkaProducer.cpp +++ b/Online/ROLogger/kafka/KafkaProducer.cpp @@ -23,6 +23,9 @@ #include "KafkaProducer.h" #include <RTL/rtl.h> +/// Kafka include file +#include "rdkafka.h" /* for Kafka driver */ + /// C/C++ include files #include <vector> #include <cstring> diff --git a/Online/ROLogger/kafka/LogServer.cpp b/Online/ROLogger/kafka/LogServer.cpp index c15e8269fd20e9e2237f318a09d4c1c6aa8d561f..a57e1eb6253b509ba3256aa1cb834b8c6fcc8353 100644 --- a/Online/ROLogger/kafka/LogServer.cpp +++ b/Online/ROLogger/kafka/LogServer.cpp @@ -25,6 +25,9 @@ #include <RTL/rtl.h> #include <dim/dis.h> +/// Kafka include file +#include "rdkafka.h" /* for Kafka driver */ + /// C/C++ include files #include <cstdio> #include <cstring> diff --git a/Online/ROLogger/kafka/LogServer.h b/Online/ROLogger/kafka/LogServer.h index 3a3d1852c2334c0e3fd68166f2bed507976db226..67330866b7209c08ad370bbf13042af1c7c8cfa6 100644 --- a/Online/ROLogger/kafka/LogServer.h +++ b/Online/ROLogger/kafka/LogServer.h @@ -27,8 +27,7 @@ #include <memory> #include <list> -/// Kafka include file -#include "rdkafka.h" /* for Kafka driver */ +typedef struct rd_kafka_message_s rd_kafka_message_t; /// kafka namespace declaration namespace kafka { diff --git a/Online/ROLogger/kafka/OutputListener.cpp b/Online/ROLogger/kafka/OutputListener.cpp index 3c7d73beca9b982273ca78fc32468eb7c6dcce40..b220211e56eb6a273fb83fc0f20f96656c928f1f 100644 --- a/Online/ROLogger/kafka/OutputListener.cpp +++ b/Online/ROLogger/kafka/OutputListener.cpp @@ -162,9 +162,9 @@ void OutputListener::handle_payload(const char* /* topic */, //printf("@%16lX: %.*s: %.*s\n", m->offset, (int)m->key_len, (char*)m->key, (int)m->len, (char*)m->payload); char* time_stamp = payload + 15; - int match = *(long*)payload == PAYLOAD_MATCH; + int pay_match = *(long*)payload == PAYLOAD_MATCH; - if ( match ) { + if ( pay_match ) { std::string raw_msg; *(time_stamp+10) = ' '; *(time_stamp+19) = 0; @@ -231,14 +231,14 @@ void OutputListener::handle_payload(const char* /* topic */, } } if ( !message_match.empty() ) { - bool match = false; + bool match_msg = false; for ( const auto& m : message_match ) { if ( std::regex_match(message, m) ) { - match = true; + match_msg = true; break; } } - if ( !match ) return; + if ( !match_msg ) return; } /// If match criteria are empty, the message is accepted. /// If not, we want to have an AND logic. diff --git a/Online/ROLogger/kafka/OutputLogger.cpp b/Online/ROLogger/kafka/OutputLogger.cpp index 57260e193572cd1183787c93a0ba9ac98b9b3a89..443ef33d56337b76447974f807f5b98bedd643e4 100644 --- a/Online/ROLogger/kafka/OutputLogger.cpp +++ b/Online/ROLogger/kafka/OutputLogger.cpp @@ -94,7 +94,7 @@ extern "C" int run_output_logger (int argc, char **argv) { graphics::consolesize(&rows,&cols); graphics::bg_black(); graphics::white(); - for(size_t i=0;i<rows;++i) ::fprintf(stdout,"\n"); + for(size_t j=0;j<rows;++j) ::fprintf(stdout,"\n"); have_colors = true; break; case 'g': // Kafka group-id diff --git a/Online/ROMon/rpc/PyRPC.cpp b/Online/ROMon/rpc/PyRPC.cpp index 28cc5416bdd321eb82fb9e27e822af78e4b022cd..86d232fbd9ef4a43f60c7d72c8f27892f54634fb 100755 --- a/Online/ROMon/rpc/PyRPC.cpp +++ b/Online/ROMon/rpc/PyRPC.cpp @@ -310,8 +310,8 @@ Arg& Arg::assign(const Data& d) { return *this; } -Arg& Arg::load(const string& v, const string& tag) { - Item it(v,tag); +Arg& Arg::load(const string& val, const string& tag) { + Item it(val,tag); string item = it.value(); if ( !item.empty() ) { if ( debug() ) cout << endl << "ITEM:" << item << endl << "End_ITEM" << endl; diff --git a/Online/ROMon/src/HltSummaryDisplay.cpp b/Online/ROMon/src/HltSummaryDisplay.cpp index 1b6c1e9f2169958263bda924b644e6d9d6b02a64..01795d65658500bfc9594c1c5e666c653cf8b956 100644 --- a/Online/ROMon/src/HltSummaryDisplay.cpp +++ b/Online/ROMon/src/HltSummaryDisplay.cpp @@ -113,8 +113,8 @@ void HltSummaryDisplay::update(const void* ptr) { int run = (*ri).first; int files = (*ri).second; run_files[run] += files; - map<int,set<string> >::iterator i = run_nodes.find(run); - if ( i == run_nodes.end() ) { + map<int,set<string> >::iterator runit = run_nodes.find(run); + if ( runit == run_nodes.end() ) { run_nodes[run] = set<string>(); } } diff --git a/Online/ROMon/src/NodeStatsCollector.cpp b/Online/ROMon/src/NodeStatsCollector.cpp index cf0370298c729ff0f501e70df676dea0c29e842d..dcb24eb096b449f39d5e73ee2504e1b8562fde0f 100644 --- a/Online/ROMon/src/NodeStatsCollector.cpp +++ b/Online/ROMon/src/NodeStatsCollector.cpp @@ -277,8 +277,8 @@ int NodeStatsCollector::monitorHLT(char* buffer, const std::vector<std::string>& } while ( (entry=::readdir(dir)) != 0 ) { int run=0, date; - int ret = ::sscanf(entry->d_name,"Run_%010d_%8d-",&run,&date); - if ( ret == 2 ) { + int status = ::sscanf(entry->d_name,"Run_%010d_%8d-",&run,&date); + if ( status == 2 ) { map<int,int>::iterator i=files.find(run); if ( i==files.end() ) files[run]=1; else ++((*i).second); diff --git a/Online/dim/CMakeLists.txt b/Online/dim/CMakeLists.txt index f820d5a23af088329cb7cdcb3261b97852aff21d..01e4c664122ec8d5efcf0a585cc6ba7bad819af2 100644 --- a/Online/dim/CMakeLists.txt +++ b/Online/dim/CMakeLists.txt @@ -97,7 +97,7 @@ endmacro() dim_exe_basic(did.exe src/did/make_did.c) target_include_directories(did.exe PRIVATE src/did ${MOTIF_INCLUDE_DIR}) target_compile_options(did.exe PRIVATE -Wno-incompatible-pointer-types) -target_link_libraries(did.exe PRIVATE Online::dim X11::X11 X11::Xt ${MOTIF_LIBRARIES}) +target_link_libraries(did.exe PRIVATE Online::dim ${MOTIF_LIBRARIES} X11::X11 X11::Xt) dim_exe(webdid src/webDid/webDid.c diff --git a/build_standalone.sh b/build_standalone.sh index 2c8cce66891f23e8e55c1932efc0e2a3c730ba31..dd88a1bfc5c72fdb268106f553128efc899cb72a 100755 --- a/build_standalone.sh +++ b/build_standalone.sh @@ -9,10 +9,13 @@ # Author : M.Frank # #=============================================================================== -export BINARY_TAG=x86_64-centos7-gcc11-dbg; -export LCG_VIEW=/cvmfs/sft.cern.ch/lcg/views/LCG_101/${BINARY_TAG}; -export RDKAFKA_DIR=/group/online/dataflow/cmtuser/libraries/kafka/rdkafka-gcc-11.1.0-opt; - +build_parse_this() { + SOURCE=${1} + # get param to "." + thisroot=$(dirname ${SOURCE}) + THIS=$(cd ${thisroot} > /dev/null;pwd); export THIS; + unset SOURCE thisroot +} #=============================================================================== # Configure project # @@ -24,74 +27,6 @@ do_echo() echo $*; $*; } -do_cmake() -{ - PARSED_ARGUMENTS=$(getopt -a -n do_cmake -o t:s:i:v: --longoptions type:,source:,install:,view: -- "[cmake step]" $*) - VALID_ARGUMENTS=$? - if [ "$VALID_ARGUMENTS" != "0" ]; then - echo "====> Invalid arguments to cmake step"; - exit 1; - fi; - build_type=; - source_dir=; - install_dir=; - lcg_view=; - eval set -- "$PARSED_ARGUMENTS"; - while : - do - case "${1}" in - -t | --type) build_type=${2}; shift 2 ;; - -s | --source) source_dir=${2}; shift 2 ;; - -i | --install) install_dir=${2}; shift 2 ;; - -v | --view) lcg_view=${2}; shift 2 ;; - # -- means the end of the arguments; drop this, and break out of the while loop - --) shift; break;; - # If invalid options were passed, then getopt should have reported an error, - # which we checked as VALID_ARGUMENTS when getopt was called... - *) echo "====> Unexpected option: $1 - this should not happen." - exit 1; shift; break;; - esac; - done; - do_echo cmake -DCMAKE_INSTALL_PREFIX="${install_dir}" \ - -DCMAKE_BUILD_TYPE=${build_type} \ - -DSUPPORT_GAUDI=OFF \ - -DLCG_VIEW=${lcg_view} \ - ${source_dir} - if [ $? -ne 0 ]; then - echo "ERROR: Failed cmake step!"; - exit 1; - fi; -} -#=============================================================================== -# Build project -# -# Author : M.Frank -# -#=============================================================================== -do_build() -{ - curr_dir=`pwd`; - top=`dirname ${curr_dir}`; - make $*; - if [ $? -ne 0 ]; then - echo "ERROR: Failed make step!"; - exit 1; - fi; -} -#=============================================================================== -# Install project -# -# Author : M.Frank -# -#=============================================================================== -do_install() -{ - make install $*; - if [ $? -ne 0 ]; then - echo "ERROR: Failed install step!"; - exit 1; - fi; -} #=============================================================================== # Print help # @@ -101,32 +36,55 @@ do_install() usage() { echo " do_make -opt [-opt]" - echo " -t --type <build_type> Supply build type Debug0|Debug|Release. Default: Debug0"; - echo " -s --source <source directory> Source directory for cmake"; - echo " Default: `pwd`"; - echo " CMakeLists.txt required!"; - echo " -b --build <build directory> Build directory for cmake"; - echo " Default: `pwd`/dataflow_build.${binary_tag}"; - echo " -i --install <install directory> Installation directory for cmake"; - echo " Default: `pwd`/dataflow_install.${binary_tag}"; - echo " -v --view <path to LCG view> Path to the LCG view directory."; - echo " Setup file for LCG view required!"; - echo " -T --tag <tag-name> Binary tag to be used. Default: ${BINARY_TAG}"; - echo " Setup file for LCG view required!"; - echo " -c --cmake-only Execute only cmake step"; - echo " -B --build-only Only build: no cmake, no install"; - echo " -I --install-only Only install: no cmake, no build"; - echo " -p --parallel <number> Number of threads for parallel build (make -j <number>)"; + echo " -t --type <build_type> Supply build type Debug0|Debug|Release. Default: Debug0"; + echo " -s --source <source directory> Source directory for cmake"; + echo " Default: `pwd`"; + echo " CMakeLists.txt required!"; + echo " -b --build-dir <build directory> Build directory for cmake"; + echo " Default: `pwd`/dataflow_build.${binary_tag}"; + echo " -i --install-dir <install directory> Installation directory for cmake"; + echo " Default: `pwd`/dataflow_install.${binary_tag}"; + echo " -v --view <path to LCG view> Path to the LCG view directory."; + echo " Setup file for LCG view required!"; + echo " -T --tag <tag-name> Binary tag to be used. Default: ${BINARY_TAG}"; + echo " Setup file for LCG view required!"; + echo " -c --cmake Execute only cmake step"; + echo " -B --build Only build: no cmake, no install"; + echo " -I --install Only install: no cmake, no build"; + echo " -p --parallel <number> Number of threads for parallel build (make -j <number>)"; + echo " -e --ebonly Build event builder only"; + echo ""; + echo ""; + echo " Example:"; + echo ""; + echo " cd /group/online/dataflow/cmtuser/ONLINE/ONLINE_v7r19"; + echo " . /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_101/gcc/11.1.0/x86_64-centos7/setup.sh"; + echo " ./build_standalone.sh -t Debug0 --tag x86_64-centos7-gcc11-dbg --view /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_101 -c -B -I"; + echo ""; exit 1; } +#=============================================================================== +# +#=============================================================================== +build_parse_this $0; +if [ ! -f ${THIS}/build_standalone.sh ]; then + echo "+++ Wrong working directory! [${THIS}]"; + exit 1; +fi; # +BINARY_TAG=; ## x86_64-centos7-gcc11-dbg; +LCG_VIEW=; ##/cvmfs/sft.cern.ch/lcg/views/LCG_101/${BINARY_TAG}; +export RDKAFKA_DIR=/group/online/dataflow/cmtuser/libraries/kafka/rdkafka-gcc-11.1.0-opt; # -PARSED_ARGUMENTS=$(getopt -a -n do_cmake -o hcBIT:t:s:b:i:v:p: --longoptions help,cmake-only,build-only,install-only,tag:,type:,source:,build:,install:,view:,parallel: -- "[build_dataflow]" $*) +PARSED_ARGUMENTS=$(getopt -a -n do_cmake -o hcBIeT:t:s:b:i:v:p: --longoptions help,cmake,build,install,ebonly,tag:,type:,source:,build-dir:,install-dir:,view:,parallel: -- "[build_dataflow]" $*) VALID_ARGUMENTS=$? if [ "$VALID_ARGUMENTS" != "0" ]; then echo "====> Invalid arguments to cmake step"; usage; fi; +# +# +# echo "++ PARSED_ARGUMENTS: $PARSED_ARGUMENTS"; build_type=; build_dir=; @@ -134,9 +92,10 @@ source_dir=; install_dir=; lcg_view=${LCG_VIEW}; binary_tag=; -cmake_only=; -build_only=; -install_only=; +exec_cmake=; +exec_build=; +exec_install=; +eb_only=OFF; parallel="-j 12"; # eval set -- "$PARSED_ARGUMENTS"; @@ -144,15 +103,16 @@ while : do case "${1}" in -t | --type) build_type=${2}; shift 2 ;; - -b | --build) build_dir=${2}; shift 2 ;; -s | --source) source_dir=${2}; shift 2 ;; - -i | --install) install_dir=${2}; shift 2 ;; + -b | --build-dir) build_dir=${2}; shift 2 ;; + -i | --install-dir) install_dir=${2}; shift 2 ;; -v | --view) lcg_view=${2}; shift 2 ;; -T | --tag) binary_tag=${2}; shift 2 ;; - -c | --cmake-only) cmake_only=YES; shift ;; - -B | --build-only) build_only=YES; shift ;; - -I | --install-only) install_only=YES; shift ;; + -c | --cmake) exec_cmake=YES; shift ;; + -B | --build) exec_build=YES; shift ;; + -I | --install) exec_install=YES; shift ;; -p | --parallel) parallel="-j ${2}"; shift 2 ;; + -e | --ebonly) eb_only=ON; shift ;; -h | --help) usage; shift ;; # -- means the end of the arguments; drop this, and break out of the while loop --) shift; break;; @@ -168,48 +128,74 @@ done; if test -z "${binary_tag}"; then binary_tag=${BINARY_TAG}; fi; +if test -z "${source_dir}"; then + source_dir=`pwd`; +fi; +# +# OK. Now check pre-conditions +# +# +if [ -z "${binary_tag}" ]; then + # This should never happen: if no binary tag, no LCG view! + echo "====> [${build_script}] No valid binary tag supplied."; + exit 1; +fi; +# +if [ ! -f ${source_dir}/CMakeLists.txt ]; then + echo "====> [build_standalone] Invalid source directory: ${source_dir}"; + echo "====> [build_standalone] No CMakeLists.txt file present."; + exit 1; +fi; -if test -z "${cmake_only}"; then +if test -z "${exec_cmake}"; then echo "" > /dev/null; elif test -z "${lcg_view}"; then - echo "====> [do_cmake] Missing argument --view [path to LCG view]"; + echo "====> [build_standalone] Missing argument --view [path to LCG view]"; exit 1; -elif [ ! -f ${lcg_view}/setup.sh ]; then - echo "====> [do_cmake] LCG View path is wrong: no setup found."; +elif [ ! -d ${lcg_view} ]; then + echo "====> [build_standalone] LCG View path is wrong: no directory found."; # exit 1; fi; -if test -z "${source_dir}"; then - source_dir=`pwd`; +build_prefix=dataflow; +if test "${eb_only}" = "ON"; then + build_prefix=ebonly; fi; -if [ ! -f ${source_dir}/CMakeLists.txt ]; then - echo "====> [do_cmake] Invalid source directory: ${source_dir}"; - echo "====> [do_cmake] No CMakeLists.txt file present."; - exit 1; -fi; - if test -z "${build_dir}"; then - build_dir=${source_dir}/dataflow_build.${binary_tag}; + build_dir=${source_dir}/build.${build_prefix}.${binary_tag}; fi; if test -z "${install_dir}"; then - install_dir=${source_dir}/dataflow_install.${binary_tag}; + install_dir=${source_dir}/install.${build_prefix}.${binary_tag}; fi; - -if test -n "${cmake_only}"; then - source ${lcg_view}/setup.sh; -elif test -z "${cmake_only}" -a -z "${build_only}" -a -z "${install_only}"; then - source ${lcg_view}/setup.sh; -elif test -f ${install_dir}/bin/thisonline.sh; then +# +lcg_view=`realpath ${lcg_view}`; +build_dir=`realpath ${build_dir}`; +source_dir=`realpath ${source_dir}`; +install_dir=`realpath ${install_dir}`; +# +echo "Using LCG view from ${lcg_view} Binary tag: ${binary_tag} cmake: `which cmake`"; +if test -f ${install_dir}/bin/thisonline.sh -a -z "${exec_cmake}"; then source ${install_dir}/bin/thisonline.sh; +elif [ -f "${lcg_view}/setup.sh" ]; then + source ${lcg_view}/setup.sh; + CMAKE_OPTS="-DONLINE_ROOT_SYS=${ROOTSYS} -DPLUGIN_SOURCES=${lcg_view}"; +elif [ -d "${lcg_view}" ]; then + #echo "Using LCG view from ${lcg_view} Binary tag: ${binary_tag} cmake: `which cmake`"; + export PATH=${lcg_view}/CMake/3.20.0/${binary_tag}/bin:${PATH} + lcg_platform=`echo "${binary_tag}" | tr "-" " " | awk '{ print $1"-"$2 }'`; + lcg_comp=`echo "${binary_tag}" | tr "-" " " | awk '{ print $3 }'`; + lcg_dbg=`echo "${binary_tag}" | tr "-" " " | awk '{ print $4 }'`; + echo "====> [build_standalone] Using LCG view from ${lcg_view} Binary tag: ${binary_tag}"; + echo "====> [build_standalone] cmake: `which cmake` platform: ${lcg_platform} compiler: ${lcg_comp}"; + #echo . ${lcg_view}/${lcg_comp}/11.1.0/${lcg_platform}/setup.sh + #. ${lcg_view}/gcc/11.1.0/${lcg_platform}/setup.sh + CMAKE_OPTS="-DBINARY_TAG=${binary_tag} -DPLUGIN_SOURCES=/cvmfs/lhcb.cern.ch/lib/lhcb/GAUDI/GAUDI_v36r7/GaudiPluginService"; else - echo "====> Do you really know what you want ?"; -# usage; + echo "====> [build_standalone] Do you really know what you want ?"; + usage; fi; # # -mkdir -p ${build_dir}; -mkdir -p ${install_dir}; -cd ${build_dir}; # echo "++ ==============================================================="; echo "++ Configure cmake for building ${build_type} "; @@ -223,21 +209,66 @@ echo "++ ==============================================================="; # # A bit a queer logic, but I do not know how to do better: # -if test -z "${build_only}" -a -z "${install_only}"; then - do_cmake --type ${build_type} --source "${source_dir}" --install "${install_dir}" --view "${LCG_VIEW}"; -elif test -n "${cmake_only}"; then - do_cmake --type ${build_type} --source "${source_dir}" --install "${install_dir}" --view "${LCG_VIEW}"; +if [ -z "${exec_cmake}" ]; then + echo "++ No cmake step required --> Skipped."; +else + mkdir -p ${build_dir}; + cd ${build_dir}; + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed to change build directory: ${build_dir}."; + echo "====> [build_standalone] ERROR: Did you miss out something ?"; + exit 1; + fi; + do_echo cmake -DCMAKE_INSTALL_PREFIX="${install_dir}" \ + -DCMAKE_BUILD_TYPE=${build_type} \ + -DSUPPORT_GAUDI=OFF ${CMAKE_OPTS} \ + -DLCG_VIEW=${lcg_view} \ + -DEVENTBUILDER_ONLY=${eb_only} \ + ${source_dir} + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed cmake step!"; + if test -n "echo `which c++ | grep /usr`"; then + echo "====> [build_standalone] Are you sure you have the proper compiler setup ?"; + fi; + exit 1; + fi; fi; # -if test -z "${cmake_only}" -a -z "${install_only}"; then - do_build ${parallel}; -elif test -n "${build_only}"; then - do_build ${parallel}; +if test -n "${exec_build}"; then + cd ${build_dir}; + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed to change build directory: ${build_dir}."; + echo "====> [build_standalone] ERROR: Did you miss out the cmake step ?"; + exit 1; + fi; + do_echo make ${parallel}; + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed make step!"; + if test -n "echo `which c++ | grep /usr`"; then + echo "====> [build_standalone] Are you sure you have the proper compiler setup ?"; + fi; + exit 1; + fi; fi; # -if test -z "${cmake_only}" -a -z "${build_only}"; then - do_install ${parallel}; -elif test -n "${install_only}"; then - do_install ${parallel}; +if test -n "${exec_install}"; then + mkdir -p ${install_dir}; + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed to create the install directory: ${install_dir}."; + exit 1; + fi; + if [ ! -f ${build_dir}/bin/thisonline.sh ]; then + echo "====> [build_standalone] ERROR: cmake step was apparently not successful --> redo ?"; + exit 1; + fi; + echo "====> [build_standalone] PATH: $PATH"; + echo "Executing build/installation step..."; + source ${build_dir}/bin/thisonline.sh; + echo "====> [build_standalone] PATH: $PATH"; + do_echo make install -j 10; + if [ $? -ne 0 ]; then + echo "====> [build_standalone] ERROR: Failed install step!"; + exit 1; + fi; fi; diff --git a/cmake/OnlineStandalone.cmake b/cmake/OnlineStandalone.cmake index 885b8a7d737b104ee44400cb256ce47734d51e9f..1d32977a397c381ecc933fd0156a9bb3237561f5 100644 --- a/cmake/OnlineStandalone.cmake +++ b/cmake/OnlineStandalone.cmake @@ -46,7 +46,6 @@ macro(online_locate_package var alias) #message(status "++++ ONLINE_BINARY_TAG: ${ONLINE_BINARY_TAG}") #message(status "++++ ONLINE_LCG_VIEW_LOCATION: ${ONLINE_LCG_VIEW_LOCATION}") endif() - execute_process( COMMAND python ${ONLINE_FIND_PACKAGE_PATH} --package=${alias} --build=${ONLINE_BINARY_TAG} @@ -223,14 +222,45 @@ endmacro(online_set_compiler_flags) # # # ======================================================================= +macro(online_import_pluginmanager source_dir) + find_library(PLUGINMGR GaudiPluginService) # PATH ${source_dir}/lib/libGaudiPluginService1.so) + if ( ${PLUGINMGR} STREQUAL "PLUGINMGR-NOTFOUND" ) + message(ERROR "+++ Plugin manager not found: ${PLUGINMGR}") + return() + endif() + add_library(GaudiPluginService IMPORTED SHARED GLOBAL) + set_property(TARGET GaudiPluginService PROPERTY IMPORTED_LOCATION ${PLUGINMGR}) + target_include_directories(GaudiPluginService INTERFACE + $<BUILD_INTERFACE:${source_dir}/include/> + $<INSTALL_INTERFACE:include/>) + add_library(Gaudi::GaudiPluginService ALIAS GaudiPluginService) + message(STATUS "|+++> Importing Gaudi::GaudiPluginService ${PLUGINMGR}" ) + # + find_program(LISTCOMPONENTS listcomponents) # PATHS ${source_dir}/bin/listcomponents) + if ( ${LISTCOMPONENTS} STREQUAL "LISTCOMPONENTS-NOTFOUND" ) + message(ERROR "+++ listcomponents not found: ${LISTCOMPONENTS}") + return() + endif() + add_executable(listcomponents IMPORTED) + set_property(TARGET listcomponents PROPERTY IMPORTED_LOCATION ${LISTCOMPONENTS}) + add_executable(Gaudi::listcomponents ALIAS listcomponents) + message(STATUS "|+++> Importing Gaudi::listcomponents ${LISTCOMPONENTS}" ) +endmacro(online_import_pluginmanager) +# +# +# ======================================================================= function(online_build_pluginmanager source_dir) add_library(GaudiPluginService SHARED ${source_dir}/src/PluginServiceV1.cpp ${source_dir}/src/PluginServiceV2.cpp) target_include_directories(GaudiPluginService PRIVATE ${source_dir}/include) - target_include_directories(GaudiPluginService INTERFACE ${source_dir}/include) + target_include_directories(GaudiPluginService INTERFACE + $<BUILD_INTERFACE:${source_dir}/include/> + $<INSTALL_INTERFACE:include/>) target_compile_options(GaudiPluginService PRIVATE -Wno-unused-function -Wno-shadow) target_link_libraries(GaudiPluginService stdc++fs Threads::Threads ${CMAKE_DL_LIBS}) add_library(Gaudi::GaudiPluginService ALIAS GaudiPluginService) - install(TARGETS GaudiPluginService EXPORT Online LIBRARY DESTINATION "${ONLINE_INSTALL_LIBDIR}") + install(TARGETS GaudiPluginService EXPORT Online + LIBRARY DESTINATION "${ONLINE_INSTALL_LIBDIR}" + INCLUDES DESTINATION "${ONLINE_INSTALL_INCLUDEDIR}") # add_executable(listcomponents ${source_dir}/src/listcomponents.cpp ${source_dir}/src/PluginServiceV1.cpp @@ -240,7 +270,6 @@ function(online_build_pluginmanager source_dir) target_link_libraries(listcomponents stdc++fs Threads::Threads ${CMAKE_DL_LIBS}) add_executable(Gaudi::listcomponents ALIAS listcomponents) install(TARGETS listcomponents RUNTIME DESTINATION ${ONLINE_INSTALL_BINDIR}) - install(DIRECTORY ${source_dir}/include/ DESTINATION "${ONLINE_INSTALL_INCLUDEDIR}") endfunction(online_build_pluginmanager) # # diff --git a/cmake/find_package_path.py b/cmake/find_package_path.py index 4ba62316005c9b6f0722bc41038f03501485250e..8f84c794aa60946ac6edf8fc4fb0946b0a1503a2 100644 --- a/cmake/find_package_path.py +++ b/cmake/find_package_path.py @@ -17,6 +17,18 @@ def find_directory(top, name): return (name, package, fpackage, ) return None +def find_directory2(top, name): + req_package = (name+'-').upper() + package_names = os.listdir(top) + for package in package_names: + fpackage = top + '/' + package + if package == '.cvmfscatalog' or not os.path.exists(fpackage) or not os.path.isdir(fpackage): + continue + if package.upper().find(req_package) < 0: + continue + return (name, package, fpackage, ) + return None + def get_package_version(fpackage): package_versions = os.listdir(fpackage) for version in package_versions: @@ -66,5 +78,13 @@ if __name__ == '__main__': if build: print(str(os.path.realpath(build[2]))) sys.exit(0) + package = find_directory2(opts.view+'/lib/cmake', opts.package) + if package: + print(str(os.path.realpath(package[2]))) + sys.exit(0) + package = find_directory2(opts.view+'/lib64/cmake', opts.package) + if package: + print(str(os.path.realpath(package[2]))) + sys.exit(0) print('UNRESOLVED') diff --git a/cmake/thisonline.sh.in b/cmake/thisonline.sh.in index 8e1e532ddd17d55ccd2390b4919ae219b61e7be5..b3ada089a48dc5b5ca7ead70983621e63ef4984b 100644 --- a/cmake/thisonline.sh.in +++ b/cmake/thisonline.sh.in @@ -80,11 +80,14 @@ fi; # #----------------------------------------------------------------------------- export ROOTSYS=@ONLINE_ROOT_SYS@; -if test ! -f ${ROOTSYS}/bin/thisroot.sh; then - echo "No ROOT setup found. This installation setup will not work!"; +if [ -n "@ONLINE_LCG_VIEW_SETUP@" ]; then + source @ONLINE_LCG_VIEW_SETUP@/setup.sh; +else + if test ! -f ${ROOTSYS}/bin/thisroot.sh; then + echo "No ROOT setup found. This installation setup will not work!"; + fi; + . ${ROOTSYS}/bin/thisroot.sh; fi; -# -. ${ROOTSYS}/bin/thisroot.sh; #----PATH--------------------------------------------------------------------- online_add_path PATH ${THIS}/@ONLINE_INSTALL_BINDIR@; #----LIBRARY_PATH-------------------------------------------------------------