X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=CMakeLists.txt;h=b18b81a7c4841b6edf937a91c13d1cf70f006f37;hp=f4325bf7dcfdb16928a53a1fc62559e3e3342fda;hb=156f06e95f10587063b97b6b453a603751a0007c;hpb=4e4d72b22a81d1f2d8daee1093ac45264a0a1e2d diff --git a/CMakeLists.txt b/CMakeLists.txt index f4325bf7..b18b81a7 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,21 +35,12 @@ 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. # This option is user configurable, but enable it by default on win32. set(STATIC_PKGDEPS_LIBS TRUE) - # For boost-thread we need two additional settings on win32: - set(Boost_USE_STATIC_LIBS ON) - add_definitions(-DBOOST_THREAD_USE_LIB) - - # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'. - # The library is named libboost_thread_win32* (not libboost_thread*). - set(Boost_THREADAPI win32) - # Windows does not support UNIX signals. set(ENABLE_SIGNALS FALSE) endif() @@ -64,10 +55,13 @@ endif() #= Dependencies #------------------------------------------------------------------------------- -list(APPEND PKGDEPS libsigrokcxx>=0.4.0) +list(APPEND PKGDEPS glib-2.0>=2.28.0) +list(APPEND PKGDEPS glibmm-2.4>=2.28.0) + +list(APPEND PKGDEPS libsigrokcxx>=0.5.0) if(ENABLE_DECODE) - list(APPEND PKGDEPS libsigrokdecode>=0.4.0) + list(APPEND PKGDEPS libsigrokdecode>=0.5.0) endif() if(ANDROID) @@ -77,32 +71,19 @@ 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) + +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 thread) +set(BOOSTCOMPS filesystem serialization system) if(ENABLE_TESTS) list(APPEND BOOSTCOMPS unit_test_framework) endif() @@ -112,7 +93,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 @@ -176,6 +156,8 @@ set(PV_TITLE PulseView) set(PV_DESCRIPTION "A GUI for sigrok") set(PV_VERSION_STRING "0.4.0") +set(PV_GLIBMM_VERSION ${PKGDEPS_glibmm-2.4_VERSION}) + include(GetGitRevisionDescription) # Append the revision hash unless we are exactly on a tagged release. @@ -385,23 +367,13 @@ 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() +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) @@ -427,7 +399,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} - ${QT_INCLUDE_DIRS} ) if(STATIC_PKGDEPS_LIBS) @@ -473,17 +444,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} ${pulseview_RESOURCES_RCC}) else() -add_executable(${PROJECT_NAME} - ${pulseview_SOURCES} - ${pulseview_HEADERS_MOC} - ${pulseview_RESOURCES_RCC} -) + add_executable(${PROJECT_NAME} ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC}) endif() target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})