Commit 7bc82c78 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for USE_UNITY_CMAKE_SUPPORT compile support

parent 7fff3c6e
Pipeline #44917 passed with stage
in 9 minutes and 49 seconds
......@@ -70,6 +70,17 @@ add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054E00)
add_definitions(-DQT_NO_EMIT)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false)
if (USE_UNITY_CMAKE_SUPPORT)
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support")
else()
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT true)
add_definitions(-DCOMPILE_WITH_UNITY_CMAKE_SUPPORT)
endif()
endif()
add_subdirectory(calendarjanitor)
add_subdirectory(konsolekalendar)
......
......@@ -9,7 +9,9 @@ set(calendarjanitor_SRCS
options.cpp)
add_executable(calendarjanitor ${calendarjanitor_SRCS})
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(calendarjanitor PROPERTIES UNITY_BUILD ON)
endif()
target_link_libraries(calendarjanitor
KF5::CalendarUtils
KF5::CalendarCore
......
......@@ -23,7 +23,7 @@
#include <QCoreApplication>
static void print(const QString &message)
static void printOut(const QString &message)
{
QTextStream out(stdout);
out << message << "\n";
......@@ -32,9 +32,9 @@ static void print(const QString &message)
void Backuper::emitFinished(bool success, const QString &message)
{
if (success) {
print(QLatin1Char('\n') + i18np("Backup was successful. %1 incidence was saved.", "Backup was successful. %1 incidences were saved.", m_calendar->incidences().count()));
printOut(QLatin1Char('\n') + i18np("Backup was successful. %1 incidence was saved.", "Backup was successful. %1 incidences were saved.", m_calendar->incidences().count()));
} else {
print(message);
printOut(message);
}
m_calendar.clear();
......@@ -59,7 +59,7 @@ void Backuper::backup(const QString &filename, const QList<Akonadi::Collection::
emitFinished(false, i18n("A backup is already in progress."));
return;
}
print(i18n("Backing up your calendar data..."));
printOut(i18n("Backing up your calendar data..."));
m_calendar = KCalendarCore::MemoryCalendar::Ptr(new KCalendarCore::MemoryCalendar(QTimeZone::systemTimeZone()));
m_requestedCollectionIds = collectionIds;
m_backupInProgress = true;
......@@ -103,7 +103,7 @@ void Backuper::onCollectionsFetched(KJob *job)
void Backuper::loadCollection(const Akonadi::Collection &collection)
{
print(i18n("Processing collection %1 (id=%2)...", collection.displayName(), collection.id()));
printOut(i18n("Processing collection %1 (id=%2)...", collection.displayName(), collection.id()));
Akonadi::ItemFetchJob *ifj = new Akonadi::ItemFetchJob(collection, this);
ifj->setProperty("collectionId", collection.id());
ifj->fetchScope().fetchFullPayload(true);
......
......@@ -33,16 +33,18 @@ static const char progDisplay[] = I18N_NOOP("CalendarJanitor");
static const QString progVersion = QStringLiteral(KDEPIM_VERSION);
static const char progDesc[] = I18N_NOOP("A command line interface to report and fix errors in your calendar data");
static void print(const QString &message)
#ifndef COMPILE_WITH_UNITY_CMAKE_SUPPORT
static void printOut(const QString &message)
{
QTextStream out(stdout);
out << message << "\n";
}
#endif
static void printCollectionsUsage()
{
print(i18n("Error while parsing %1", QStringLiteral("--collections")));
print(i18n("Example usage: %1", QStringLiteral("--collections 90,23,40")));
printOut(i18n("Error while parsing %1", QStringLiteral("--collections")));
printOut(i18n("Example usage: %1", QStringLiteral("--collections 90,23,40")));
}
static void silenceStderr()
......@@ -105,17 +107,17 @@ int main(int argv, char *argc[])
}
if (parser.isSet(fixOpt) && parser.isSet(backupOpt)) {
print(i18n("--fix is incompatible with --backup"));
printOut(i18n("--fix is incompatible with --backup"));
return -1;
}
if (parser.isSet(stripOldAlarmsOpt) && parser.isSet(backupOpt)) {
print(i18n("--strip-old-alarms is incompatible with --backup"));
printOut(i18n("--strip-old-alarms is incompatible with --backup"));
return -1;
}
if (parser.isSet(stripOldAlarmsOpt) && parser.isSet(fixOpt)) {
print(i18n("--strip-old-alarms is incompatible with --fix"));
printOut(i18n("--strip-old-alarms is incompatible with --fix"));
return -1;
}
......@@ -126,16 +128,16 @@ int main(int argv, char *argc[])
QString backupFile;
if (parser.isSet(fixOpt)) {
janitorOptions.setAction(Options::ActionScanAndFix);
print(i18n("Running in fix mode."));
printOut(i18n("Running in fix mode."));
} else if (parser.isSet(backupOpt)) {
backupFile = parser.value(backupOpt);
if (backupFile.isEmpty()) {
print(i18n("Please specify a output file."));
printOut(i18n("Please specify a output file."));
return -1;
}
janitorOptions.setAction(Options::ActionBackup);
} else {
print(i18n("Running in scan only mode."));
printOut(i18n("Running in scan only mode."));
janitorOptions.setAction(Options::ActionScan);
}
......
......@@ -20,6 +20,9 @@ ecm_qt_declare_logging_category(konsolekalendar_SRCS HEADER konsolekalendar_debu
)
add_executable(konsolekalendar ${konsolekalendar_SRCS})
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(konsolekalendar PROPERTIES UNITY_BUILD ON)
endif()
target_link_libraries(konsolekalendar
Qt5::DBus
......
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