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

Allow to use UNITY build see...

Allow to use UNITY build see https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html (Reduce compile time. Need cmake 3.16.0)
parent 866c4ba9
Pipeline #44088 passed with stage
in 46 minutes and 27 seconds
......@@ -110,6 +110,18 @@ if(BUILD_TESTING)
endif()
add_definitions(-DQT_NO_EMIT)
option(USE_UNIFY_CMAKE_SUPPORT "Use UNIFY cmake support (speedup compile time)" FALSE)
set(COMPILE_WITH_CMAKE_SUPPORT false)
if (USE_UNIFY_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_CMAKE_SUPPORT true)
add_definitions(-DCOMPILE_WITH_CMAKE_SUPPORT)
endif()
endif()
add_subdirectory(mimetreeparser)
add_subdirectory(messageviewer)
add_subdirectory(templateparser)
......
......@@ -213,6 +213,9 @@ kconfig_add_kcfg_files(messagecomposer_src
)
add_library( KF5MessageComposer ${messagecomposer_src} )
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5MessageComposer PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5MessageComposer BASE_NAME messagecomposer)
add_library(KF5::MessageComposer ALIAS KF5MessageComposer)
target_link_libraries(KF5MessageComposer
......
......@@ -31,7 +31,7 @@ public:
};
namespace {
QString pluginVersion()
QString pluginEditorVersion()
{
return QStringLiteral("1.0");
}
......@@ -86,7 +86,7 @@ void PluginEditorManagerPrivate::initializePlugins()
order = p.toInt();
}
info.order = order;
if (pluginVersion() == data.version()) {
if (pluginEditorVersion() == data.version()) {
// only load plugins once, even if found multiple times!
if (unique.contains(info.metaDataFileNameBaseName)) {
continue;
......
......@@ -31,7 +31,7 @@ public:
};
namespace {
QString pluginVersion()
QString pluginEditorGrammarVersion()
{
return QStringLiteral("1.0");
}
......@@ -94,7 +94,7 @@ void PluginEditorGrammarManagerPrivate::initializePlugins()
info.isEnabled = isPluginActivated;
info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
info.metaDataFileName = data.fileName();
if (pluginVersion() == data.version()) {
if (pluginEditorGrammarVersion() == data.version()) {
// only load plugins once, even if found multiple times!
if (unique.contains(info.metaDataFileNameBaseName)) {
continue;
......
......@@ -51,6 +51,10 @@ ecm_qt_declare_logging_category(messagecore_LIB_SRCS HEADER messagecore_debug.h
add_library(KF5MessageCore ${messagecore_LIB_SRCS})
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5MessageCore PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5MessageCore BASE_NAME messagecore)
add_library(KF5::MessageCore ALIAS KF5MessageCore)
......
......@@ -14,7 +14,7 @@
#include <QScopedPointer>
#include <QSharedPointer>
static const mode_t archivePerms = S_IFREG | 0644;
static const mode_t archivePermsAttachment = S_IFREG | 0644;
using namespace MessageCore;
......@@ -115,7 +115,7 @@ void AttachmentFromFolderJob::Private::addEntity(const QFileInfoList &f, const Q
q->emitResult();
return;
}
if (!mZip->writeFile(path + infoFileName, file.readAll(), archivePerms,
if (!mZip->writeFile(path + infoFileName, file.readAll(), archivePermsAttachment,
QString(), QString(), mArchiveTime, mArchiveTime, mArchiveTime)) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Could not add %1 to the archive", file.fileName()));
......
......@@ -59,6 +59,10 @@ kconfig_add_kcfg_files(libmessagelist_SRCS
)
add_library(KF5MessageList ${libmessagelist_SRCS})
#if (COMPILE_WITH_CMAKE_SUPPORT)
# set_target_properties(KF5MessageList PROPERTIES UNITY_BUILD ON)
#endif()
generate_export_header(KF5MessageList BASE_NAME messagelist)
add_library(KF5::MessageList ALIAS KF5MessageList)
......
......@@ -879,7 +879,7 @@ void Pane::Private::updateTabControls()
}
}
Item Pane::currentItem() const
Akonadi::Item Pane::currentItem() const
{
auto *w = static_cast<Widget *>(currentWidget());
......
......@@ -95,7 +95,7 @@ bool Widget::canAcceptDrag(const QDropEvent *e)
return false;
}
Collection::List collections = static_cast<const StorageModel *>(storageModel())->displayedCollections();
Collection::List collections = static_cast<const MessageList::StorageModel *>(storageModel())->displayedCollections();
if (collections.size() != 1) {
return false; // no folder here or too many (in case we can't decide where the drop will end)
}
......@@ -319,7 +319,7 @@ void Widget::viewMessageStatusChangeRequest(MessageList::Core::MessageItem *msg,
int row = msg->currentModelIndexRow();
Q_ASSERT(row >= 0);
Item item = d->itemForRow(row);
Akonadi::Item item = d->itemForRow(row);
Q_ASSERT(item.isValid());
Q_EMIT messageStatusChangeRequest(item, set, clear);
......@@ -429,7 +429,7 @@ void Widget::viewDropEvent(QDropEvent *e)
return;
}
Collection::List collections = static_cast<const StorageModel *>(storageModel())->displayedCollections();
Collection::List collections = static_cast<const MessageList::StorageModel *>(storageModel())->displayedCollections();
Collection target = collections.at(0);
Item::List items;
items.reserve(urls.count());
......@@ -446,7 +446,7 @@ void Widget::viewDropEvent(QDropEvent *e)
void Widget::viewStartDragRequest()
{
Collection::List collections = static_cast<const StorageModel *>(storageModel())->displayedCollections();
Collection::List collections = static_cast<const MessageList::StorageModel *>(storageModel())->displayedCollections();
if (collections.isEmpty()) {
return; // no folder here
......@@ -523,12 +523,12 @@ Item::List Widget::Private::selectionAsItems() const
Item Widget::Private::itemForRow(int row) const
{
return static_cast<const StorageModel *>(q->storageModel())->itemForRow(row);
return static_cast<const MessageList::StorageModel *>(q->storageModel())->itemForRow(row);
}
KMime::Message::Ptr Widget::Private::messageForRow(int row) const
{
return static_cast<const StorageModel *>(q->storageModel())->messageForRow(row);
return static_cast<const MessageList::StorageModel *>(q->storageModel())->messageForRow(row);
}
Item Widget::currentItem() const
......@@ -727,7 +727,7 @@ MessageList::Core::MessageItemSetReference Widget::currentThreadAsPersistentSet(
Akonadi::Collection Widget::currentCollection() const
{
Collection::List collections = static_cast<const StorageModel *>(storageModel())->displayedCollections();
Collection::List collections = static_cast<const MessageList::StorageModel *>(storageModel())->displayedCollections();
if (collections.size() != 1) {
return Akonadi::Collection(); // no folder here or too many (in case we can't decide where the drop will end)
}
......
......@@ -301,6 +301,10 @@ ki18n_wrap_ui(libmessageviewer_SRCS
add_library(KF5MessageViewer ${libmessageviewer_SRCS})
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5MessageViewer PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5MessageViewer BASE_NAME messageviewer)
add_library(KF5::MessageViewer ALIAS KF5MessageViewer)
......
......@@ -18,7 +18,7 @@
#include <QPushButton>
namespace {
static const char myConfigGroupName[] = "DKIMManageRulesDialog";
static const char myDKIMManageRulesDialogGroupName[] = "DKIMManageRulesDialog";
}
using namespace MessageViewer;
......@@ -90,7 +90,7 @@ void DKIMManageRulesDialog::slotImport()
void DKIMManageRulesDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
KConfigGroup group(KSharedConfig::openConfig(), myDKIMManageRulesDialogGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
mRulesWidget->restoreHeaders(group.readEntry("Header", QByteArray()));
if (size.isValid()) {
......@@ -100,7 +100,7 @@ void DKIMManageRulesDialog::readConfig()
void DKIMManageRulesDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myConfigGroupName);
KConfigGroup group(KSharedConfig::openConfig(), myDKIMManageRulesDialogGroupName);
group.writeEntry("Header", mRulesWidget->saveHeaders());
group.writeEntry("Size", size());
group.sync();
......
......@@ -23,10 +23,11 @@
#include <grantlee/templateloader.h>
#include <QGuiApplication>
#ifndef COMPILE_WITH_CMAKE_SUPPORT
Q_DECLARE_METATYPE(GpgME::DecryptionResult::Recipient)
Q_DECLARE_METATYPE(const QGpgME::Protocol *)
Q_DECLARE_METATYPE(GpgME::Key)
#endif
// Read-only introspection of GpgME::DecryptionResult::Recipient object.
GRANTLEE_BEGIN_LOOKUP(GpgME::DecryptionResult::Recipient)
......
......@@ -120,6 +120,10 @@ ecm_qt_declare_logging_category(libmimetreeparser_SRCS HEADER mimetreeparser_deb
add_library(KF5MimeTreeParser
${libmimetreeparser_SRCS}
)
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5MimeTreeParser PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5MimeTreeParser BASE_NAME mimetreeparser)
add_library(KF5::MimeTreeParser ALIAS KF5MimeTreeParser)
......
......@@ -45,6 +45,10 @@ ki18n_wrap_ui(templateparser_LIB_SRCS
)
add_library(KF5TemplateParser ${templateparser_LIB_SRCS})
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5TemplateParser PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5TemplateParser BASE_NAME templateparser)
add_library(KF5::TemplateParser ALIAS KF5TemplateParser)
......
......@@ -10,7 +10,7 @@
#include <QWebEngineScript>
template<typename Arg, typename R, typename C>
struct InvokeWrapper {
struct InvokeWrapperFunction {
R *receiver;
void (C::*memberFun)(Arg);
void operator()(Arg result)
......@@ -20,9 +20,9 @@ struct InvokeWrapper {
};
template<typename Arg, typename R, typename C>
InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
InvokeWrapperFunction<Arg, R, C> invokeFunction(R *receiver, void (C::*memberFun)(Arg))
{
InvokeWrapper<Arg, R, C> wrapper = {receiver, memberFun};
InvokeWrapperFunction<Arg, R, C> wrapper = {receiver, memberFun};
return wrapper;
}
......@@ -70,7 +70,7 @@ void TemplateExtractHtmlElementFromMail::slotLoadFinished(bool success)
if (success) {
mPage->runJavaScript(extractHeaderBodyScript(),
(QWebEngineScript::UserWorld + 2),
invoke(this, &TemplateExtractHtmlElementFromMail::handleHtmlInfo));
invokeFunction(this, &TemplateExtractHtmlElementFromMail::handleHtmlInfo));
} else {
Q_EMIT loadContentDone(false);
}
......
......@@ -85,6 +85,10 @@ ecm_qt_declare_logging_category(libwebengineviewer_webengine_SRCS HEADER webengi
add_library(KF5WebEngineViewer ${libwebengineviewer_SRCS} ${libwebengineviewer_webengine_SRCS})
if (COMPILE_WITH_CMAKE_SUPPORT)
set_target_properties(KF5WebEngineViewer PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(KF5WebEngineViewer BASE_NAME webengineviewer)
add_library(KF5::WebEngineViewer ALIAS KF5WebEngineViewer)
......
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