Commit ad3334f1 authored by Bartosz Brachaczek's avatar Bartosz Brachaczek

build: Use automoc

This lessens our include hell a bit, among other benefits.
Signed-off-by: 's avatarBartosz Brachaczek <b.brachaczek@gmail.com>
parent 0fd6a044
......@@ -11,6 +11,9 @@ option (BUILD_TESTING "Build the test suite." "${ENABLE_DEVELOPER_BUILD}")
list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
list (INSERT CMAKE_PREFIX_PATH 0 "${CMAKE_CURRENT_BINARY_DIR}")
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_AUTOMOC ON)
if (NOT DEFINED CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
if (ENABLE_DEVELOPER_BUILD)
set (default Debug)
......
......@@ -94,9 +94,6 @@ macro (kadu_plugin KADU_PLUGIN_NAME)
message (FATAL_ERROR "Unknown keywords given to kadu_plugin(): \"${KADU_UNPARSED_ARGUMENTS}\"")
endif()
include_directories (".")
include_directories (${KADU_INCLUDE_DIRS})
if (WIN32)
include_directories ("${KADU_SDK_DIR}" "${KADU_SDK_DIR}/plugins")
......@@ -114,9 +111,12 @@ macro (kadu_plugin KADU_PLUGIN_NAME)
DESTINATION ${KADU_INSTALL_PLUGINS_DATA_DIR}
)
qt4_wrap_cpp (_moc_files ${KADU_PLUGIN_MOC_SOURCES})
add_library (${KADU_PLUGIN_NAME} SHARED ${KADU_PLUGIN_SOURCES} ${_moc_files})
add_library (${KADU_PLUGIN_NAME} SHARED ${KADU_PLUGIN_SOURCES} ${KADU_PLUGIN_MOC_SOURCES})
kadu_set_flags (${KADU_PLUGIN_NAME})
set_property (TARGET ${KADU_PLUGIN_NAME} PROPERTY AUTOMOC ON)
set_property (TARGET ${KADU_PLUGIN_NAME} APPEND PROPERTY INCLUDE_DIRECTORIES
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${KADU_INCLUDE_DIRS}
)
if (KADU_INSTALL_UNOFFICIAL_TRANSLATIONS)
file (GLOB _translation_sources RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "translations/${KADU_PLUGIN_NAME}_*.ts")
......
......@@ -108,6 +108,8 @@ set (kadu_MOC_SRCS
kadu-application.h
themes.h
updates.h
os/qtsingleapplication/qtlocalpeer.h
)
set (kadu_SUBDIRS
......@@ -144,8 +146,6 @@ set (kadu_SUBDIRS
url-handlers
)
qt4_wrap_cpp (MOC_FILES ${kadu_MOC_SRCS})
find_package (QCA2 REQUIRED)
include_directories (${QCA2_INCLUDE_DIR})
add_definitions (${QCA2_DEFINITIONS})
......@@ -213,15 +213,10 @@ endif ()
macro (kadu_subdirectory SUBDIR SRCS MOC_SRCS ADDITIONAL_INCLUDES)
if (FAST_LINKING)
set (${SUBDIR}_MOC_FILES "")
if (NOT "${MOC_SRCS}" STREQUAL "")
qt4_wrap_cpp (${SUBDIR}_MOC_FILES ${MOC_SRCS})
endif ()
add_library (${SUBDIR}
STATIC
${SRCS}
${${SUBDIR}_MOC_FILES}
${MOC_SRCS}
)
kadu_set_flags (${SUBDIR})
set_property (TARGET ${SUBDIR} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
......@@ -253,8 +248,7 @@ macro (kadu_source_subdirectories CURRENT_TARGET)
${ARG}
)
else ()
list (APPEND kadu_SUBDIRS_SRCS "${${ARG}_SRCS}")
qt4_wrap_cpp (MOC_FILES "${${ARG}_MOC_SRCS}")
list (APPEND kadu_SUBDIRS_SRCS ${${ARG}_SRCS} ${${ARG}_MOC_SRCS})
include_directories (${${ARG}_INCLUDES})
endif ()
endforeach ()
......@@ -271,7 +265,7 @@ endmacro ()
if (NOT FAST_LINKING)
kadu_source_subdirectories (libkadu ${kadu_SUBDIRS})
endif ()
add_library (libkadu SHARED ${kadu_SRCS} ${kadu_SUBDIRS_SRCS} ${MOC_FILES})
add_library (libkadu SHARED ${kadu_SRCS} ${kadu_MOC_SRCS} ${kadu_SUBDIRS_SRCS})
kadu_set_flags (libkadu)
if (FAST_LINKING)
kadu_source_subdirectories (libkadu ${kadu_SUBDIRS})
......
......@@ -21,7 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "accounts/account.h"
#include "accounts/accounts-aware-object.h"
#include "buddies/buddy-manager.h"
#include "chat/chat-manager.h"
......@@ -263,3 +262,5 @@ void AccountManager::loaded()
foreach (const Account &account, allItems())
account.accountContact().setOwnerBuddy(Core::instance()->myself());
}
#include "moc_account-manager.cpp"
......@@ -464,3 +464,5 @@ void AccountShared::fileTransferServiceChanged(FileTransferService *service)
}
KaduShared_PropertyPtrReadDef(AccountShared, Identity, accountIdentity, AccountIdentity)
#include "moc_account-shared.cpp"
......@@ -145,8 +145,4 @@ signals:
};
// for MOC
#include "contacts/contact.h"
#include "status/status.h"
#endif // ACCOUNT_SHARED_H
......@@ -96,3 +96,5 @@ void AccountStatusContainer::triggerStatusUpdated()
{
emit statusUpdated(this);
}
#include "moc_account-status-container.cpp"
......@@ -43,3 +43,5 @@ bool HaveMultilogonFilter::acceptAccount(Account account)
return false;
return 0 != account.protocolHandler()->multilogonService();
}
#include "moc_have-multilogon-filter.cpp"
......@@ -46,3 +46,5 @@ bool ProtocolFilter::acceptAccount(Account account)
{
return (ProtocolName.isEmpty() || ProtocolName == account.protocolName());
}
#include "moc_protocol-filter.cpp"
......@@ -43,3 +43,5 @@ bool WriteableContactsListFilter::acceptAccount(Account account)
return !protocol->contactsListReadOnly();
}
#include "moc_writeable-contacts-list-filter.cpp"
......@@ -160,3 +160,5 @@ void AccountsModel::setIncludeIdInDisplay(bool includeIdInDisplay)
IncludeIdInDisplay = includeIdInDisplay;
emit dataChanged(index(0, 0), index(rowCount() - 1, 0));
}
#include "moc_accounts-model.cpp"
......@@ -99,3 +99,5 @@ void AccountsProxyModel::filterChangedSlot()
invalidateFilter();
emit filterChanged();
}
#include "moc_accounts-proxy-model.cpp"
......@@ -115,3 +115,5 @@ Contact AvatarJobManager::nextJob()
return job;
}
#include "moc_avatar-job-manager.cpp"
......@@ -70,7 +70,4 @@ signals:
};
// for MOC
#include "contacts/contact.h"
#endif // AVATAR_JOB_MANAGER_H
......@@ -84,3 +84,5 @@ void AvatarJobRunner::timeout()
emit jobFinished(false);
deleteLater();
}
#include "moc_avatar-job-runner.cpp"
......@@ -226,3 +226,5 @@ Avatar AvatarManager::byContact(Contact contact, NotFoundAction action)
return avatar;
}
#include "moc_avatar-manager.cpp"
......@@ -89,7 +89,4 @@ signals:
};
// for MOC
#include "contacts/contact.h"
#endif // AVATAR_MANAGER_H
......@@ -225,3 +225,5 @@ void AvatarShared::setPixmap(const QPixmap &pixmap)
changeNotifier()->notify();
emit pixmapUpdated();
}
#include "moc_avatar-shared.cpp"
......@@ -66,3 +66,5 @@ void BuddyAdditionalDataDeleteHandlerManager::unregisterAdditionalDataDeleteHand
Items.removeAll(handler);
emit additionalDataDeleteHandlerUnregistered(handler);
}
#include "moc_buddy-additional-data-delete-handler-manager.cpp"
......@@ -24,7 +24,6 @@
#include "accounts/account.h"
#include "buddies/buddy-list.h"
#include "buddies/buddy.h"
#include "configuration/configuration-manager.h"
#include "configuration/xml-configuration-file.h"
#include "contacts/contact-manager.h"
......@@ -348,3 +347,5 @@ void BuddyManager::buddyContactRemoved(const Contact &contact)
if (!buddy.isNull())
emit buddyContactRemoved(buddy, contact);
}
#include "moc_buddy-manager.cpp"
......@@ -223,3 +223,5 @@ Account BuddyPreferredManager::getCommonAccount(const BuddySet &buddies)
return Account::null;
}
#include "moc_buddy-preferred-manager.cpp"
......@@ -544,3 +544,5 @@ QSharedPointer<StoragePoint> BuddyShared::createStoragePoint()
}
KaduShared_PropertyPtrReadDef(BuddyShared, Avatar, buddyAvatar, BuddyAvatar)
#include "moc_buddy-shared.cpp"
......@@ -201,7 +201,4 @@ signals:
};
// for MOC
#include "contacts/contact.h"
#endif // BUDDY_SHARED_DATA
......@@ -26,6 +26,7 @@
#include "avatars/avatar-manager.h"
#include "avatars/avatar.h"
#include "buddies/buddy-manager.h"
#include "buddies/group.h"
#include "configuration/configuration-manager.h"
#include "configuration/xml-configuration-file.h"
#include "contacts/contact.h"
......
......@@ -127,7 +127,4 @@ public:
Q_DECLARE_METATYPE(Buddy)
// for MOC
#include "buddies/group.h"
#endif // BUDDY_H
......@@ -26,7 +26,6 @@
#include <QtXml/QDomElement>
#include "buddies/buddy-manager.h"
#include "buddies/group.h"
#include "configuration/xml-configuration-file.h"
#include "core/core.h"
#include "gui/windows/message-dialog.h"
......@@ -213,3 +212,5 @@ void GroupManager::itemRemoved(Group item)
disconnect(item, 0, this, 0);
emit groupRemoved(item);
}
#include "moc_group-manager.cpp"
......@@ -26,12 +26,11 @@
#include <QtCore/QObject>
#include <QtCore/QString>
#include "buddies/group.h"
#include "storage/simple-manager.h"
#include "exports.h"
class Group;
class KADUAPI GroupManager : public QObject, public SimpleManager<Group>
{
Q_OBJECT
......@@ -80,6 +79,4 @@ signals:
};
#include "buddies/group.h" // for MOC
#endif // GROUP_MANAGER_H
......@@ -129,3 +129,5 @@ void GroupShared::setName(const QString &name)
emit nameChanged();
}
}
#include "moc_group-shared.cpp"
......@@ -529,3 +529,5 @@ void BuddyListModel::accountUnregistered (Account account)
{
disconnect(account, 0, this, 0);
}
#include "moc_buddy-list-model.cpp"
......@@ -51,3 +51,5 @@ void BuddyManagerAdapter::buddyRemoved(const Buddy &buddy)
{
Model->removeBuddy(buddy);
}
#include "moc_buddy-manager-adapter.cpp"
......@@ -90,3 +90,5 @@ BuddySet CheckableBuddiesProxyModel::checkedBuddies() const
{
return CheckedBuddies;
}
#include "moc_checkable-buddies-proxy-model.cpp"
......@@ -128,3 +128,5 @@ void GroupsModel::groupRemoved(Group group)
endRemoveRows();
}
#include "moc_groups-model.cpp"
......@@ -53,6 +53,4 @@ public:
};
#include "buddies/group.h" // for MOC
#endif // GROUPS_MODEL_H
......@@ -169,3 +169,5 @@ Chat BuddyChatManager::buddyChat(const Buddy &buddy)
else
return createAndInsertBuddyChat(buddy);
}
#include "moc_buddy-chat-manager.cpp"
......@@ -136,3 +136,5 @@ void ChatDetailsBuddy::removeChat(const Chat &chat)
if (indexOf >= 0)
Chats.remove(indexOf);
}
#include "moc_chat-details-buddy.cpp"
......@@ -149,3 +149,5 @@ void ChatDetailsContactSet::setContacts(const ContactSet &contacts)
Contacts = contacts;
}
#include "moc_chat-details-contact-set.cpp"
......@@ -178,3 +178,5 @@ Contact ChatDetailsContact::contact()
{
return CurrentContact;
}
#include "moc_chat-details-contact.cpp"
......@@ -203,3 +203,5 @@ void ChatDetailsRoom::removeContact(const Contact &contact)
Contacts.remove(contact);
emit contactRemoved(contact);
}
#include "moc_chat-details-room.cpp"
......@@ -164,3 +164,5 @@ void ChatManager::unreadMessageRemoved(const Message &message)
if (unreadMessagesCount > 0)
chat.setUnreadMessagesCount(unreadMessagesCount - 1);
}
#include "moc_chat-manager.cpp"
......@@ -475,3 +475,5 @@ void ChatShared::setOpen(bool open)
else
emit closed();
}
#include "moc_chat-shared.cpp"
......@@ -504,3 +504,5 @@ void ChatStylesManager::configurationWindowDestroyed()
VariantListCombo = 0;
TurnOnTransparency = 0;
}
#include "moc_chat-styles-manager.cpp"
......@@ -22,13 +22,13 @@
*/
#include "accounts/account.h"
#include "buddies/group.h"
#include "chat/chat-details.h"
#include "chat/chat-manager.h"
#include "contacts/contact-set.h"
#include "chat.h"
KaduSharedBaseClassImpl(Chat)
/**
......
......@@ -148,7 +148,4 @@ public:
Q_DECLARE_METATYPE(Chat)
// for MOC