]> sigrok.org Git - pulseview.git/blobdiff - CMakeLists.txt
Installer: Update icon cache also after uninstallation
[pulseview.git] / CMakeLists.txt
index d2697fae7c2c6d21a670166a39666283f49a933b..b18b81a7c4841b6edf937a91c13d1cf70f006f37 100644 (file)
@@ -18,7 +18,7 @@
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ##
 
-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.
@@ -56,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)
@@ -69,30 +71,17 @@ 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)
 if(ENABLE_TESTS)
@@ -104,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
@@ -168,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.
@@ -377,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)
@@ -419,7 +399,6 @@ include_directories(
        ${CMAKE_CURRENT_BINARY_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${Boost_INCLUDE_DIRS}
-       ${QT_INCLUDE_DIRS}
 )
 
 if(STATIC_PKGDEPS_LIBS)
@@ -465,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})