Commit ddb7e9a0 authored by AlmAck's avatar AlmAck

port to qt5:

- cmake minimum version 3.0.0
- ${QT_INCLUDES} -> ${Qt5XXX_LIBRARIES}
- fromAscii -> fromLatin1
parent c1944d05
project(akabei)
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0.0)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/akabei" CACHE "Akabei data's install dir" STRING)
set(SCRIPTS_INSTALL_DIR "${DATA_INSTALL_DIR}/python" CACHE "Akabei scripts' install dir" STRING)
set(LOCALE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/locale" CACHE "Akabei locales' install dir" STRING)
find_package(Qt5 5.2.0 REQUIRED CONFIG COMPONENTS Core Network)
find_package(AkabeiCore REQUIRED)
find_package(AkabeiClient REQUIRED)
find_package(MSGFMT REQUIRED)
find_package(Qt4 REQUIRED)
# This header adds a macro to make the licenses accessible to akabei independently of the install prefix
configure_file(
......@@ -18,11 +19,13 @@ configure_file(
IMMEDIATE @ONLY
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
add_definitions(-Wall -Werror -std=c++11)
add_definitions(${QT_DEFINITIONS} -W -Wall)
add_definitions(-Werror)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(BEFORE SYSTEM
${QT_INCLUDES}
${Qt5Core_LIBRARIES}
${Qt5Network_LIBRARIES}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}
${AKABEICLIENT_INCLUDE_DIR}
......@@ -52,22 +55,16 @@ add_subdirectory(translations)
add_subdirectory(docs)
add_subdirectory(licenses)
# qt4_automoc() doesn't recognize our operation files, so I use this safer version instead
QT4_WRAP_CPP(MISSING_MOCS
apm.h
queryoperation.h
queueoperation.h
removeoperation.h
upgradeoperation.h
syncoperation.h
performoperation.h)
add_executable(akabei ${apm_SRCS} ${MISSING_MOCS})
target_link_libraries(akabei ${QT_QTCORE_LIBRARY} ${AKABEICORE_LIBRARIES} ${AKABEICLIENT_LIBRARIES})
set_target_properties(akabei PROPERTIES AUTOMOC TRUE)
target_link_libraries(akabei ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${AKABEICORE_LIBRARIES} ${AKABEICLIENT_LIBRARIES})
install(TARGETS akabei
RUNTIME DESTINATION bin)
add_executable(pakabei ${apm_SRCS} ${MISSING_MOCS})
target_link_libraries(pakabei ${QT_QTCORE_LIBRARY} ${AKABEICORE_LIBRARIES} ${AKABEICLIENT_LIBRARIES})
set_target_properties(pakabei PROPERTIES AUTOMOC TRUE)
target_link_libraries(pakabei ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${AKABEICORE_LIBRARIES} ${AKABEICLIENT_LIBRARIES})
install(TARGETS pakabei
RUNTIME DESTINATION bin)
......@@ -30,7 +30,7 @@ bool CommandLine::isSet(const QString& command)
* repeated twice
*/
if (command.size() == 2) {
actualCom = QString::fromAscii("-") + command[0];
actualCom = QString::fromLatin1("-") + command[0];
m_requested.push_front(actualCom);
if (m_commands.count(actualCom) == 2) {
......
......@@ -15,6 +15,7 @@
#include <QString>
#include <QMap>
#include <QTime>
#include <QObject>
class ProgressBar
{
......@@ -25,7 +26,7 @@ public:
Progress = 0x04,
Eta = 0x08
};
Q_DECLARE_FLAGS(Columns, Column);
Q_DECLARE_FLAGS(Columns, Column)
ProgressBar();
virtual ~ProgressBar();
......
......@@ -10,10 +10,10 @@ if(NOT AKABEICORE_FOUND)
endif(NOT AKABEICORE_FOUND)
set(akabei_clean_cache_SRCS main.cpp)
include_directories(${QT_INCLUDES}
include_directories(${Qt5Core_LIBRARIES}
${AKABEICORE_INCLUDE_DIR})
add_executable(akabei-clean-cache ${akabei_clean_cache_SRCS})
target_link_libraries(akabei-clean-cache ${AKABEICORE_LIBRARIES} ${QT_QTCORE_LIBRARY})
target_link_libraries(akabei-clean-cache ${AKABEICORE_LIBRARIES} ${Qt5Core_LIBRARIES})
install(TARGETS akabei-clean-cache
RUNTIME DESTINATION bin)
......@@ -123,9 +123,9 @@ int main(int argc, char **argv)
}
if (arg == "--cachedir" || arg == "-c") {
cachedir = (i < argc - 1) ? QString::fromAscii(argv[i + 1]) : QString();
cachedir = (i < argc - 1) ? QString::fromLatin1(argv[i + 1]) : QString();
} else if (arg == "--databasedir" || arg == "-d") {
databasedir = (i < argc - 1) ? QString::fromAscii(argv[i + 1]) : QString();
databasedir = (i < argc - 1) ? QString::fromLatin1(argv[i + 1]) : QString();
} else if (arg == "-k" || arg == "--keep-package") {
/*
......@@ -133,7 +133,7 @@ int main(int argc, char **argv)
* Also, args can be in a single string, but separated by commas.
*/
for (int j = i + 1; j < argc && argv[j][0] != '-'; j++) {
keepPackages << QString::fromAscii(argv[j]).split(",");
keepPackages << QString::fromLatin1(argv[j]).split(",");
}
} else if (arg == "-o" || arg == "--clean-old") {
......
......@@ -11,10 +11,10 @@ endif(CMAKE_COMPILER_IS_GNUCC)
set(akabei_key_SRCS main.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${QT_INCLUDES}
${Qt5Core_LIBRARIES}
${GPGME_INCLUDES})
add_executable(akabei-key ${akabei_key_SRCS})
target_link_libraries(akabei-key ${QT_QTCORE_LIBRARY} ${GPGME_VANILLA_LIBRARIES})
target_link_libraries(akabei-key ${Qt5Core_LIBRARIES} ${GPGME_VANILLA_LIBRARIES})
install(TARGETS akabei-key
RUNTIME DESTINATION bin)
......@@ -288,7 +288,7 @@ void getFromServer(gpgme_ctx_t ctx, QString id)
out << "- " << key->subkeys->keyid << " " << key->uids->name << " " << key->uids->email << endl;
if (QString::fromAscii(key->subkeys->keyid) == id) {
if (QString::fromLatin1(key->subkeys->keyid) == id) {
found = true;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment