Changeset 19818 for trunk/FACT++


Ignore:
Timestamp:
10/27/19 20:26:42 (5 years ago)
Author:
tbretz
Message:
Implmented a NO_ROOT for testing purposes. Root is also required for TOOLS_ONLY
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/CMakeLists.txt

    r19793 r19818  
    230230# ============== ROOT ================
    231231
    232 FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
    233 FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
    234 IF(NOT ROOTCONFIG_EXECUTABLE)
    235    MESSAGE(FATAL_ERROR "Please make sure `root-config` is accessible in your path. In case of an installation from source, you might need to source\n . [path-to-root]/bin/thisroot.sh")
    236 ENDIF()
    237 
    238 # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
    239 #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
    240 #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
    241 IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
    242    IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
    243       LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
     232IF(NOT NO_ROOT AND NOT VIEWER_ONLY)
     233
     234   FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
     235   FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
     236   IF(NOT ROOTCONFIG_EXECUTABLE)
     237      MESSAGE(FATAL_ERROR "Please make sure `root-config` is accessible in your path. In case of an installation from source, you might need to source\n . [path-to-root]/bin/thisroot.sh")
    244238   ENDIF()
    245 ENDIF()
    246 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
    247 
    248 #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
    249 IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
    250 #   SET(ROOT_CONFIG_DEBUG 1)
    251    FIND_PACKAGE(ROOT OPTIONAL_COMPONENTS GQt TreePlayer )
    252 ENDIF()
    253 
    254 IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
    255    FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
    256 ENDIF()
    257 
    258 IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY AND NOT ROOT_GQt_LIBRARY)
    259    IF(ROOT_VERSION VERSION_LESS 6.18)
    260       MESSAGE(FATAL_ERROR "Root version [${ROOT_VERSION}] less than 6.18, but component GQt not found.")
     239
     240   # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
     241   #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
     242   #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
     243   IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
     244      IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
     245         LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
     246      ENDIF()
     247   ENDIF()
     248   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
     249
     250   #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
     251   #   SET(ROOT_CONFIG_DEBUG 1)
     252   FIND_PACKAGE(ROOT REQUIRED COMPONENTS TreePlayer OPTIONAL_COMPONENTS GQt)
     253
     254   IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
     255      FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
     256   ENDIF()
     257
     258   IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY AND NOT ROOT_GQt_LIBRARY)
     259      IF(ROOT_VERSION VERSION_LESS 6.18)
     260         MESSAGE(FATAL_ERROR "Root version [${ROOT_VERSION}] less than 6.18, but component GQt not found.")
     261      ELSE()
     262         MESSAGE(WARNING "Root version [${ROOT_VERSION}] does not support GQt, GUI [fact] turned off.")
     263      ENDIF()
     264   ENDIF()
     265
     266   #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
     267   FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: [${ROOT_VERSION}] ${ROOT_USE_FILE}" "[${ROOT_VERSION}][${ROOT_USE_FILE}]")
     268   IF(DEFINED ROOT_USE_FILE)
     269      INCLUDE(${ROOT_USE_FILE})
    261270   ELSE()
    262       MESSAGE(WARNING "Root version [${ROOT_VERSION}] does not support GQt, GUI [fact] turned off.")
     271      # From RootUseFile.cmake (root 6)
     272      INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
     273      LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
     274      ADD_DEFINITIONS(${ROOT_DEFINITIONS})
     275      SET(CMAKE_CXX_FLAGS     "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
     276      SET(CMAKE_C_FLAGS       "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
     277      SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
    263278   ENDIF()
    264 ENDIF()
    265 
    266 #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
    267 FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: [${ROOT_VERSION}] ${ROOT_USE_FILE}" "[${ROOT_VERSION}][${ROOT_USE_FILE}]")
    268 IF(DEFINED ROOT_USE_FILE)
    269    INCLUDE(${ROOT_USE_FILE})
    270 ELSE()
    271    # From RootUseFile.cmake (root 6)
    272    INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
    273    LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
    274    ADD_DEFINITIONS(${ROOT_DEFINITIONS})
    275    SET(CMAKE_CXX_FLAGS     "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
    276    SET(CMAKE_C_FLAGS       "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
    277    SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
    278 ENDIF()
     279
     280ENDIF(NOT NO_ROOT AND NOT VIEWER_ONLY)
    279281
    280282# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
     
    571573# --------------------------------------------------------
    572574
    573 ADD_EXECUTABLE(fitsdump src/fitsdump.cc)
    574 TARGET_LINK_LIBRARIES(fitsdump ${HELP++LIBS} ${ROOT_LIBRARIES} ZLIB::ZLIB)
    575 MANPAGE(fitsdump "FACT++ - fitsdump - Read and dump contents of a FITStable")
    576 
    577575#ADD_EXECUTABLE(fitsloader src/fitsloader.cc)
    578576#TARGET_LINK_LIBRARIES(fitsloader ${HELP++LIBS})
     
    595593#MANPAGE(readfits "")
    596594
    597 ADD_EXECUTABLE(rootifysql src/rootifysql.cc)
    598 TARGET_LINK_LIBRARIES(rootifysql ${HELP++LIBS} ${ROOT_LIBRARIES})
    599 MANPAGE(rootifysql "FACT++ - rootifysql - Write result of a SQL query into a root-file")
    600 
    601 ADD_EXECUTABLE(root2sql src/root2sql.cc)
    602 TARGET_LINK_LIBRARIES(root2sql ${HELP++LIBS} ${ROOT_LIBRARIES})
    603 MANPAGE(root2sql "FACT++ - root2sql - Fill contents of a root-tree into a MySQL database")
    604 
    605 ADD_EXECUTABLE(root2csv src/root2csv.cc)
    606 TARGET_LINK_LIBRARIES(root2csv ${HELP++LIBS} ${ROOT_LIBRARIES})
    607 MANPAGE(root2csv "FACT++ - root2csv - Convert a root-tree to a csv file")
    608 
    609 ADD_EXECUTABLE(csv2root src/csv2root.cc)
    610 TARGET_LINK_LIBRARIES(csv2root ${HELP++LIBS} ${ROOT_LIBRARIES})
    611 MANPAGE(csv2root "FACT++ - csv2root - Convert a csv file to a root-tree")
     595IF(NOT NO_ROOT)
     596   ADD_EXECUTABLE(fitsdump src/fitsdump.cc)
     597   TARGET_LINK_LIBRARIES(fitsdump ${HELP++LIBS} ${ROOT_LIBRARIES} ZLIB::ZLIB)
     598   MANPAGE(fitsdump "FACT++ - fitsdump - Read and dump contents of a FITStable")
     599
     600   ADD_EXECUTABLE(rootifysql src/rootifysql.cc)
     601   TARGET_LINK_LIBRARIES(rootifysql ${HELP++LIBS} ${ROOT_LIBRARIES})
     602   MANPAGE(rootifysql "FACT++ - rootifysql - Write result of a SQL query into a root-file")
     603   ADD_EXECUTABLE(root2sql src/root2sql.cc)
     604   TARGET_LINK_LIBRARIES(root2sql ${HELP++LIBS} ${ROOT_LIBRARIES})
     605   MANPAGE(root2sql "FACT++ - root2sql - Fill contents of a root-tree into a MySQL database")
     606
     607   ADD_EXECUTABLE(root2csv src/root2csv.cc)
     608   TARGET_LINK_LIBRARIES(root2csv ${HELP++LIBS} ${ROOT_LIBRARIES})
     609   MANPAGE(root2csv "FACT++ - root2csv - Convert a root-tree to a csv file")
     610
     611   ADD_EXECUTABLE(csv2root src/csv2root.cc)
     612   TARGET_LINK_LIBRARIES(csv2root ${HELP++LIBS} ${ROOT_LIBRARIES})
     613   MANPAGE(csv2root "FACT++ - csv2root - Convert a csv file to a root-tree")
     614ENDIF()
    612615
    613616ADD_EXECUTABLE(fits2sql src/fits2sql.cc)
     
    623626MANPAGE(zfits "")
    624627
    625 ADD_EXECUTABLE(calcsource src/calcsource.cc)
    626 TARGET_LINK_LIBRARIES(calcsource ${HELP++LIBS} ${ROOT_LIBRARIES})
    627 MANPAGE(calcsource "")
    628 
    629 ADD_EXECUTABLE(calcsourcemc src/calcsourcemc.cc)
    630 TARGET_LINK_LIBRARIES(calcsourcemc ${HELP++LIBS} ${ROOT_LIBRARIES})
    631 MANPAGE(calcsourcemc "")
     628IF(NOT NO_ROOT)
     629   ADD_EXECUTABLE(calcsource src/calcsource.cc)
     630   TARGET_LINK_LIBRARIES(calcsource ${HELP++LIBS} ${ROOT_LIBRARIES})
     631   MANPAGE(calcsource "")
     632
     633   ADD_EXECUTABLE(calcsourcemc src/calcsourcemc.cc)
     634   TARGET_LINK_LIBRARIES(calcsourcemc ${HELP++LIBS} ${ROOT_LIBRARIES})
     635   MANPAGE(calcsourcemc "")
     636ENDIF()
    632637
    633638ADD_EXECUTABLE(getevent src/getevent.cc)
     
    639644IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
    640645
    641 ADD_EXECUTABLE(makeplots src/makeplots.cc)
    642 TARGET_LINK_LIBRARIES(makeplots  ${HELP++LIBS} ${ROOT_LIBRARIES})
    643 MANPAGE(makeplots "")
     646IF(NOT NO_ROOT)
     647   ADD_EXECUTABLE(makeplots src/makeplots.cc)
     648   TARGET_LINK_LIBRARIES(makeplots  ${HELP++LIBS} ${ROOT_LIBRARIES})
     649   MANPAGE(makeplots "")
     650ENDIF()
    644651
    645652ADD_EXECUTABLE(makedata src/makedata.cc)
     
    860867        qwt-qt4 ZLIB::ZLIB)
    861868
    862 ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
     869#ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
    863870
    864871# --------------------------------------------------------
    865872
    866 IF(NOT TOOLS_ONLY AND NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
     873IF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
    867874
    868875QT4_ADD_RESOURCES(FACT_QT_RESOURCES gui/design.qrc)
     
    909916#test_LDADD = libStateMachine.la libTools.la libTime.la libDim++.la libDim.la libConfiguration.la
    910917
    911 ENDIF(NOT TOOLS_ONLY AND NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
     918ENDIF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
     919ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
    912920
    913921
     
    10171025
    10181026IF (NOT VIEWER_ONLY)
    1019 INSTALL(TARGETS  fits2sql       DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1020 INSTALL(TARGETS  root2sql       DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1021 INSTALL(TARGETS  root2csv       DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1022 INSTALL(TARGETS  csv2root       DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1023 INSTALL(TARGETS  fitsdump       DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1024 INSTALL(TARGETS  zfits          DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1025 INSTALL(TARGETS  calcsource     DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1026 INSTALL(TARGETS  showlog        DESTINATION "${CMAKE_INSTALL_BINDIR}")
    1027 INSTALL(TARGETS  rootifysql     DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1027
     1028   INSTALL(TARGETS  fits2sql       DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1029   INSTALL(TARGETS  zfits          DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1030   INSTALL(TARGETS  showlog        DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1031
     1032   IF(NOT NO_ROOT)
     1033      INSTALL(TARGETS  rootifysql     DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1034      INSTALL(TARGETS  root2sql       DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1035      INSTALL(TARGETS  root2csv       DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1036      INSTALL(TARGETS  csv2root       DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1037      INSTALL(TARGETS  fitsdump       DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1038      INSTALL(TARGETS  calcsource     DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1039      INSTALL(TARGETS  calcsourcemc   DESTINATION "${CMAKE_INSTALL_BINDIR}")
     1040   ENDIF()
     1041
    10281042ENDIF(NOT VIEWER_ONLY)
    10291043
Note: See TracChangeset for help on using the changeset viewer.