X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=CMakeLists.txt;h=17e28827aafe3f43e13b99eb8e9e379675e89a6d;hp=d2697fae7c2c6d21a670166a39666283f49a933b;hb=8ad61f4071a69445a6917d214b6592878447ddb1;hpb=b8f1cdeba7cf6c2b749ff60102ce4e260fa1309e diff --git a/CMakeLists.txt b/CMakeLists.txt index d2697fae..17e28827 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ ## along with this program. If not, see . ## -cmake_minimum_required(VERSION 2.8.6) +cmake_minimum_required(VERSION 2.8.12) include(GNUInstallDirs) @@ -35,7 +35,6 @@ option(ENABLE_SIGNALS "Build with UNIX signals" TRUE) option(ENABLE_DECODE "Build with libsigrokdecode" TRUE) option(ENABLE_TESTS "Enable unit tests" TRUE) option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE) -option(FORCE_QT4 "Force use of Qt4 even if Qt5 is available" FALSE) if(WIN32) # On Windows/MinGW we need to statically link to libraries. @@ -69,30 +68,18 @@ endif() find_package(PkgConfig) pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) -if(FORCE_QT4) - set(Qt5Core_FOUND FALSE) -else() - find_package(Qt5Core QUIET) +set(CMAKE_AUTOMOC TRUE) +set(CMAKE_AUTORCC TRUE) + +find_package(Qt5 COMPONENTS Core Gui Widgets Svg REQUIRED) + if(WIN32) # MXE workaround: Use pkg-config to find Qt5 libs. # https://github.com/mxe/mxe/issues/1642 pkg_check_modules(QT5ALL REQUIRED Qt5Widgets Qt5Gui Qt5Svg) endif() -endif() -if(Qt5Core_FOUND) - message("-- Using Qt5") - find_package(Qt5Widgets REQUIRED) - find_package(Qt5Gui REQUIRED) - find_package(Qt5Svg REQUIRED) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - set(QT_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) - set(QT_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Svg) - add_definitions(${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}) -else() - find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac) - find_package(Qt4 REQUIRED QtCore QtGui QtSvg) -endif() +set(QT_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Svg) set(BOOSTCOMPS filesystem serialization system) if(ENABLE_TESTS) @@ -104,7 +91,6 @@ find_package(Boost 1.55 COMPONENTS ${BOOSTCOMPS} REQUIRED) # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. find_package(Threads REQUIRED) - # Check for explicit link against libatomic # # Depending on the toolchain, linking a program using atomic functions may need @@ -272,6 +258,7 @@ set(pulseview_SOURCES pv/widgets/sweeptimingwidget.cpp pv/widgets/timestampspinbox.cpp pv/widgets/wellarray.cpp + pulseview.qrc ) # This list includes only QObject derived class headers. @@ -333,10 +320,6 @@ set(pulseview_HEADERS pv/widgets/wellarray.hpp ) -set(pulseview_RESOURCES - pulseview.qrc -) - if(ENABLE_SIGNALS) list(APPEND pulseview_SOURCES signalhandler.cpp) list(APPEND pulseview_HEADERS signalhandler.hpp) @@ -377,23 +360,11 @@ if(ANDROID) ) endif() -if(Qt5Core_FOUND) - qt5_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) - qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) -else() - # Workaround for QTBUG-22829: -DBOOST_NEXT_PRIOR_HPP_INCLUDED. - # https://bugreports.qt.io/browse/QTBUG-22829 - qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS} - OPTIONS -DBOOST_NEXT_PRIOR_HPP_INCLUDED) - qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) - include(${QT_USE_FILE}) -endif() - #=============================================================================== #= Global Definitions #------------------------------------------------------------------------------- -add_definitions(${QT_DEFINITIONS} -DQT_NO_KEYWORDS) +add_definitions(-DQT_NO_KEYWORDS) add_definitions(-D__STDC_LIMIT_MACROS) add_definitions(-Wall -Wextra) add_definitions(-std=c++11) @@ -419,7 +390,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} - ${QT_INCLUDE_DIRS} ) if(STATIC_PKGDEPS_LIBS) @@ -465,17 +435,9 @@ if(ANDROID) endif() if(ANDROID) -add_library(${PROJECT_NAME} SHARED - ${pulseview_SOURCES} - ${pulseview_HEADERS_MOC} - ${pulseview_RESOURCES_RCC} -) + add_library(${PROJECT_NAME} SHARED ${pulseview_SOURCES}) else() -add_executable(${PROJECT_NAME} - ${pulseview_SOURCES} - ${pulseview_HEADERS_MOC} - ${pulseview_RESOURCES_RCC} -) + add_executable(${PROJECT_NAME} ${pulseview_SOURCES}) endif() target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})