Changeset 19976


Ignore:
Timestamp:
07/27/20 17:29:02 (4 years ago)
Author:
tbretz
Message:
Implemented basic support for compiling with Qt5 (this is not yet working reliably) and improved the finding of Qwt
Location:
trunk/FACT++
Files:
2 edited

Legend:

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

    r19973 r19976  
    229229FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost FOUND_VAR Boost_FOUND REQUIRED_VARS Boost_INCLUDE_DIR Boost_LIBRARIES)
    230230
    231 # =============== QT4 ==============
     231# =============== Qt4/Qt5 ==============
    232232IF(NOT TOOLS_ONLY OR VIEWER_ONLY)
    233233
    234 FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtOpenGL QtSql QtXml)
    235 FIND_PACKAGE(Qwt REQUIRED)
     234   IF (NOT FORCE_QT5)
     235      FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtSql QtXml QUIET)
     236   ENDIF()
     237
     238   IF(Qt4_FOUND)
     239      FIND_PACKAGE_MESSAGE(Qt4Found "Found Qt4 [Core Gui OpenGL Sql Xml]" "[${Qt4_FOUND}]")
     240      SET(Qt Qt4)
     241      SET(QtCore QtCore)
     242      SET(QtGui QtGui)
     243      SET(QtOpenGL QtOpenGL)
     244      SET(QtSql QtSql)
     245      SET(QtXml QtXml)
     246      ADD_DEFINITIONS(-DHAVE_QT4)
     247   ELSE()
     248      IF (NOT FORCE_QT5)
     249         FIND_PACKAGE_MESSAGE(Qt4NotFound "Qt4 [or one of: Core Gui OpenGL Sql Xml] NOT found, trying Qt5!" "[${Qt4_FOUND}]")
     250      ENDIF()
     251      FIND_PACKAGE(Qt5 COMPONENTS Core Gui OpenGL Sql Xml REQUIRED)
     252      FIND_PACKAGE_MESSAGE(Qt5Found2 "Found Qt5: fact GUI will be disabled" "[${Qt5_FOUND}]")
     253      SET(Qt Qt5)
     254      SET(QtCore Core)
     255      SET(QtGui Gui)
     256      SET(QtOpenGL OpenGL)
     257      SET(QtSql Sql)
     258      SET(QtXml Xml)
     259   ENDIF()
     260
     261   FIND_PACKAGE(Qwt REQUIRED)
    236262
    237263ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
     
    318344
    319345ENDIF(NOT NO_ROOT AND NOT VIEWER_ONLY)
     346
     347# Note that in root 5.34/38 (and maybe others?) the ROOT_xxx_FOUND macros are broken
     348IF (NOT ROOT_GQt_FOUND)
     349   FIND_LIBRARY(ROOT_GQt_LIBRARY NAMES GQt PATHS ${ROOT_LIBRARY_DIR})
     350   IF (ROOT_GQt_LIBRARY)
     351      FIND_PACKAGE_MESSAGE(RootQGtLib "Found libGQt: ${ROOT_GQt_LIBRARY}" "[${ROOT_GQt_LIBRARY}]")
     352      SET(ROOT_GQt_FOUND 1)
     353   ELSE()
     354      FIND_PACKAGE_MESSAGE(RootQGt "ROOT: libGQt not found, fact GUI disabled!" "[${ROOT_GQt_FOUND}]")
     355   ENDIF()
     356ENDIF()
    320357
    321358# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
     
    824861
    825862ADD_EXECUTABLE(gcn src/gcn.cc)
    826 TARGET_LINK_LIBRARIES(gcn ${FACT++LIBS} Qt4::QtXml)
     863TARGET_LINK_LIBRARIES(gcn ${FACT++LIBS} ${Qt}::${QtXml})
    827864MANPAGE(gcn "")
    828865
     
    836873
    837874ADD_EXECUTABLE(lidctrl src/lidctrl.cc)
    838 TARGET_LINK_LIBRARIES(lidctrl ${FACT++LIBS} Qt4::QtXml)
     875TARGET_LINK_LIBRARIES(lidctrl ${FACT++LIBS} ${Qt}::${QtXml})
    839876MANPAGE(lidctrl "")
    840877
     
    856893
    857894ADD_EXECUTABLE(pwrctrl src/pwrctrl.cc src/HeadersPower.cc)
    858 TARGET_LINK_LIBRARIES(pwrctrl ${FACT++LIBS} Qt4::QtXml)
     895TARGET_LINK_LIBRARIES(pwrctrl ${FACT++LIBS} ${Qt}::${QtXml})
    859896MANPAGE(pwrctrl "")
    860897
     
    896933
    897934ADD_EXECUTABLE(tngweather src/tngweather.cc)
    898 TARGET_LINK_LIBRARIES(tngweather ${FACT++LIBS} Qt4::QtXml)
     935TARGET_LINK_LIBRARIES(tngweather ${FACT++LIBS} ${Qt}::${QtXml})
    899936MANPAGE(tngweather "")
    900937
     
    911948IF (NOT TOOLS_ONLY OR VIEWER_ONLY)
    912949
    913 INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIR}/qwt-qt4 gui gui/RawEventsViewer)
     950INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIR} gui gui/RawEventsViewer)
    914951
    915952# --------------------------------------------------------
    916953
    917 QT4_WRAP_UI(VIEWER_QT_HEADERS gui/RawEventsViewer/viewer.ui)
    918 
    919 QT4_WRAP_CPP(VIEWER_QT_SOURCES
     954IF(QT4_FOUND)
     955   QT4_WRAP_UI(VIEWER_QT_HEADERS gui/RawEventsViewer/viewer.ui)
     956   QT4_WRAP_CPP(VIEWER_QT_SOURCES
    920957        gui/RawEventsViewer/RawEventsViewer.h
    921958        gui/BasicGlCamera.h
    922959        gui/QCameraWidget.h
    923960        gui/Q3DCameraWidget.h)
     961ELSE()
     962   QT5_WRAP_UI(VIEWER_QT_HEADERS gui/RawEventsViewer/viewer.ui)
     963   QT5_WRAP_CPP(VIEWER_QT_SOURCES
     964        gui/RawEventsViewer/RawEventsViewer.h
     965        gui/BasicGlCamera.h
     966        gui/QCameraWidget.h
     967        gui/Q3DCameraWidget.h)
     968ENDIF()
    924969
    925970ADD_EXECUTABLE(viewer
     
    933978TARGET_LINK_LIBRARIES(viewer
    934979        ${Boost_LIBRARIES} Configuration
    935         Qt4::QtGui Qt4::QtOpenGL
     980        ${Qt}::${QtGui} ${Qt}::${QtOpenGL}
    936981        ${OPENGL_LIBRARIES} # OpenGL::GL OpenGL::GLU
    937         qwt-qt4 ZLIB::ZLIB)
     982        ${QWT_LIBRARY} ZLIB::ZLIB)
    938983
    939984#ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
     
    941986# --------------------------------------------------------
    942987
    943 IF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
     988IF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND AND Qt4_FOUND)
    944989
    945990QT4_ADD_RESOURCES(FACT_QT_RESOURCES gui/design.qrc)
     
    9681013        ${FACT++LIBS}
    9691014        ${ROOT_LIBRARIES}
    970         Qt4::QtGui Qt4::QtOpenGL Qt4::QtSql
     1015        ${Qt}::${QtGui} ${Qt}::${QtOpenGL} ${Qt}::${QtSql}
    9711016        ${OPENGL_LIBRARIES} # OpenGL::GL OpenGL::GLU
    972         qwt-qt4 ZLIB::ZLIB)
     1017        ${QWT_LIBRARY} ZLIB::ZLIB)
    9731018
    9741019
     
    9861031#test_LDADD = libStateMachine.la libTools.la libTime.la libDim++.la libDim.la libConfiguration.la
    9871032
    988 ENDIF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND)
     1033ENDIF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND AND Qt4_FOUND)
    9891034ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
    9901035
     
    10271072
    10281073        ADD_EXECUTABLE(beaglectrl famous/src/beaglectrl.cc)
    1029         TARGET_LINK_LIBRARIES(beaglectrl ${FACT++LIBS}  Qt4::QtXml)
     1074        TARGET_LINK_LIBRARIES(beaglectrl ${FACT++LIBS} ${Qt}::${QtXml})
    10301075        MANPAGE(beaglectrl "")
    10311076ENDIF()
  • trunk/FACT++/cmake/FindQwt.cmake

    r19397 r19976  
    44# Try to locate the package in the default path
    55# and in the path provided by pkg-config
    6 FIND_PATH(QWT_INCLUDE_DIR NAMES qwt-qt4/qwt.h PATHS ${QWT_INCLUDE_DIRS})
    7 FIND_LIBRARY(QWT_LIBRARY NAMES qwt-qt4 PATHS ${QWT_LIBRARY_DIRS})
     6#FIND_PATH(QWT_INCLUDE_DIR NAMES qwt-qt4/qwt.h qwt/qwt.h PATHS ${QWT_INCLUDE_DIRS})
     7FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS ${QWT_INCLUDE_DIRS} PATH_SUFFIXES qwt qwt-qt4)
     8FIND_LIBRARY(QWT_LIBRARY NAMES qwt qwt-qt4 PATHS ${QWT_LIBRARY_DIRS})
    89
    910# Check if QWT_LIBARARY and QWT_INCLUDE_DIR is set
Note: See TracChangeset for help on using the changeset viewer.