Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Commit

Permalink
Provide minimum versions
Browse files Browse the repository at this point in the history
Removed Qt 4 support
  • Loading branch information
agaida committed Nov 30, 2018
1 parent 4e40229 commit 562773e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 37 deletions.
44 changes: 11 additions & 33 deletions CMakeLists.txt
Expand Up @@ -6,7 +6,8 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# versions.
project(compton-conf)

set(LXQTBT_MINIMUM_VERSION "0.5.0")
set(LXQTBT_MINIMUM_VERSION "0.6.0")
set(QT_MINIMUM_VERSION "5.7.1")

option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)

Expand All @@ -20,32 +21,19 @@ add_definitions(
"-DCOMPTONCONF_VERSION=\"${COMPTONCONF_VERSION}\""
)


include(LXQtPreventInSourceBuilds)
include(LXQtConfigVars)
include(LXQtTranslateTs)
include(LXQtTranslateDesktop)

# Support Qt4
option(USE_QT4 "Build with Qt4." $ENV{USE_QT4})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)

if(USE_QT4)
set(USE_QT5 FALSE)
find_package(Qt4 REQUIRED QtCore QtGui QtDbus)
include(${QT_USE_FILE})
add_definitions(-DUSE_QT4)
message(STATUS "Building with Qt${QTVERSION}")
else()
set(USE_QT5 TRUE)
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}")
endif()
find_package(Qt5Widgets ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt5DBus ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt5LinguistTools ${QT_MINIMUM_VERSION} REQUIRED)
message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}")

# libconfig using pkg-config
find_package(PkgConfig REQUIRED)
Expand All @@ -58,21 +46,15 @@ include(LXQtCompilerSettings NO_POLICY_SCOPE) # must be after cmake_minimum_requ

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_KEYWORDS")

if(USE_QT4)
set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR})
set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
else()
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus)
endif()
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus)

include_directories(
${QTX_INCLUDE_DIRS}
${LIBCONFIG_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)


set(compton-conf_HS
compton-conf.h
maindialog.h
Expand All @@ -92,8 +74,8 @@ set(compton-conf_DESKTOP_FILES_IN
)

lxqt_translate_ts(compton-conf_QM_FILES
USE_QT5 ${USE_QT5}
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
UPDATE_TRANSLATIONS
${UPDATE_TRANSLATIONS}
SOURCES
${compton-conf_HS}
${compton-conf_SRCS}
Expand All @@ -104,11 +86,7 @@ lxqt_translate_ts(compton-conf_QM_FILES

lxqt_translate_desktop(compton-conf_DESKTOP_FILES SOURCES ${compton-conf_DESKTOP_FILES_IN})

if(USE_QT4)
qt4_wrap_ui(compton-conf_UI_H ${compton-conf_UIS})
else()
qt5_wrap_ui(compton-conf_UI_H ${compton-conf_UIS})
endif()
qt5_wrap_ui(compton-conf_UI_H ${compton-conf_UIS})

set_property(SOURCE ${compton-conf_UI_H} PROPERTY SKIP_AUTOMOC ON)

Expand Down
4 changes: 0 additions & 4 deletions compton-conf.cpp
Expand Up @@ -3,14 +3,11 @@
#include <QLocale>
#include <QLibraryInfo>
#include <QTranslator>
#ifndef USE_QT4
#include <QCommandLineParser>
#endif
#include "maindialog.h"

int main(int argc, char** argv) {
QApplication app(argc, argv);
#ifndef USE_QT4
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

QCommandLineParser parser;
Expand All @@ -21,7 +18,6 @@ int main(int argc, char** argv) {
parser.addVersionOption();
parser.addHelpOption();
parser.process(app);
#endif

// load translations
QTranslator qtTranslator, translator;
Expand Down

0 comments on commit 562773e

Please sign in to comment.