From 7c94e01d9feff8e6c09c88a9e51c8d5a6cb61005 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 31 Jan 2016 14:00:05 +0100 Subject: Explicitly state visibility This cuts the exportet symbols from 12k to 2k and the library size from 16Mb to 14Mb, which isn't great but still an improvement. About 30% of the symbols are coming from the Store:: interface. nm -C -D /work/install/lib64/libsinkcommon.so.0.1 --- common/CMakeLists.txt | 2 ++ common/clientapi.h | 7 ++++--- common/definitions.h | 5 +++-- common/domain/applicationdomaintype.h | 31 ++++++++++++++++--------------- common/domainadaptor.h | 3 ++- common/entitybuffer.h | 3 ++- common/facade.h | 3 ++- common/facadefactory.h | 3 ++- common/index.h | 3 ++- common/listener.h | 3 ++- common/log.h | 11 ++++++----- common/messagequeue.h | 3 ++- common/propertymapper.h | 9 +++++---- common/resource.h | 2 +- common/resourceaccess.h | 5 +++-- common/resourceconfig.h | 3 ++- common/threadboundary.h | 4 +++- 17 files changed, 59 insertions(+), 41 deletions(-) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index cb7bb35..b400993 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -25,6 +25,8 @@ install(FILES COMPONENT Devel ) +add_definitions("-fvisibility=hidden") + install(EXPORT SinkCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE SinkCommonTargets.cmake) set(storage_SRCS storage_lmdb.cpp) diff --git a/common/clientapi.h b/common/clientapi.h index 64c4f64..bd52c3e 100644 --- a/common/clientapi.h +++ b/common/clientapi.h @@ -20,6 +20,7 @@ #pragma once +#include #include #include @@ -38,7 +39,7 @@ class Notification; /** * Store interface used in the client API. */ -class Store { +class SINKCOMMON_EXPORT Store { public: static QString storageLocation(); static QByteArray resourceName(const QByteArray &instanceIdentifier); @@ -121,10 +122,10 @@ public: namespace Resources { template - KAsync::Job inspect(const Inspection &inspectionCommand); + KAsync::Job SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand); } -class Notifier { +class SINKCOMMON_EXPORT Notifier { public: Notifier(const QSharedPointer &resourceAccess); // Notifier(const QByteArray &resource); diff --git a/common/definitions.h b/common/definitions.h index 5834f01..99b8293 100644 --- a/common/definitions.h +++ b/common/definitions.h @@ -20,10 +20,11 @@ #pragma once +#include #include #include namespace Sink { - QString storageLocation(); - QByteArray resourceName(const QByteArray &instanceIdentifier); + QString SINKCOMMON_EXPORT storageLocation(); + QByteArray SINKCOMMON_EXPORT resourceName(const QByteArray &instanceIdentifier); } diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 88f094a..330d680 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -19,6 +19,7 @@ */ #pragma once +#include #include #include #include @@ -35,7 +36,7 @@ namespace ApplicationDomain { * * ApplicationDomainTypes don't adhere to any standard and are meant to be extended frequently (hence the non-typesafe interface). */ -class ApplicationDomainType { +class SINKCOMMON_EXPORT ApplicationDomainType { public: typedef QSharedPointer Ptr; @@ -82,37 +83,37 @@ inline bool operator==(const ApplicationDomainType& lhs, const ApplicationDomain && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier(); } -struct Entity : public ApplicationDomainType { +struct SINKCOMMON_EXPORT Entity : public ApplicationDomainType { typedef QSharedPointer Ptr; using ApplicationDomainType::ApplicationDomainType; virtual ~Entity(); }; -struct Event : public Entity { +struct SINKCOMMON_EXPORT Event : public Entity { typedef QSharedPointer Ptr; using Entity::Entity; virtual ~Event(); }; -struct Todo : public Entity { +struct SINKCOMMON_EXPORT Todo : public Entity { typedef QSharedPointer Ptr; using Entity::Entity; virtual ~Todo(); }; -struct Calendar : public Entity { +struct SINKCOMMON_EXPORT Calendar : public Entity { typedef QSharedPointer Ptr; using Entity::Entity; virtual ~Calendar(); }; -struct Mail : public Entity { +struct SINKCOMMON_EXPORT Mail : public Entity { typedef QSharedPointer Ptr; using Entity::Entity; virtual ~Mail(); }; -struct Folder : public Entity { +struct SINKCOMMON_EXPORT Folder : public Entity { typedef QSharedPointer Ptr; using Entity::Entity; virtual ~Folder(); @@ -124,7 +125,7 @@ struct Folder : public Entity { * This type is used for configuration of resources, * and for creating and removing resource instances. */ -struct SinkResource : public ApplicationDomainType { +struct SINKCOMMON_EXPORT SinkResource : public ApplicationDomainType { typedef QSharedPointer Ptr; using ApplicationDomainType::ApplicationDomainType; virtual ~SinkResource(); @@ -136,22 +137,22 @@ struct SinkResource : public ApplicationDomainType { * Do not store these types to disk, they may change over time. */ template -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); template<> -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); template<> -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); template<> -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); template<> -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); template<> -QByteArray getTypeName(); +QByteArray SINKCOMMON_EXPORT getTypeName(); /** * Type implementation. @@ -160,7 +161,7 @@ QByteArray getTypeName(); * Contains all non-resource specific, but type-specific code. */ template -class TypeImplementation; +class SINKCOMMON_EXPORT TypeImplementation; } } diff --git a/common/domainadaptor.h b/common/domainadaptor.h index d43fad7..36a8b1c 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include @@ -121,7 +122,7 @@ public: * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. */ template -class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface +class SINKCOMMON_EXPORT DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface { typedef typename Sink::ApplicationDomain::TypeImplementation::Buffer LocalBuffer; typedef typename Sink::ApplicationDomain::TypeImplementation::BufferBuilder LocalBuilder; diff --git a/common/entitybuffer.h b/common/entitybuffer.h index c9c2453..c23f2e8 100644 --- a/common/entitybuffer.h +++ b/common/entitybuffer.h @@ -1,12 +1,13 @@ #pragma once +#include #include #include namespace Sink { struct Entity; -class EntityBuffer { +class SINKCOMMON_EXPORT EntityBuffer { public: EntityBuffer(const void *dataValue, int size); const uint8_t *resourceBuffer(); diff --git a/common/facade.h b/common/facade.h index c25464f..26b9e6c 100644 --- a/common/facade.h +++ b/common/facade.h @@ -19,6 +19,7 @@ #pragma once +#include #include "facadeinterface.h" #include @@ -43,7 +44,7 @@ namespace Sink { * Additionally a resource only has to provide a synchronizer plugin to execute the synchronization */ template -class GenericFacade: public Sink::StoreFacade +class SINKCOMMON_EXPORT GenericFacade: public Sink::StoreFacade { public: /** diff --git a/common/facadefactory.h b/common/facadefactory.h index 3dca63b..ee65ac9 100644 --- a/common/facadefactory.h +++ b/common/facadefactory.h @@ -20,6 +20,7 @@ #pragma once +#include #include #include #include @@ -37,7 +38,7 @@ namespace Sink { * * If we were to provide default implementations for certain capabilities. Here would be the place to do so. */ -class FacadeFactory { +class SINKCOMMON_EXPORT FacadeFactory { public: typedef std::function(const QByteArray &)> FactoryFunction; diff --git a/common/index.h b/common/index.h index 20213b2..672f3c2 100644 --- a/common/index.h +++ b/common/index.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -8,7 +9,7 @@ /** * An index for value pairs. */ -class Index +class SINKCOMMON_EXPORT Index { public: enum ErrorCodes { diff --git a/common/listener.h b/common/listener.h index e17f315..d4dc884 100644 --- a/common/listener.h +++ b/common/listener.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -56,7 +57,7 @@ public: qint64 currentRevision; }; -class Listener : public QObject +class SINKCOMMON_EXPORT Listener : public QObject { Q_OBJECT diff --git a/common/log.h b/common/log.h index 483f16f..35b628c 100644 --- a/common/log.h +++ b/common/log.h @@ -1,5 +1,6 @@ #pragma once +#include #include namespace Sink { @@ -12,13 +13,13 @@ enum DebugLevel { Error }; -QByteArray debugLevelName(DebugLevel debugLevel); -DebugLevel debugLevelFromName(const QByteArray &name); +QByteArray SINKCOMMON_EXPORT debugLevelName(DebugLevel debugLevel); +DebugLevel SINKCOMMON_EXPORT debugLevelFromName(const QByteArray &name); -void setDebugOutputLevel(DebugLevel); -DebugLevel debugOutputLevel(); +void SINKCOMMON_EXPORT setDebugOutputLevel(DebugLevel); +DebugLevel SINKCOMMON_EXPORT debugOutputLevel(); -QDebug debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); +QDebug SINKCOMMON_EXPORT debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); } } diff --git a/common/messagequeue.h b/common/messagequeue.h index 3206388..9fe899e 100644 --- a/common/messagequeue.h +++ b/common/messagequeue.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -11,7 +12,7 @@ /** * A persistent FIFO message queue. */ -class MessageQueue : public QObject +class SINKCOMMON_EXPORT MessageQueue : public QObject { Q_OBJECT public: diff --git a/common/propertymapper.h b/common/propertymapper.h index 94c9224..940fcee 100644 --- a/common/propertymapper.h +++ b/common/propertymapper.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include @@ -28,17 +29,17 @@ * Defines how to convert qt primitives to flatbuffer ones */ template -flatbuffers::uoffset_t variantToProperty(const QVariant &, flatbuffers::FlatBufferBuilder &fbb); +flatbuffers::uoffset_t SINKCOMMON_EXPORT variantToProperty(const QVariant &, flatbuffers::FlatBufferBuilder &fbb); /** * Defines how to convert flatbuffer primitives to qt ones */ template -QVariant propertyToVariant(const flatbuffers::String *); +QVariant SINKCOMMON_EXPORT propertyToVariant(const flatbuffers::String *); template -QVariant propertyToVariant(uint8_t); +QVariant SINKCOMMON_EXPORT propertyToVariant(uint8_t); template -QVariant propertyToVariant(const flatbuffers::Vector *); +QVariant SINKCOMMON_EXPORT propertyToVariant(const flatbuffers::Vector *); /** diff --git a/common/resource.h b/common/resource.h index 30d6c46..d2dba0e 100644 --- a/common/resource.h +++ b/common/resource.h @@ -67,7 +67,7 @@ private: /** * Factory interface for resource to implement. */ -class ResourceFactory : public QObject +class SINKCOMMON_EXPORT ResourceFactory : public QObject { public: static ResourceFactory *load(const QString &resourceName); diff --git a/common/resourceaccess.h b/common/resourceaccess.h index 73b676b..8db0389 100644 --- a/common/resourceaccess.h +++ b/common/resourceaccess.h @@ -20,6 +20,7 @@ #pragma once +#include #include #include #include @@ -34,7 +35,7 @@ namespace Sink struct QueuedCommand; -class ResourceAccessInterface : public QObject +class SINKCOMMON_EXPORT ResourceAccessInterface : public QObject { Q_OBJECT public: @@ -62,7 +63,7 @@ public Q_SLOTS: virtual void close() = 0; }; -class ResourceAccess : public ResourceAccessInterface +class SINKCOMMON_EXPORT ResourceAccess : public ResourceAccessInterface { Q_OBJECT public: diff --git a/common/resourceconfig.h b/common/resourceconfig.h index cc9cb94..5a27971 100644 --- a/common/resourceconfig.h +++ b/common/resourceconfig.h @@ -19,12 +19,13 @@ #pragma once +#include #include #include #include #include -class ResourceConfig +class SINKCOMMON_EXPORT ResourceConfig { public: static QMap getResources(); diff --git a/common/threadboundary.h b/common/threadboundary.h index 0d8ed3b..d1a1a3c 100644 --- a/common/threadboundary.h +++ b/common/threadboundary.h @@ -20,6 +20,8 @@ #pragma once +#include + #include #include @@ -29,7 +31,7 @@ namespace async { * A helper class to invoke a method in a different thread using the event loop. * The ThreadBoundary object must live in the thread where the function should be called. */ -class ThreadBoundary : public QObject { +class SINKCOMMON_EXPORT ThreadBoundary : public QObject { Q_OBJECT public: ThreadBoundary(); -- cgit v1.2.3