diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6c8f48d3..7c1c25b9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,11 +3,15 @@ name: Build and Test on: workflow_dispatch: +env: + DOCKER_IMAGE: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-25-01_Geant4-v10.4.3_Garfield-4.0 + REST_PATH: /rest/install + jobs: Check-Image: - runs-on: self-hosted + runs-on: ubuntu-latest container: - image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-20-06_Geant4-v10.4.3_Garfield-4.0 + image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-25-01_Geant4-v10.4.3_Garfield-4.0 steps: - name: Check ROOT is available in non-interactive shell @@ -15,6 +19,7 @@ jobs: root-config --version root-config --prefix root-config --cflags + root -q - name: Check Geant4 is available in non-interactive shell run: | geant4-config --version @@ -43,13 +48,11 @@ jobs: MediumMagboltz gas; return 0;' -q - Build: + Build-and-Install: needs: Check-Image - runs-on: self-hosted + runs-on: ubuntu-latest container: - image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-20-06_Geant4-v10.4.3_Garfield-4.0 - env: - REST_PATH: /rest/install + image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-25-01_Geant4-v10.4.3_Garfield-4.0 steps: - uses: actions/checkout@v2 @@ -57,17 +60,43 @@ jobs: - name: Pull Submodules run: yes | python3 pull-submodules.py --clean - - name: Build + - name: Build and Install run: | mkdir -p build cd build - cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH } -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON + cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON make -j$(nproc) make install + - uses: actions/upload-artifact@master + with: + name: framework-install + path: ${{ env.REST_PATH }} + + Basic-Checks: + needs: Build-and-Install + runs-on: ubuntu-latest + container: + image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-25-01_Geant4-v10.4.3_Garfield-4.0 + + steps: + - uses: actions/checkout@v2 + + - uses: actions/download-artifact@master + with: + name: framework-install + path: ${{ env.REST_PATH }} + - name: REST config run: | - ${REST_PATH}/bin/rest-config --version - ${REST_PATH}/bin/rest-config --libs - ${REST_PATH}/bin/rest-config --flags - ${REST_PATH}/bin/rest-config --commit + . ${{ env.REST_PATH }}/thisREST.sh + rest-config --version + rest-config --libs + rest-config --flags + rest-config --commit + + - name: RestRoot + run: | + . ${{ env.REST_PATH }}/thisREST.sh + cd /pipeline/analysistree/ + restRoot -b -q simpleTree.cpp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d62d1b4de..14d7c3319 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,50 +1,50 @@ -#image: lobis/root-geant4-garfieldpp:cxx14_ROOTv6-25-01_Geant4v10.4.3 -image: nkx1231/root6-geant4-garfield:0.6 +image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-26-00_Geant4-v10.4.3_Garfield-af4a1451 +# image: nkx1231/root6-geant4-garfield:0.6 variables: # GIT_SUBMODULE_STRATEGY: recursive stages: - # Basic checks to verify correctness of code + # Basic checks to verify correctness of code - pre-build - # Project compilation validation + # Project compilation validation - build - # REST libraries installed as sub-modules + # REST libraries installed as sub-modules - libraries - # Basic validation tests of installation + # Basic validation tests of installation - install - # Basic core validation tests + # Basic core validation tests - core - # Stage dedicated to validate metadata classes. gas, readout, g4Metadata, etc + # Stage dedicated to validate metadata classes. gas, readout, g4Metadata, etc - metadata - # Stage to validate restG4 package examples + # Stage to validate restG4 package examples - restG4 - # Stage to validate data chain processing constructions (TREX-DM data, PandaX-III topology, etc). + # Stage to validate data chain processing constructions (TREX-DM data, PandaX-III topology, etc). - restManager_process - # Stage to validate tasks or executions over preprocessed data filesx + # Stage to validate tasks or executions over preprocessed data filesx - postProcessing - # Stage to validate other restManager tasks (metadata generation, script loading, etc). + # Stage to validate other restManager tasks (metadata generation, script loading, etc). - restManager_generate - # Scripts to launch more complete tests. TRestGas file generation, Geant4 physics validation, etc. + # Scripts to launch more complete tests. TRestGas file generation, Geant4 physics validation, etc. - deploy before_script: - pwd - export USER="test" - # - export GIT_SSL_NO_VERIFY=1 + # - export GIT_SSL_NO_VERIFY=1 - echo $CI_SERVER_HOST - echo $CRONJOB - # We redefine the HOME + # We redefine the HOME - export HOME=${CI_PROJECT_DIR}/install_latest/ - if [ -d $HOME/.rest ]; then rm -Rf $HOME/.rest; fi - if [ -f "/opt/root/install/bin/thisroot.sh" ]; then source /opt/root/install/bin/thisroot.sh; fi @@ -54,9 +54,12 @@ before_script: - if [ -d "/opt/garfieldpp/install" ]; then export GARFIELD_HOME=/opt/garfieldpp/install; fi - if [ -d "/opt/garfieldpp/install" ]; then export HEED_DATABASE=$GARFIELD_HOME/Heed/heed++/database; fi - if [ -d "/opt/garfieldpp/install" ]; then export LD_LIBRARY_PATH=$GARFIELD_HOME/lib:$LD_LIBRARY_PATH; fi - - ls $GARFIELD_HOME + - if [[ -v GARFIELD_INSTALL ]]; then export GARFIELD_HOME=$GARFIELD_INSTALL; fi + - echo $GARFIELD_HOME + - echo $GARFIELD_INSTALL - python3 --version - apt update && apt install -y wget + - root -q clang-format: stage: pre-build @@ -73,11 +76,11 @@ clang-format: - $CRONJOB == "YES" validateCode: - stage: pre-build - script: - - cd ${CI_PROJECT_DIR}/ - - python3 pull-submodules.py --force --dontask - - python3 pipeline/validateProcesses.py source/libraries/ + stage: pre-build + script: + - cd ${CI_PROJECT_DIR}/ + - python3 pull-submodules.py --force --dontask + - python3 pipeline/validateProcesses.py source/libraries/ #axionLib: # stage: libraries @@ -124,7 +127,7 @@ build_latest: - if [ -d ${CI_PROJECT_DIR}/install_latest ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest; fi - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest - make install -j2 - # - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh + # - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh artifacts: paths: - ${CI_PROJECT_DIR}/install_latest @@ -137,14 +140,14 @@ build_latest: # - cd ${CI_PROJECT_DIR}/ # - python3 pull-submodules.py --force --dontask --latest # - if [ -d ${CI_PROJECT_DIR}/build_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/build_latest2; fi - # - mkdir ${CI_PROJECT_DIR}/build_latest2 && cd ${CI_PROJECT_DIR}/build_latest2/ - # - if [ -d ${CI_PROJECT_DIR}/install_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest2; fi - # - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest2 - # - make install -j2 - # - . ${CI_PROJECT_DIR}/install_latest2/thisREST.sh - # except: - # variables: - # - $CRONJOB == "YES" + # - mkdir ${CI_PROJECT_DIR}/build_latest2 && cd ${CI_PROJECT_DIR}/build_latest2/ + # - if [ -d ${CI_PROJECT_DIR}/install_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest2; fi + # - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest2 + # - make install -j2 + # - . ${CI_PROJECT_DIR}/install_latest2/thisREST.sh + # except: + # variables: + # - $CRONJOB == "YES" #build_nkx: # image: nkx1231/root6-geant4-garfield:0.6 @@ -170,6 +173,12 @@ loadRESTLibs: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh - restRoot -b -q +loadRESTMacros: + type: install + script: + - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh + - restRoot -m 1 -b -q -v 3 + listRESTMacros: type: install script: @@ -202,24 +211,24 @@ listRESTMacros: expire_in: 1 day LoadGas: - type: metadata + type: metadata script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh - cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/ - restRoot -b -q LoadGasFromServerAndValidate.C only: - variables: - - $CI_SERVER_HOST == "lfna.unizar.es" + variables: + - $CI_SERVER_HOST == "lfna.unizar.es" GenerateGas: - type: metadata + type: metadata script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh - cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/ - restRoot -b -q GenerateDummyGas.C only: - variables: - - $CI_SERVER_HOST == "lfna.unizar.es" + variables: + - $CI_SERVER_HOST == "lfna.unizar.es" AnalysisTree: type: core @@ -229,17 +238,17 @@ AnalysisTree: - restRoot -b -q simpleTree.cpp GenerateReadout: - type: metadata + type: metadata script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh - cd ${CI_PROJECT_DIR}/pipeline/metadata/readout/ - restManager --c generateReadout.rml --o readout.root - restRoot -b -q PrintReadout.C'("readout.root")' > /dev/null - # We need to introduce basic validation here - # - diff validation.txt print.txt + # We need to introduce basic validation here + # - diff validation.txt print.txt BasicReadout: - type: metadata + type: metadata script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh - cd ${CI_PROJECT_DIR}/projects/basic-readouts/ @@ -260,7 +269,7 @@ testMeta: - ${CI_PROJECT_DIR}/install_latest/examples/meta.root expire_in: 1 day -trexDM_data_latest: +trexDM_data_latest: type: restManager_process script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh @@ -279,7 +288,7 @@ trexDM_data_latest: - ${CI_PROJECT_DIR}/pipeline/trex/Hits_01928.root expire_in: 1 day -pandaXIII_Topological: +pandaXIII_Topological: type: restManager_process script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh @@ -293,7 +302,7 @@ pandaXIII_Topological: - ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/trackParameter.png expire_in: 1 week -pandaXIII_Topological_fromG4: +pandaXIII_Topological_fromG4: type: restManager_process script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh @@ -307,7 +316,7 @@ pandaXIII_Topological_fromG4: - ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/testOutput.root expire_in: 1 week -pandaXIII_data: +pandaXIII_data: type: restManager_process script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh @@ -319,8 +328,8 @@ pandaXIII_data: paths: - ${CI_PROJECT_DIR}/pipeline/pandaxiii_data/TriggerRate.png expire_in: 1 week - -EventSelection: + +EventSelection: type: restManager_process script: - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh @@ -328,7 +337,7 @@ EventSelection: - restManager --c g4Analysis.rml --f "${CI_PROJECT_DIR}/install_latest/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root" - restManager --c g4OnSelection.rml --f Run00001_NLDBD_Test_g4Analysis.root - restRoot -b -q Validate.C'("Run00001_NLDBD_Test_EvSelection.root")' - + artifacts: paths: - ${CI_PROJECT_DIR}/pipeline/selection/IDs.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a047571b3..0a4d7e075 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,26 @@ set(CMAKE_MACOSX_RPATH 1) # ROOT libs and includes -find_package(ROOT REQUIRED) +set(ROOT_REQUIRED_LIBRARIES Core RIO Geom Gdml Minuit Spectrum) +# Switch to enable ROOT Eve functionality. +if (NOT DEFINED REST_EVE) + set(REST_EVE ON) +endif () +if (${REST_EVE} MATCHES "ON") + add_definitions(-DUSE_Eve) + list(APPEND rest_features "Eve") + set(ROOT_REQUIRED_LIBRARIES ${ROOT_REQUIRED_LIBRARIES} Eve RGL) +else () + set(excludes ${excludes} TRestEveEventViewer) +endif (${REST_EVE} MATCHES "ON") + +find_package(ROOT REQUIRED COMPONENTS ${ROOT_REQUIRED_LIBRARIES}) + +message(STATUS "ROOT LIBRARIES: ${ROOT_LIBRARIES}") + +set(external_libs "${external_libs};${ROOT_LIBRARIES}") + +set(ROOTCINT_EXECUTABLE ${ROOT_rootcint_CMD}) execute_process(COMMAND root-config --has-cxx20 OUTPUT_VARIABLE HASCXX20) execute_process(COMMAND root-config --has-cxx17 OUTPUT_VARIABLE HASCXX17) @@ -76,19 +95,6 @@ elseif (${HASCXX11} MATCHES "yes") endif () set(external_include_dirs ${external_include_dirs} ${ROOT_INCLUDE_DIRS}) -set(external_libs ${external_libs} "${ROOT_LIBRARIES} -lGui -lGeom -lGdml -lMinuit -lSpectrum") - -# Switch to enable ROOT Eve functionality. -if (NOT DEFINED REST_EVE) - set(REST_EVE ON) -endif () -if (${REST_EVE} MATCHES "ON") - add_definitions(-DUSE_Eve) - list(APPEND rest_features "Eve") - set(external_libs "${external_libs} -lEve -lRGL") -else () - set(excludes ${excludes} TRestEveEventViewer) -endif (${REST_EVE} MATCHES "ON") # This is to enable linking of SQL libraries. I.e. for process TRestSQLToAnalysisProccess. if (NOT DEFINED SQL) diff --git a/cmake/CollectGitInfo.cmake b/cmake/CollectGitInfo.cmake index 383c07ff8..a844f9de1 100644 --- a/cmake/CollectGitInfo.cmake +++ b/cmake/CollectGitInfo.cmake @@ -6,75 +6,75 @@ set(GIT_BRANCH) set(GIT_CLEANSTATE) set(REST_OFFICIAL_RELEASE "No") -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - return() -endif() +if (CMAKE_SYSTEM_NAME MATCHES "Windows") + return() +endif () execute_process(COMMAND git status --porcelain -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_VARIABLE GIT_CLEANSTATE ERROR_VARIABLE gitstatuserr) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GIT_CLEANSTATE ERROR_VARIABLE gitstatuserr) -if( GIT_CLEANSTATE STREQUAL "" ) - set( GIT_CLEANSTATE "Yes" ) -else() - set( GIT_CLEANSTATE "No" ) -endif() +if (GIT_CLEANSTATE STREQUAL "") + set(GIT_CLEANSTATE "Yes") +else () + set(GIT_CLEANSTATE "No") +endif () -execute_process(COMMAND git describe --tags -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_VARIABLE gitdiscribe ERROR_VARIABLE err) +execute_process(COMMAND git describe --tags + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE gitdiscribe ERROR_VARIABLE err) -if(err MATCHES ".*fatal.*") - message("Warning! not a git repository") - return() -endif() +if (err MATCHES ".*fatal.*") + message("Warning! not a git repository") + return() +endif () set(GIT_VALID TRUE) #get git tag string(REGEX REPLACE "v(.*)-(.*)-(.*)" - "v\\1" version - ${gitdiscribe}) + "v\\1" version + ${gitdiscribe}) string(REPLACE "\n" "" version ${version}) set(GIT_TAG ${version}) execute_process(COMMAND git rev-list -n 1 ${GIT_TAG} -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_VARIABLE GIT_LASTTAG_COMMIT) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GIT_LASTTAG_COMMIT) string(SUBSTRING ${GIT_LASTTAG_COMMIT} 0 8 GIT_LASTTAG_COMMIT) #message( STATUS "Git LatestTag commit: ${GIT_LASTTAG_COMMIT}" ) #get git commit date execute_process(COMMAND git log -1 --format=%ai -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_VARIABLE git_date) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE git_date) string(REPLACE "\n" "" git_date ${git_date}) set(GIT_DATE ${git_date}) #get git number -execute_process(COMMAND git rev-parse --verify HEAD -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_VARIABLE git_ver) -string(SUBSTRING ${git_ver} 0 8 git_commit ) +execute_process(COMMAND git rev-parse --verify HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE git_ver) +string(SUBSTRING ${git_ver} 0 8 git_commit) set(GIT_COMMIT ${git_commit}) #get git branch execute_process(COMMAND git branch -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -OUTPUT_FILE /tmp/temp.txt) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_FILE /tmp/temp.txt) execute_process(COMMAND grep -e "^*" -WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} -INPUT_FILE /tmp/temp.txt -OUTPUT_VARIABLE git_branch) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + INPUT_FILE /tmp/temp.txt + OUTPUT_VARIABLE git_branch) execute_process(COMMAND rm /tmp/temp.txt) string(REPLACE "\n" "" git_branch ${git_branch}) string(SUBSTRING ${git_branch} 2 -1 git_branch) set(GIT_BRANCH ${git_branch}) -if( GIT_COMMIT STREQUAL GIT_LASTTAG_COMMIT ) - set( REST_OFFICIAL_RELEASE "Yes" ) -endif() +if (GIT_COMMIT STREQUAL GIT_LASTTAG_COMMIT) + set(REST_OFFICIAL_RELEASE "Yes") +endif () message("") message(STATUS "REST release : ${GIT_TAG}") @@ -82,6 +82,6 @@ message(STATUS "REST date : ${GIT_DATE}") message(STATUS "REST commit : ${GIT_COMMIT}") message(STATUS "REST branch : ${GIT_BRANCH}") message("") -message( STATUS "Clean state: ${GIT_CLEANSTATE}" ) -message( STATUS "REST Official release: ${REST_OFFICIAL_RELEASE}" ) +message(STATUS "Clean state: ${GIT_CLEANSTATE}") +message(STATUS "REST Official release: ${REST_OFFICIAL_RELEASE}") message("") diff --git a/cmake/FindGarfield.cmake b/cmake/FindGarfield.cmake deleted file mode 100644 index cdbf9c43b..000000000 --- a/cmake/FindGarfield.cmake +++ /dev/null @@ -1,61 +0,0 @@ - -# - Try to find Garfield++ instalation -# This module sets up Garfield information -# It defines: -# Garfield_FOUND If Garfiled++ is found -# Garfield_INCLUDE_DIRS PATH to the include directories -# Garfield_LIBRARIES the libraries needed to use Garfield++ - -#message(STATUS "Looking for Garfield ...") - -# Alternative paths which can be defined by user -#set(Garfield_DIR "" CACHE PATH "Directory where Garfield is installed") -#set(Garfield_INC_DIR "" CACHE PATH "Alternative directory for Garfield includes") -#set(Garfield_LIB_DIR "" CACHE PATH "Alternative directory for Garfield libraries") -set(Garfield_DIR $ENV{GARFIELD_HOME}) - -find_path(Garfield_INCLUDE_DIRS Sensor.hh - HINTS ${Garfield_DIR}/include/ ${Garfield_DIR}/include/Garfield ${Garfield_INC_DIR} - ${Garfield_DIR}/Include) - -#message(STATUS Garfield_INCLUDE_DIRS ${Garfield_INCLUDE_DIRS}) - -find_library(Garfield_LIBRARIES NAMES libGarfield.so Garfield - HINTS ${Garfield_DIR}/lib ${Garfield_LIB_DIR} - $ENV{GARFIELD_HOME}/lib) -#message(STATUS Garfield_LIBRARIES ${Garfield_LIBRARIES}) - -#if (${Garfield_LIBRARY_DIR}) -# set (Garfield_LIBRARIES -L${Garfield_LIBRARY_DIR} -lGarfield) -#endif() - -if (Garfield_INCLUDE_DIRS AND Garfield_LIBRARIES) - set (Garfield_FOUND TRUE) -endif() - -if (NOT DEFINED ENV{GARFIELD_HOME} ) - message("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\nError : GARFIELD HOME is not defined! - \nCheck Garfield is installed and GARFIELD_HOME is pointing to install directory - \nHINT : GARFIELD_HOME/lib/libGarfield.so should exist. - \nIf you do not need Garfield++ interface in your REST installation, then, - \nplease, run cmake disabling REST_GARFIELD variable - \n\ni.e. : cmake -DREST_GARFIELD=OFF ../ - \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ) -endif() - -if (Garfield_FOUND) - if (NOT Garfield_FIND_QUIETLY) - message(STATUS "Found Garfield includes in ${Garfield_INCLUDE_DIRS}") - message(STATUS "Found Garfield libraries ${Garfield_LIBRARIES}") - endif (NOT Garfield_FIND_QUIETLY) -else(Garfield_FOUND) - if (Garfield_FIND_REQUIRED) - message(FATAL_ERROR "Garfield required, but not found!\ntry to run \"./scripts/installation/v2.2/installGarfield.sh\" to install it. - ") - endif (Garfield_FIND_REQUIRED) -endif(Garfield_FOUND) - -# Make variables changeble to the advanced user -mark_as_advanced(Garfield_INCLUDE_DIRS) -mark_as_advanced(Garfield_LIBRARIES) -mark_as_advanced(Garfield_LIBRARY_DIR) diff --git a/cmake/FindROOT.cmake b/cmake/FindROOT.cmake deleted file mode 100644 index 69c0a9bf3..000000000 --- a/cmake/FindROOT.cmake +++ /dev/null @@ -1,98 +0,0 @@ -# - Finds ROOT instalation -# This module sets up ROOT information -# It defines: -# ROOT_FOUND If the ROOT is found -# ROOT_INCLUDE_DIR PATH to the include directory (deprecated) -# ROOT_INCLUDE_DIRS PATH to the include directory -# ROOT_LIBRARIES Most common libraries -# ROOT_LIBRARY_DIR PATH to the library directory -# ROOT_BIN_DIR PATH to the excutables directory -# ROOT_PYTHONVER Compatible python version string - -# First search for ROOTConfig.cmake on the path defined via user setting -# ROOT_DIR - -if (CMAKE_SYSTEM_NAME MATCHES "Windows") - - if(DEFINED ENV{ROOTSYS}) - set(ROOTSYS $ENV{ROOTSYS}) - else() - message(FATAL_ERROR "ROOTSYS environment variable is undefined. Did you forget to source the `thisroot.bat`?") - endif() - - if(NOT ROOTSYS) - set(ROOT_FOUND FALSE) - else() - set(ROOT_FOUND TRUE) - - set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib) - set(ROOT_INCLUDE_DIRS ${ROOTSYS}/include) - set(ROOT_BIN_DIR ${ROOTSYS}/bin) - set(ROOTCINT_EXECUTABLE ${ROOTSYS}/bin/rootcint.exe) - set(GENREFLEX_EXECUTABLE ${ROOTSYS}/bin/genreflex.exe) - - set(CMAKE_FIND_LIBRARY_PREFIXES "lib") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") - set(ROOT_LIBRARIES) - foreach(_cpt Core Imt RIO Net Hist Gui Eve RGL Gdml Geom Graf Graf3d Gpad Tree TreePlayer Rint Postscript Matrix Physics MathCore Thread MultiProc Minuit) - find_library(ROOT_${_cpt}_LIBRARY ${_cpt} HINTS ${ROOT_LIBRARY_DIR}) - if(ROOT_${_cpt}_LIBRARY) - mark_as_advanced(ROOT_${_cpt}_LIBRARY) - list(APPEND ROOT_LIBRARIES ${ROOT_${_cpt}_LIBRARY}) - endif() - endforeach() - if(ROOT_LIBRARIES) - list(REMOVE_DUPLICATES ROOT_LIBRARIES) - endif() - - endif() -else() - - find_program(ROOT_CONFIG_EXECUTABLE root-config - PATHS ${ROOTSYS}/bin $ENV{ROOTSYS}/bin) - - if(NOT ROOT_CONFIG_EXECUTABLE) - set(ROOT_FOUND FALSE) - else() - set(ROOT_FOUND TRUE) - - execute_process( - COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir - OUTPUT_VARIABLE ROOT_INCLUDE_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND ${ROOT_CONFIG_EXECUTABLE} --libdir - OUTPUT_VARIABLE ROOT_LIBRARY_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND ${ROOT_CONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE ROOT_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND ${ROOT_CONFIG_EXECUTABLE} --libs - OUTPUT_VARIABLE ROOT_LIBRARIES - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND ${ROOT_CONFIG_EXECUTABLE} --bindir - OUTPUT_VARIABLE ROOT_BIN_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - - set(ROOTCINT_EXECUTABLE ${ROOT_BIN_DIR}/rootcint) - set(GENREFLEX_EXECUTABLE ${ROOT_BIN_DIR}/genreflex) - - # Make variables changeble to the advanced user - mark_as_advanced(ROOT_CONFIG_EXECUTABLE) - endif() -endif() - - -if (NOT ROOT_FOUND) - message(FATAL_ERROR "ROOT required, but not found") -else() - message(STATUS "Find ROOT ${ROOT_VERSION} in ${ROOT_BIN_DIR}") -endif() - diff --git a/cmake/FindSQL.cmake b/cmake/FindSQL.cmake index ca99bf4c4..b5e5840c6 100644 --- a/cmake/FindSQL.cmake +++ b/cmake/FindSQL.cmake @@ -6,40 +6,40 @@ # SQL_LIBRARIES Libraries required to use SQL # SQL_VERSION Version of MySQL -find_program(SQL_CONFIG_EXECUTABLE mysql_config ) +find_program(SQL_CONFIG_EXECUTABLE mysql_config) -if(NOT SQL_CONFIG_EXECUTABLE) - set(SQL_FOUND FALSE) -else() - set(SQL_FOUND TRUE) +if (NOT SQL_CONFIG_EXECUTABLE) + set(SQL_FOUND FALSE) +else () + set(SQL_FOUND TRUE) - execute_process( - COMMAND ${SQL_CONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE SQL_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${SQL_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE SQL_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT SQL_VERSION MATCHES "5.5.68" ) + if (NOT SQL_VERSION MATCHES "5.5.68") execute_process( - COMMAND ${SQL_CONFIG_EXECUTABLE} --cxxflags - OUTPUT_VARIABLE SQL_INCLUDE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() + COMMAND ${SQL_CONFIG_EXECUTABLE} --cxxflags + OUTPUT_VARIABLE SQL_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + else () execute_process( - COMMAND ${SQL_CONFIG_EXECUTABLE} --cflags - OUTPUT_VARIABLE SQL_INCLUDE_DIR + COMMAND ${SQL_CONFIG_EXECUTABLE} --cflags + OUTPUT_VARIABLE SQL_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif () + + execute_process( + COMMAND ${SQL_CONFIG_EXECUTABLE} --libs + OUTPUT_VARIABLE SQL_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - - execute_process( - COMMAND ${SQL_CONFIG_EXECUTABLE} --libs - OUTPUT_VARIABLE SQL_LIBRARIES - OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() +endif () if (NOT SQL_FOUND) - message(FATAL_ERROR "SQL required, but not found") -else() - message(STATUS "Found MySQL ${SQL_VERSION}") -endif() + message(FATAL_ERROR "SQL required, but not found") +else () + message(STATUS "Found MySQL ${SQL_VERSION}") +endif () diff --git a/cmake/MacroRootDict.cmake b/cmake/MacroRootDict.cmake index 8efd860d5..c28212a96 100644 --- a/cmake/MacroRootDict.cmake +++ b/cmake/MacroRootDict.cmake @@ -1,28 +1,28 @@ -IF(APPLE) - SET( LD_LIBRARY_PATH_VAR DYLD_LIBRARY_PATH ) -ELSE() - SET( LD_LIBRARY_PATH_VAR LD_LIBRARY_PATH ) -ENDIF() -SET( LD_LIBRARY_PATH_CONTENTS $ENV{${LD_LIBRARY_PATH_VAR}} ) +IF (APPLE) + SET(LD_LIBRARY_PATH_VAR DYLD_LIBRARY_PATH) +ELSE () + SET(LD_LIBRARY_PATH_VAR LD_LIBRARY_PATH) +ENDIF () +SET(LD_LIBRARY_PATH_CONTENTS $ENV{${LD_LIBRARY_PATH_VAR}}) #MESSAGE( STATUS "LD_LIBRARY_PATH_CONTENTS: ${LD_LIBRARY_PATH_CONTENTS}" ) -SET( ROOT_CINT_WRAPPER ${LD_LIBRARY_PATH_VAR}=${ROOT_LIBRARY_DIR}:${LD_LIBRARY_PATH_CONTENTS} ${ROOTCINT_EXECUTABLE} ) +SET(ROOT_CINT_WRAPPER ${LD_LIBRARY_PATH_VAR}=${ROOT_LIBRARY_DIR}:${LD_LIBRARY_PATH_CONTENTS} ${ROOTCINT_EXECUTABLE}) -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - SET( ROOT_CINT_WRAPPER ${ROOTCINT_EXECUTABLE} ) -endif() +if (CMAKE_SYSTEM_NAME MATCHES "Windows") + SET(ROOT_CINT_WRAPPER ${ROOTCINT_EXECUTABLE}) +endif () -IF( NOT DEFINED ROOT_DICT_OUTPUT_DIR ) - SET( ROOT_DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/rootdict" ) -ENDIF() +IF (NOT DEFINED ROOT_DICT_OUTPUT_DIR) + SET(ROOT_DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/rootdict") +ENDIF () # clean generated header files with 'make clean' -SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ROOT_DICT_OUTPUT_DIR}" ) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ROOT_DICT_OUTPUT_DIR}") -IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_DICT_OUTPUT_DIR: ${PROJECT_BINARY_DIR}/rootdict" ) - MESSAGE( STATUS "Check for ROOT_DICT_CINT_DEFINITIONS: ${ROOT_DICT_CINT_DEFINITIONS}" ) -ENDIF() +IF (NOT ROOT_FIND_QUIETLY) + MESSAGE(STATUS "Check for ROOT_DICT_OUTPUT_DIR: ${PROJECT_BINARY_DIR}/rootdict") + MESSAGE(STATUS "Check for ROOT_DICT_CINT_DEFINITIONS: ${ROOT_DICT_CINT_DEFINITIONS}") +ENDIF () # ============================================================================ @@ -37,20 +37,19 @@ ENDIF() # ${input_dir}_LinkDef.h as the last header (if found) # # ---------------------------------------------------------------------------- -MACRO( PREPARE_ROOT_DICT_HEADERS _input_dir ) +MACRO(PREPARE_ROOT_DICT_HEADERS _input_dir) - FILE( GLOB ROOT_DICT_INPUT_HEADERS "${_input_dir}/*.h" ) - FILE( GLOB _linkdef_hdr "${_input_dir}/LinkDef.h" ) + FILE(GLOB ROOT_DICT_INPUT_HEADERS "${_input_dir}/*.h") + FILE(GLOB _linkdef_hdr "${_input_dir}/LinkDef.h") - IF( _linkdef_hdr ) - LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") - ENDIF() + IF (_linkdef_hdr) + LIST(REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") + LIST(APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") + ENDIF () #MESSAGE( STATUS "ROOT_DICT_INPUT_HEADERS: ${ROOT_DICT_INPUT_HEADERS}" ) -ENDMACRO( PREPARE_ROOT_DICT_HEADERS ) - +ENDMACRO(PREPARE_ROOT_DICT_HEADERS) # ============================================================================ @@ -65,26 +64,26 @@ ENDMACRO( PREPARE_ROOT_DICT_HEADERS ) # correct order to be used by macro GEN_ROOT_DICT_SOURCES # # ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_LINKDEF_HEADER _namespace ) +MACRO(GEN_ROOT_DICT_LINKDEF_HEADER _namespace) - SET( _input_headers ${ARGN} ) - SET( _linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h" ) + SET(_input_headers ${ARGN}) + SET(_linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h") - FOREACH( _header ${_input_headers} ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#ifdef __CINT__" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all globals\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all classes\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all functions\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ class ${_namespace}+\;" \n ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}#endif" \n ) - ENDFOREACH() + FOREACH (_header ${_input_headers}) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#ifdef __CINT__" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all globals\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all classes\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all functions\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ class ${_namespace}+\;" \n) + SET(${_namespace}_file_contents "${${_namespace}_file_contents}#endif" \n) + ENDFOREACH () - file(MAKE_DIRECTORY ${ROOT_DICT_OUTPUT_DIR}) - file(WRITE ${_linkdef_header} ${${_namespace}_file_contents}) + file(MAKE_DIRECTORY ${ROOT_DICT_OUTPUT_DIR}) + file(WRITE ${_linkdef_header} ${${_namespace}_file_contents}) - SET( ROOT_DICT_INPUT_HEADERS ${_input_headers} ${_linkdef_header} ) + SET(ROOT_DICT_INPUT_HEADERS ${_input_headers} ${_linkdef_header}) ENDMACRO() @@ -105,50 +104,49 @@ ENDMACRO() # returns: # ROOT_DICT_OUTPUT_SOURCES - list containing generated source and other # previously generated sources - + # ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename ) +MACRO(GEN_ROOT_DICT_SOURCE _dict_src_filename) - SET( _input_depend ${ARGN} ) + SET(_input_depend ${ARGN}) # TODO check for ROOT_CINT_EXECUTABLE - file(MAKE_DIRECTORY ${ROOT_DICT_OUTPUT_DIR}) + file(MAKE_DIRECTORY ${ROOT_DICT_OUTPUT_DIR}) # need to prefix all include dirs with -I - set( _dict_includes ) - FOREACH( _inc ${ROOT_DICT_INCLUDE_DIRS} ) - SET( _dict_includes "${_dict_includes}\t-I${_inc}") #fg: the \t fixes a wired string expansion - ENDFOREACH() + set(_dict_includes) + FOREACH (_inc ${ROOT_DICT_INCLUDE_DIRS}) + SET(_dict_includes "${_dict_includes}\t-I${_inc}") #fg: the \t fixes a wired string expansion + ENDFOREACH () # We modify the list of headers to be given to ROOTCINT command. # We must remove/clean the full path from the main header - list ( GET ROOT_DICT_INPUT_HEADERS 0 MAIN_HEADER) - get_filename_component( MAIN_HEADER_CLEAN ${MAIN_HEADER} NAME) - list ( GET ROOT_DICT_INPUT_HEADERS 1 LINKDEF_HEADER ) - set( ROOT_DICT_INPUT_HEADERS_CLEAN ${MAIN_HEADER_CLEAN} ${LINKDEF_HEADER} ) - - STRING( REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename} ) - SET( _dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc} ) - STRING( REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}" ) + list(GET ROOT_DICT_INPUT_HEADERS 0 MAIN_HEADER) + get_filename_component(MAIN_HEADER_CLEAN ${MAIN_HEADER} NAME) + list(GET ROOT_DICT_INPUT_HEADERS 1 LINKDEF_HEADER) + set(ROOT_DICT_INPUT_HEADERS_CLEAN ${MAIN_HEADER_CLEAN} ${LINKDEF_HEADER}) + + STRING(REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename}) + SET(_dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc}) + STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}") ADD_CUSTOM_COMMAND( - OUTPUT ${_dict_src_file} - COMMAND ${ROOT_CINT_WRAPPER} -f "${_dict_src_file}" ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS_CLEAN} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - DEPENDS ${ROOT_DICT_INPUT_HEADERS} ${_input_depend} - COMMENT "generating: ${_dict_src_file} with ${ROOT_DICT_INPUT_HEADERS}" + OUTPUT ${_dict_src_file} + COMMAND ${ROOT_CINT_WRAPPER} -f "${_dict_src_file}" ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS_CLEAN} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ${ROOT_DICT_INPUT_HEADERS} ${_input_depend} + COMMENT "generating: ${_dict_src_file} with ${ROOT_DICT_INPUT_HEADERS}" ) - LIST( APPEND ROOT_DICT_OUTPUT_SOURCES ${_dict_src_file} ) + LIST(APPEND ROOT_DICT_OUTPUT_SOURCES ${_dict_src_file}) ENDMACRO() # for backwards compatibility -MACRO( GEN_ROOT_DICT_SOURCES _dict_src_filename ) +MACRO(GEN_ROOT_DICT_SOURCES _dict_src_filename) #MESSAGE( "USING DEPRECATED GEN_ROOT_DICT_SOURCES. PLEASE USE GEN_ROOT_DICT_SOURCE instead." ) - SET( ROOT_DICT_OUTPUT_SOURCES ) - GEN_ROOT_DICT_SOURCE( ${_dict_src_filename} ) + SET(ROOT_DICT_OUTPUT_SOURCES) + GEN_ROOT_DICT_SOURCE(${_dict_src_filename}) ENDMACRO() # ============================================================================ - # ============================================================================ # Macro to compile the whole directories into a single library # @@ -208,144 +206,144 @@ ENDMACRO() # form, set them in this argument to include them. # # ---------------------------------------------------------------------------- -MACRO( COMPILEDIR libname ) +MACRO(COMPILEDIR libname) - message(STATUS "making build files for ${CMAKE_CURRENT_SOURCE_DIR}, schema evolution: ${local_SE}") + message(STATUS "making build files for ${CMAKE_CURRENT_SOURCE_DIR}, schema evolution: ${local_SE}") # We need to define the include paths relative to the compilation directory - set ( REAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}/source" ) - string( REPLACE ${REAL_SOURCE_DIR} "" RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ) + set(REAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}/source") + string(REPLACE ${REAL_SOURCE_DIR} "" RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}) set(RELATIVE_PATH "..${RELATIVE}") - set(contentfiles) - - if(DEFINED contents) - message("specified sub-dirs: ${contents}") - foreach(content ${contents}) - set(local_include_dirs ${local_include_dirs} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR}/${content} ${CMAKE_CURRENT_SOURCE_DIR}/${content}/inc) - endforeach(content) - set(local_include_dirs ${local_include_dirs} PARENT_SCOPE) - - foreach(content ${contents}) - file(GLOB_RECURSE files ${content}/*.cxx) - foreach (file ${files}) - - string(REGEX MATCH "[^/\\]*cxx" temp ${file}) - string(REPLACE ".cxx" "" class ${temp}) - - set ( SKIP "FALSE" ) - if(DEFINED excludes) - foreach(exclude ${excludes}) - if ( "${exclude}" STREQUAL "${class}" ) - set ( SKIP "TRUE" ) - # message( STATUS "Skipping ${class}" ) - endif() - endforeach(exclude) - endif() - - if( ${SKIP} STREQUAL "FALSE" ) - set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) - file(GLOB_RECURSE header ${class}.h) - if(NOT header) - message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") - else() - set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - if(${SCHEMA_EVOLUTION} MATCHES "ON") - GEN_ROOT_DICT_LINKDEF_HEADER( ${class} ${header}) - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - else() - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) - endif() - - set(contentfiles ${contentfiles} ${file} ${ROOT_DICT_OUTPUT_SOURCES}) - endif() - endif( ${SKIP} STREQUAL "FALSE" ) - - endforeach (file) - - # message( STATUS "contentfiles: ${contentfiles}" ) - endforeach(content) - else() - message("using inc/src folders in root directory") - set(local_include_dirs ${local_include_dirs} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/inc) - set(local_include_dirs ${local_include_dirs} PARENT_SCOPE) - - file(GLOB_RECURSE files src/*.cxx) - foreach (file ${files}) - string(REGEX MATCH "[^/\\]*cxx" temp ${file}) - string(REPLACE ".cxx" "" class ${temp}) - - set ( SKIP "FALSE" ) - if(DEFINED excludes) - # message ( STATUS "EXCLUDES: ${excludes}" ) - foreach(exclude ${excludes}) - if ( "${exclude}" STREQUAL "${class}" ) - set ( SKIP "TRUE" ) - # message( STATUS "Skipping ${class}" ) - endif() - endforeach(exclude) - endif() - - if( ${SKIP} STREQUAL "FALSE" ) - set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) - file(GLOB_RECURSE header ${class}.h) - if(NOT header) - message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") - else() - set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - if(${SCHEMA_EVOLUTION} MATCHES "ON") - GEN_ROOT_DICT_LINKDEF_HEADER( ${class} ${header}) - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - else() - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) - endif() - - set(contentfiles ${contentfiles} ${file} ${ROOT_DICT_OUTPUT_SOURCES}) - endif() - endif( ${SKIP} STREQUAL "FALSE" ) - endforeach (file) - endif() - - - foreach(src ${addon_CINT}) - string(REGEX MATCH "[^/\\]+$" filename ${src}) - set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) - set(ROOT_DICT_INPUT_HEADERS ${src}) - GEN_ROOT_DICT_SOURCES(CINT_${filename}.cxx) - set(contentfiles ${contentfiles} ${src} ${ROOT_DICT_OUTPUT_SOURCES}) - endforeach(src) - - include_directories(${local_include_dirs}) - add_library(${libname} SHARED ${contentfiles} ${addon_src}) - - - if(CMAKE_SYSTEM_NAME MATCHES "Windows") - set_target_properties(${libname} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - target_link_libraries(${libname} ${local_libraries} ${external_libs}) - install(TARGETS ${libname} - RUNTIME DESTINATION bin - LIBRARY DESTINATION bin - ARCHIVE DESTINATION lib) - else() - target_link_libraries(${libname} ${local_libraries} ${external_libs}) - install(TARGETS ${libname} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static) - endif() - set(local_libraries ${local_libraries} ${libname}) - set(local_libraries ${local_libraries} PARENT_SCOPE) + set(contentfiles) + + if (DEFINED contents) + message("specified sub-dirs: ${contents}") + foreach (content ${contents}) + set(local_include_dirs ${local_include_dirs} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR}/${content} ${CMAKE_CURRENT_SOURCE_DIR}/${content}/inc) + endforeach (content) + set(local_include_dirs ${local_include_dirs} PARENT_SCOPE) + + foreach (content ${contents}) + file(GLOB_RECURSE files ${content}/*.cxx) + foreach (file ${files}) + + string(REGEX MATCH "[^/\\]*cxx" temp ${file}) + string(REPLACE ".cxx" "" class ${temp}) + + set(SKIP "FALSE") + if (DEFINED excludes) + foreach (exclude ${excludes}) + if ("${exclude}" STREQUAL "${class}") + set(SKIP "TRUE") + # message( STATUS "Skipping ${class}" ) + endif () + endforeach (exclude) + endif () + + if (${SKIP} STREQUAL "FALSE") + set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) + file(GLOB_RECURSE header ${class}.h) + if (NOT header) + message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") + else () + set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + if (${SCHEMA_EVOLUTION} MATCHES "ON") + GEN_ROOT_DICT_LINKDEF_HEADER(${class} ${header}) + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + else () + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) + endif () + + set(contentfiles ${contentfiles} ${file} ${ROOT_DICT_OUTPUT_SOURCES}) + endif () + endif (${SKIP} STREQUAL "FALSE") + + endforeach (file) + + # message( STATUS "contentfiles: ${contentfiles}" ) + endforeach (content) + else () + message("using inc/src folders in root directory") + set(local_include_dirs ${local_include_dirs} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/inc) + set(local_include_dirs ${local_include_dirs} PARENT_SCOPE) + + file(GLOB_RECURSE files src/*.cxx) + foreach (file ${files}) + string(REGEX MATCH "[^/\\]*cxx" temp ${file}) + string(REPLACE ".cxx" "" class ${temp}) + + set(SKIP "FALSE") + if (DEFINED excludes) + # message ( STATUS "EXCLUDES: ${excludes}" ) + foreach (exclude ${excludes}) + if ("${exclude}" STREQUAL "${class}") + set(SKIP "TRUE") + # message( STATUS "Skipping ${class}" ) + endif () + endforeach (exclude) + endif () + + if (${SKIP} STREQUAL "FALSE") + set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) + file(GLOB_RECURSE header ${class}.h) + if (NOT header) + message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") + else () + set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + if (${SCHEMA_EVOLUTION} MATCHES "ON") + GEN_ROOT_DICT_LINKDEF_HEADER(${class} ${header}) + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + else () + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) + endif () + + set(contentfiles ${contentfiles} ${file} ${ROOT_DICT_OUTPUT_SOURCES}) + endif () + endif (${SKIP} STREQUAL "FALSE") + endforeach (file) + endif () + + + foreach (src ${addon_CINT}) + string(REGEX MATCH "[^/\\]+$" filename ${src}) + set(ROOT_DICT_INCLUDE_DIRS ${local_include_dirs} ${external_include_dirs}) + set(ROOT_DICT_INPUT_HEADERS ${src}) + GEN_ROOT_DICT_SOURCES(CINT_${filename}.cxx) + set(contentfiles ${contentfiles} ${src} ${ROOT_DICT_OUTPUT_SOURCES}) + endforeach (src) + + include_directories(${local_include_dirs}) + add_library(${libname} SHARED ${contentfiles} ${addon_src}) + + + if (CMAKE_SYSTEM_NAME MATCHES "Windows") + set_target_properties(${libname} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + target_link_libraries(${libname} ${local_libraries} ${external_libs}) + install(TARGETS ${libname} + RUNTIME DESTINATION bin + LIBRARY DESTINATION bin + ARCHIVE DESTINATION lib) + else () + target_link_libraries(${libname} ${local_libraries} ${external_libs}) + install(TARGETS ${libname} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) + endif () + set(local_libraries ${local_libraries} ${libname}) + set(local_libraries ${local_libraries} PARENT_SCOPE) ENDMACRO() MACRO(SUBDIRLIST result curdir) - FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) - SET(dirlist "") - FOREACH(child ${children}) - IF(IS_DIRECTORY ${curdir}/${child}) - LIST(APPEND dirlist ${child}) - ENDIF() - ENDFOREACH() - SET(${result} ${dirlist}) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH (child ${children}) + IF (IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF () + ENDFOREACH () + SET(${result} ${dirlist}) ENDMACRO() # ============================================================================ @@ -353,10 +351,10 @@ ENDMACRO() # e.g. axion --> RestAxion # e.g. detector --> RestDetector MACRO(DIRNAME2LIBNAME result dirname) - string(SUBSTRING ${dirname} 0 1 firstletter) - string(TOUPPER ${firstletter} firstlettercapital) - string(SUBSTRING ${dirname} 1 -1 remainingletter) - set(${result} "Rest${firstlettercapital}${remainingletter}") + string(SUBSTRING ${dirname} 0 1 firstletter) + string(TOUPPER ${firstletter} firstlettercapital) + string(SUBSTRING ${dirname} 1 -1 remainingletter) + set(${result} "Rest${firstlettercapital}${remainingletter}") ENDMACRO() # ============================================================================ @@ -367,17 +365,17 @@ ENDMACRO() # result: the converted option string. Will be empty if error # dirname: the relative path from CMAKE_CURRENT_SOURCE_DIR to the target dir macro(DIRNAME2OPTION result dirname) - set(${result} "") - if(${dirname} MATCHES "libraries/") - string(REPLACE "libraries/" "" purename ${dirname}) - string(TOUPPER ${purename} uppername) - set(${result} "RESTLIB_${uppername}") - endif() - - if(${dirname} MATCHES "packages/") - string(REPLACE "packages/rest" "" purename ${dirname}) - set(${result} "REST_${purename}") - endif() + set(${result} "") + if (${dirname} MATCHES "libraries/") + string(REPLACE "libraries/" "" purename ${dirname}) + string(TOUPPER ${purename} uppername) + set(${result} "RESTLIB_${uppername}") + endif () + + if (${dirname} MATCHES "packages/") + string(REPLACE "packages/rest" "" purename ${dirname}) + set(${result} "REST_${purename}") + endif () ENDMACRO() @@ -431,94 +429,94 @@ ENDMACRO() # form, set them in this argument to include them. # # ---------------------------------------------------------------------------- -MACRO( COMPILELIB dependency) - - string(REGEX MATCH "[^/\\]*$" puredirname ${CMAKE_CURRENT_SOURCE_DIR}) - DIRNAME2LIBNAME(libname ${puredirname}) - - message(STATUS "making build files in ${CMAKE_CURRENT_SOURCE_DIR}, dependency: ${${dependency}}") - - set(files_cxx) - set(files_to_compile_cxx) - set(files_to_compile_cint) - set(dirs_to_include ${rest_framework_include_dirs}) - set(libs_to_link ${rest_framework_libraries}) - - # check dependency - foreach(dep ${${dependency}}) - set(dirs_to_include ${dirs_to_include} "${CMAKE_CURRENT_SOURCE_DIR}/../${dep}/inc") - DIRNAME2LIBNAME(deplibname ${dep}) - set(libs_to_link ${libs_to_link} ${deplibname}) - endforeach() - - # include dir - set(dirs_to_include ${dirs_to_include} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/inc) - - # generate CINT files - file(GLOB_RECURSE files_cxx ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cxx) - foreach (file ${files_cxx}) - string(REGEX MATCH "[^/\\]*cxx$" temp ${file}) # get pure file name - string(REPLACE ".cxx" "" class ${temp}) # get file name without extension, i.e. class name - - set ( SKIP "FALSE" ) - if(DEFINED excludes) - foreach(exclude ${excludes}) - if ( "${exclude}" STREQUAL "${class}" ) - set ( SKIP "TRUE" ) - # message( STATUS "Skipping ${class}" ) - endif() - endforeach(exclude) - endif() - - if( ${SKIP} STREQUAL "FALSE" ) - set(ROOT_DICT_INCLUDE_DIRS ${dirs_to_include} ${external_include_dirs}) - file(GLOB_RECURSE header ${class}.h) - if(NOT header) - message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") - else() - set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - if(${SCHEMA_EVOLUTION} MATCHES "ON") - GEN_ROOT_DICT_LINKDEF_HEADER( ${class} ${header}) - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) - else() - GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) - endif() - - set(files_to_compile_cxx ${files_to_compile_cxx} ${file}) - set(files_to_compile_cint ${files_to_compile_cint} ${ROOT_DICT_OUTPUT_SOURCES}) - endif() - endif( ${SKIP} STREQUAL "FALSE" ) - endforeach (file) - - foreach(src ${addon_CINT}) - string(REGEX MATCH "[^/\\]+$" filename ${src}) - set(ROOT_DICT_INCLUDE_DIRS ${dirs_to_include} ${external_include_dirs}) - set(ROOT_DICT_INPUT_HEADERS ${src}) - GEN_ROOT_DICT_SOURCES(CINT_${filename}.cxx) - set(files_to_compile ${files_to_compile} ${src} ${ROOT_DICT_OUTPUT_SOURCES}) - endforeach(src) - - list(LENGTH files_cxx Nfiles_cxx) - list(LENGTH files_to_compile_cint Nfiles_cint) - list(LENGTH addon_src Nfiles_add) - - message(STATUS "${Nfiles_cxx} source files in total, ${Nfiles_cint} classes to generete, ${Nfiles_add} additional source files") - - # start compile - include_directories(${dirs_to_include} ${external_include_dirs}) - add_library(${libname} SHARED ${files_to_compile_cxx} ${files_to_compile_cint} ${addon_src}) - target_link_libraries(${libname} ${libs_to_link} ${external_libs}) - - # install - install(TARGETS ${libname} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static) - - file(GLOB_RECURSE Headers "${CMAKE_CURRENT_SOURCE_DIR}/inc/*.h") - INSTALL(FILES ${Headers} DESTINATION include) - - set(dirs_included ${dirs_to_include} PARENT_SCOPE) - set(library_added ${libname}) - set(library_added ${library_added} PARENT_SCOPE) +MACRO(COMPILELIB dependency) + + string(REGEX MATCH "[^/\\]*$" puredirname ${CMAKE_CURRENT_SOURCE_DIR}) + DIRNAME2LIBNAME(libname ${puredirname}) + + message(STATUS "making build files in ${CMAKE_CURRENT_SOURCE_DIR}, dependency: ${${dependency}}") + + set(files_cxx) + set(files_to_compile_cxx) + set(files_to_compile_cint) + set(dirs_to_include ${rest_framework_include_dirs}) + set(libs_to_link ${rest_framework_libraries}) + + # check dependency + foreach (dep ${${dependency}}) + set(dirs_to_include ${dirs_to_include} "${CMAKE_CURRENT_SOURCE_DIR}/../${dep}/inc") + DIRNAME2LIBNAME(deplibname ${dep}) + set(libs_to_link ${libs_to_link} ${deplibname}) + endforeach () + + # include dir + set(dirs_to_include ${dirs_to_include} ${addon_inc} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/inc) + + # generate CINT files + file(GLOB_RECURSE files_cxx ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cxx) + foreach (file ${files_cxx}) + string(REGEX MATCH "[^/\\]*cxx$" temp ${file}) # get pure file name + string(REPLACE ".cxx" "" class ${temp}) # get file name without extension, i.e. class name + + set(SKIP "FALSE") + if (DEFINED excludes) + foreach (exclude ${excludes}) + if ("${exclude}" STREQUAL "${class}") + set(SKIP "TRUE") + # message( STATUS "Skipping ${class}" ) + endif () + endforeach (exclude) + endif () + + if (${SKIP} STREQUAL "FALSE") + set(ROOT_DICT_INCLUDE_DIRS ${dirs_to_include} ${external_include_dirs}) + file(GLOB_RECURSE header ${class}.h) + if (NOT header) + message(WARNING "header file: " ${class}.h " does not exist for source file: " ${file} ". If you really want to build it, add it to \"addon_src\" variable before calling COMPILEDIR()") + else () + set(ROOT_DICT_INPUT_HEADERS ${header} ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + if (${SCHEMA_EVOLUTION} MATCHES "ON") + GEN_ROOT_DICT_LINKDEF_HEADER(${class} ${header}) + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx ${ROOT_DICT_OUTPUT_DIR}/${class}_LinkDef.h) + else () + GEN_ROOT_DICT_SOURCES(CINT_${class}.cxx) + endif () + + set(files_to_compile_cxx ${files_to_compile_cxx} ${file}) + set(files_to_compile_cint ${files_to_compile_cint} ${ROOT_DICT_OUTPUT_SOURCES}) + endif () + endif (${SKIP} STREQUAL "FALSE") + endforeach (file) + + foreach (src ${addon_CINT}) + string(REGEX MATCH "[^/\\]+$" filename ${src}) + set(ROOT_DICT_INCLUDE_DIRS ${dirs_to_include} ${external_include_dirs}) + set(ROOT_DICT_INPUT_HEADERS ${src}) + GEN_ROOT_DICT_SOURCES(CINT_${filename}.cxx) + set(files_to_compile ${files_to_compile} ${src} ${ROOT_DICT_OUTPUT_SOURCES}) + endforeach (src) + + list(LENGTH files_cxx Nfiles_cxx) + list(LENGTH files_to_compile_cint Nfiles_cint) + list(LENGTH addon_src Nfiles_add) + + message(STATUS "${Nfiles_cxx} source files in total, ${Nfiles_cint} classes to generete, ${Nfiles_add} additional source files") + + # start compile + include_directories(${dirs_to_include} ${external_include_dirs}) + add_library(${libname} SHARED ${files_to_compile_cxx} ${files_to_compile_cint} ${addon_src}) + target_link_libraries(${libname} ${libs_to_link} ${external_libs}) + + # install + install(TARGETS ${libname} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) + + file(GLOB_RECURSE Headers "${CMAKE_CURRENT_SOURCE_DIR}/inc/*.h") + INSTALL(FILES ${Headers} DESTINATION include) + + set(dirs_included ${dirs_to_include} PARENT_SCOPE) + set(library_added ${libname}) + set(library_added ${library_added} PARENT_SCOPE) ENDMACRO() \ No newline at end of file diff --git a/cmake/thisREST.cmake b/cmake/thisREST.cmake index 6b44e675c..a0cd3f2fe 100644 --- a/cmake/thisREST.cmake +++ b/cmake/thisREST.cmake @@ -2,44 +2,49 @@ ## We identify the thisroot.sh script for the corresponding ROOT version execute_process(COMMAND root-config --prefix - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - OUTPUT_VARIABLE ROOT_PATH) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE ROOT_PATH) string(REGEX REPLACE "\n$" "" ROOT_PATH "${ROOT_PATH}") -set ( thisROOT "${ROOT_PATH}/bin/thisroot.sh" ) +set(thisROOT "${ROOT_PATH}/bin/thisroot.sh") ## We identify the geant4.sh script for the corresponding Geant4 version execute_process(COMMAND geant4-config --prefix - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - OUTPUT_VARIABLE GEANT4_PATH) + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GEANT4_PATH) string(REGEX REPLACE "\n$" "" GEANT4_PATH "${GEANT4_PATH}") -set ( thisGeant4 "${GEANT4_PATH}/bin/geant4.sh" ) +set(thisGeant4 "${GEANT4_PATH}/bin/geant4.sh") if (${REST_G4} MATCHES "ON") - set ( loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\n if [[ -f \"${thisGeant4}\" && ${thisGeant4} != /usr/* ]]; then - source ${thisGeant4}\n fi\n" ) + set(loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\n if [[ -f \"${thisGeant4}\" && ${thisGeant4} != /usr/* ]]; then + source ${thisGeant4}\n fi\n") else () - set( loadG4 "") + set(loadG4 "") endif (${REST_G4} MATCHES "ON") -if( DEFINED MPFR_PATH ) - set( loadMPFR "export LD_LIBRARY_PATH=${MPFR_PATH}/lib:\$LD_LIBRARY_PATH") +if (DEFINED MPFR_PATH) + set(loadMPFR "export LD_LIBRARY_PATH=${MPFR_PATH}/lib:\$LD_LIBRARY_PATH") else () - set( loadMPFR "") -endif() - + set(loadMPFR "") +endif () if (${REST_GARFIELD} MATCHES "ON") - set ( loadGarfield "\n\# if GARFIELD is enabled we load the same Garfield environment used in compilation + if (DEFINED ENV{GARFIELD_INSTALL}) + set(loadGarfield "\n\# if GARFIELD is enabled we load the same Garfield environment used in compilation +source $ENV{GARFIELD_INSTALL}/share/Garfield/setupGarfield.sh +") + else () + set(loadGarfield "\n\# if GARFIELD is enabled we load the same Garfield environment used in compilation export GARFIELD_HOME=$ENV{GARFIELD_HOME} export HEED_DATABASE=\$GARFIELD_HOME/Heed/heed++/database -export LD_LIBRARY_PATH=\$GARFIELD_HOME/lib:\$LD_LIBRARY_PATH" ) +export LD_LIBRARY_PATH=\$GARFIELD_HOME/lib:\$LD_LIBRARY_PATH") + endif () else () - set( loadGarfield "") + set(loadGarfield "") endif (${REST_GARFIELD} MATCHES "ON") # install thisREST script, sh VERSION -install( CODE -" +install(CODE + " file( WRITE \${CMAKE_INSTALL_PREFIX}/thisREST.sh @@ -94,16 +99,16 @@ fi \" ) " -) + ) -foreach(mac ${rest_macros}) +foreach (mac ${rest_macros}) -string(REPLACE " " "" mac ${mac}) -string(REPLACE "rest" "" m ${mac}) + string(REPLACE " " "" mac ${mac}) + string(REPLACE "rest" "" m ${mac}) -install( CODE -" + install(CODE + " file( APPEND \${CMAKE_INSTALL_PREFIX}/thisREST.sh \" @@ -111,13 +116,13 @@ alias ${mac}=\\\"restManager ${m}\\\" \" ) " -) + ) -endforeach(mac ${rest_macros}) +endforeach (mac ${rest_macros}) # install thisREST script, csh VERSION -install( CODE -" +install(CODE + " file( WRITE \${CMAKE_INSTALL_PREFIX}/thisREST.csh \"\#!/bin/csh @@ -141,16 +146,16 @@ endif \" ) " -) + ) -foreach(mac ${rest_macros}) +foreach (mac ${rest_macros}) -string(REPLACE " " "" mac ${mac}) -string(REPLACE "rest" "" m ${mac}) + string(REPLACE " " "" mac ${mac}) + string(REPLACE "rest" "" m ${mac}) -install( CODE -" + install(CODE + " file( APPEND \${CMAKE_INSTALL_PREFIX}/thisREST.csh \" @@ -158,14 +163,14 @@ alias ${mac} \\\"restManager ${m}\\\" \" ) " -) + ) -endforeach(mac ${rest_macros}) +endforeach (mac ${rest_macros}) #install rest-config -install( CODE -" +install(CODE + " include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CollectGitInfo.cmake) message(STATUS \"Installing: \${CMAKE_INSTALL_PREFIX}/bin/rest-config\") @@ -287,4 +292,4 @@ fi \" ) " -) + ) diff --git a/pipeline/MakeBasicTree.C b/pipeline/MakeBasicTree.C index d1ea9ceca..9a20fcb17 100644 --- a/pipeline/MakeBasicTree.C +++ b/pipeline/MakeBasicTree.C @@ -1,6 +1,7 @@ // This macro will extract the double observables and will fill a tree with std::vector -Int_t MakeBasicTree(string fname) { - TRestRun* run = new TRestRun(fname); +Int_t MakeBasicTree(TString inputRunFile, TString outputRootFile = "results.root") { + cout << "Running 'MakeBasicTree'" << endl; + TRestRun* run = new TRestRun(inputRunFile.Data()); TRestAnalysisTree* aTree = run->GetAnalysisTree(); @@ -9,7 +10,7 @@ Int_t MakeBasicTree(string fname) { if (aTree->GetObservableType(n) == "double") obsValues.push_back(0); } - TFile* outFile = new TFile("results.root", "RECREATE"); + TFile* outFile = new TFile(outputRootFile, "RECREATE"); TTree* myTree = new TTree("bTree", "basicTree"); myTree->Branch("doubleObservables", &obsValues); @@ -32,6 +33,11 @@ Int_t MakeBasicTree(string fname) { } myTree->Write(); + + cout << "Writing TTree into '" << outFile->GetName() << "'" << endl; outFile->Close(); + + cout << "Finished running 'MakeBasicTree'" << endl; + return 0; } diff --git a/source/bin/restRoot.cxx b/source/bin/restRoot.cxx index 75ef74baa..6d2eb9f4f 100644 --- a/source/bin/restRoot.cxx +++ b/source/bin/restRoot.cxx @@ -1,11 +1,10 @@ #include #include -#include -#include - #include #include #include +#include +#include #include "TRestVersion.h" @@ -26,6 +25,7 @@ int main(int argc, char* argv[]) { case 'v': gVerbose = StringToVerboseLevel(argv[i + 1]); break; + // We get out at the end of execution without ROOT interactive shell case 'm': loadMacros = StringToInteger(argv[i + 1]); break; @@ -74,6 +74,7 @@ int main(int argc, char* argv[]) { gROOT->ProcessLine((".L " + c).c_str()); } + if (debug) printf("All macros loaded\n"); } // load input root file with TRestRun, initialize input event, analysis tree and metadata structures @@ -88,7 +89,7 @@ int main(int argc, char* argv[]) { string runcmd = Form("TRestRun* run%i = (TRestRun*)%s;", Nfile, ToString(runTmp).c_str()); if (debug) printf("%s\n", runcmd.c_str()); gROOT->ProcessLine(runcmd.c_str()); - if (runTmp->GetInputEvent() != NULL) { + if (runTmp->GetInputEvent()) { string eventType = runTmp->GetInputEvent()->ClassName(); printf("Attaching event %s as ev%i...\n", eventType.c_str(), Nfile); @@ -137,9 +138,12 @@ int main(int argc, char* argv[]) { } } + cout << "A" << endl; // display root's command line - TRint theApp("App", &argc, argv); - theApp.Run(); + TRint app("App", &argc, argv); + cout << "B" << endl; + app.Run(); + cout << "C" << endl; return 0; }