From: Uwe Hermann Date: Tue, 28 Mar 2017 20:54:27 +0000 (+0200) Subject: Simplify Qt5 setup, require cmake >= 2.8.12. X-Git-Tag: pulseview-0.4.0~113 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e222f01e48ef51f9ba326446ffd20c8897128564;p=pulseview.git Simplify Qt5 setup, require cmake >= 2.8.12. We now require cmake >= 2.8.12 (released 2013 or so, should be available pretty much anywhere by now) which further simplifies the Qt5 setup. Details: https://doc.qt.io/qt-5/cmake-manual.html https://cmake.org/cmake/help/v3.7/prop_tgt/AUTOMOC.html https://cmake.org/cmake/help/v3.7/prop_tgt/AUTORCC.html --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d9b455f..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) @@ -68,10 +68,10 @@ endif() find_package(PkgConfig) pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) -find_package(Qt5Core REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5Gui REQUIRED) -find_package(Qt5Svg REQUIRED) +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. @@ -79,10 +79,7 @@ if(WIN32) pkg_check_modules(QT5ALL REQUIRED Qt5Widgets Qt5Gui Qt5Svg) endif() -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}) set(BOOSTCOMPS filesystem serialization system) if(ENABLE_TESTS) @@ -261,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. @@ -322,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) @@ -366,14 +360,11 @@ if(ANDROID) ) endif() -qt5_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) -qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) - #=============================================================================== #= 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) @@ -399,7 +390,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} - ${QT_INCLUDE_DIRS} ) if(STATIC_PKGDEPS_LIBS) @@ -445,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}) diff --git a/INSTALL b/INSTALL index 075b18ce..9f95554b 100644 --- a/INSTALL +++ b/INSTALL @@ -12,7 +12,7 @@ Requirements - make - libtool (only needed when building from git) - pkg-config >= 0.22 - - cmake >= 2.8.6 + - cmake >= 2.8.12 - libglib >= 2.28.0 - glibmm-2.4 (>= 2.28.0) - Qt5 (including the following components): diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a1a3d29..09678e84 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -176,8 +176,6 @@ if(ENABLE_DECODE) ) endif() -qt5_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS}) - # On MinGW we need to use static linking. if(NOT WIN32) add_definitions(-DBOOST_TEST_DYN_LINK)