Only export symbols from the libraries that should be exported

Summary:
Using generate_export_header instead manually written export headers
should improve coverage across platforms.

Size of stripped libmarblewidget-qt5 reduced on Linux
e.g. from 11077592 to 7889848

Reviewers: rahn, #marble, nienhueser

Reviewed By: #marble, nienhueser

Differential Revision: https://phabricator.kde.org/D2309

# Conflicts:
#	src/lib/marble/AbstractFloatItem.h
#	src/lib/marble/marble_export.h
parent 8b99f625
......@@ -27,6 +27,13 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
# Default to hidden visibility for symbols
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
####################################################
# Where to look first for cmake modules,
......
......@@ -17,6 +17,12 @@
using namespace Marble;
#ifdef Q_OS_ANDROID
// Declare symbol of main method as exported as needed by Qt-on-Android,
// where the Dalvik-native QtActivity class needs to find and invoke it
// on loading the "app" module
extern "C" Q_DECL_EXPORT
#endif
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
......
......@@ -19,6 +19,12 @@
using namespace Marble;
#ifdef Q_OS_ANDROID
// Declare symbol of main method as exported as needed by Qt-on-Android,
// where the Dalvik-native QtActivity class needs to find and invoke it
// on loading the "app" module
extern "C" Q_DECL_EXPORT
#endif
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
......
......@@ -39,9 +39,6 @@ if(WIN32)
endif(WIN32)
SET_TARGET_PROPERTIES(astro PROPERTIES
DEFINE_SYMBOL astro_EXPORTS # needed for astrolib_export.h
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
SET_TARGET_PROPERTIES(astro PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
......
......@@ -361,6 +361,9 @@ qt_wrap_ui(marblewidget_SRCS ${marblewidget_UI})
ADD_LIBRARY(${MARBLEWIDGET} SHARED ${marblewidget_SRCS} ${SOURCES_UI_HDRS})
generate_export_header(${MARBLEWIDGET} BASE_NAME marble)
# TODO: use PUBLIC/PRIVATE everywhere instead of LINK_PUBLIC/LINK_PRIVATE
# once SailfishOS has cmake >= 2.8.12
......@@ -427,11 +430,6 @@ endif()
set_target_properties(${MARBLEWIDGET} PROPERTIES
COMPILE_FLAGS "-DKML_LAZY_IMP")
# needed for marble_export.h
set_target_properties(${MARBLEWIDGET} PROPERTIES
DEFINE_SYMBOL MAKE_MARBLE_LIB
)
# choose the correct target install library path
if(WIN32)
install(TARGETS ${MARBLEWIDGET} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} ARCHIVE DESTINATION lib)
......@@ -457,6 +455,7 @@ else()
endif()
install( FILES
${CMAKE_CURRENT_BINARY_DIR}/marble_export.h
${graphicsview_HDRS}
${marble_WebKit}
AutoNavigation.h
......@@ -578,7 +577,6 @@ install( FILES
LayerInterface.h
RenderState.h
PluginAboutDialog.h
marble_export.h
Planet.h
PlanetFactory.h
EditPlacemarkDialog.h
......
......@@ -11,6 +11,8 @@
#ifndef MARBLE_DBUSINTERFACE_H
#define MARBLE_DBUSINTERFACE_H
#include "marble_export.h"
namespace Marble
{
class MarbleWidget;
......@@ -23,7 +25,7 @@ namespace Marble
namespace Marble {
class MarbleDBusInterface : public QDBusAbstractAdaptor
class MARBLE_EXPORT MarbleDBusInterface : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.marble")
......
......@@ -34,7 +34,10 @@ public:
*/
Planet();
MARBLE_DEPRECATED( explicit Planet( const QString& id ) ); // please use PlanetFactory::construct(id) instead
/**
* @deprecated Please use PlanetFactory::construct(id) instead.
*/
MARBLE_DEPRECATED explicit Planet(const QString& id);
///Copy Constructor
Planet( const Planet& other );
......@@ -97,8 +100,14 @@ public:
Planet& operator=( const Planet& rhs );
MARBLE_DEPRECATED( static QString name( const QString& id ) ); // please use PlanetFactory::localizedName(id) instead
MARBLE_DEPRECATED( static QStringList planetList() ); // please use PlanetFactory::planetList() instead
/**
* @deprecated Please use PlanetFactory::localizedName(id) instead.
*/
MARBLE_DEPRECATED static QString name(const QString& id);
/**
* @deprecated Please use PlanetFactory::planetList() instead.
*/
MARBLE_DEPRECATED static QStringList planetList();
bool hasAtmosphere() const;
void setHasAtmosphere( bool enabled );
......
......@@ -21,6 +21,7 @@
#include "marble_export.h"
#include <cmath>
#include <QtGlobal>
namespace Marble
{
......
......@@ -14,13 +14,15 @@
#include <GeoDataStyle.h>
#include <GeoDataFeature.h>
#include "marble_export.h"
class QFont;
class QColor;
namespace Marble {
class OsmPlacemarkData;
class StyleParameters
class MARBLE_EXPORT StyleParameters
{
public:
explicit StyleParameters(const GeoDataFeature* feature=nullptr, int tileLevel=0);
......@@ -29,7 +31,7 @@ public:
int tileLevel;
};
class StyleBuilder
class MARBLE_EXPORT StyleBuilder
{
public:
StyleBuilder();
......
......@@ -32,10 +32,8 @@ add_library( marbledeclarative SHARED
Settings.cpp
)
# needed for marble_declarative_export.h
set_target_properties(marbledeclarative PROPERTIES
DEFINE_SYMBOL MAKE_MARBLE_DECLARATIVE_LIB
)
generate_export_header(marbledeclarative BASE_NAME marble_declarative)
target_include_directories(marbledeclarative PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
marble_add_project_resources(qmldir)
......
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Christian Ehrlicher <ch.ehrlicher@gmx.de>
//
#ifndef MARBLE_DECLARATIVE_EXPORT_H
#define MARBLE_DECLARATIVE_EXPORT_H
#include <QtGlobal>
#ifndef MARBLE_DECLARATIVE_EXPORT
# ifdef MAKE_MARBLE_DECLARATIVE_LIB
# define MARBLE_DECLARATIVE_EXPORT Q_DECL_EXPORT
# else
# define MARBLE_DECLARATIVE_EXPORT Q_DECL_IMPORT
# endif
#endif
#endif // MARBLE_DECLARATIVE_EXPORT_H
......@@ -107,7 +107,7 @@ class GEODATA_EXPORT GeoDataContainer : public GeoDataFeature
*/
void insert( int index, GeoDataFeature *feature );
GEODATA_DEPRECATED( void insert( GeoDataFeature *other, int index ) );
GEODATA_DEPRECATED void insert(GeoDataFeature *other, int index);
/**
* @brief add an element
......
......@@ -12,24 +12,10 @@
#ifndef GEODATA_EXPORT_H
#define GEODATA_EXPORT_H
#include <QtGlobal>
#include "marble_export.h"
// please make sure to change MAKE_MARBLE_LIB to MAKE_GEODATA_LIB if geodata is an independent library
#ifndef GEODATA_EXPORT
# ifdef MAKE_MARBLE_LIB
# define GEODATA_EXPORT Q_DECL_EXPORT
# else
# define GEODATA_EXPORT Q_DECL_IMPORT
# endif
#endif
#ifdef __GNUC__
#define GEODATA_DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define GEODATA_DEPRECATED(func) __declspec(deprecated) func
#else
#pragma message("WARNING: You need to implement GEODATA_DEPRECATED for this compiler in geodata_export.h")
#define GEODATA_DEPRECATED(func) func
#endif
// please make sure to create a real export-header if geodata becomes an independent library
#define GEODATA_EXPORT MARBLE_EXPORT
#define GEODATA_DEPRECATED MARBLE_DEPRECATED
#endif // GEODATA_EXPORT_H
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Christian Ehrlicher <ch.ehrlicher@gmx.de>
//
#ifndef MARBLE_EXPORT_H
#define MARBLE_EXPORT_H
#include <QtGlobal>
#ifndef MARBLE_EXPORT
# ifdef MAKE_MARBLE_LIB
# define MARBLE_EXPORT Q_DECL_EXPORT
# else
# define MARBLE_EXPORT Q_DECL_IMPORT
# endif
#endif
#ifdef __GNUC__
#define MARBLE_DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define MARBLE_DEPRECATED(func) __declspec(deprecated) func
#else
#pragma message("WARNING: You need to implement MARBLE_DEPRECATED for this compiler in marble_export.h")
#define MARBLE_DEPRECATED(func) func
#endif
#endif // MARBLE_EXPORT_H
......@@ -13,6 +13,8 @@
#include "marble_export.h"
#include <QtGlobal>
class QTextStream;
namespace Marble
......
......@@ -16,5 +16,3 @@ set(GeoCute_SRCS
)
add_library(GeoCute SHARED ${GeoCute_SRCS})
set_target_properties(GeoCute PROPERTIES DEFINE_SYMBOL MAKE_GEOCUTE_LIB)
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC constellations2kml.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC dateline.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -7,6 +7,5 @@ include_directories(
)
set( ${TARGET}_SRC kml2cache.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC kml2kml.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -20,7 +20,6 @@ NearestNeighborInterpolation.cpp
NasaWorldWindToOpenStreetMapConverter.cpp
main.cpp
)
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -8,7 +8,6 @@ include_directories(
set( ${TARGET}_SRC main.cpp )
QT_ADD_RESOURCES( RESOURCES canvas.qrc )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} ${RESOURCES} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -25,7 +25,6 @@ PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS
pbf/fileformat.proto
pbf/osmformat.proto
)
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} ${PROTO_SRCS} ${PROTO_HDRS} )
target_link_libraries( ${TARGET} ${PROTOBUF_LIBRARIES} ${ZLIB_LIBRARIES} )
......
......@@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 2.8.12)
SET (TARGET osm-simplify)
PROJECT (${TARGET})
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
......@@ -29,7 +33,6 @@ BaseFilter.cpp
NodeReducer.cpp
)
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} Qt5::Core marblewidget-qt5)
......@@ -16,7 +16,6 @@ upload.cpp
region.cpp
main.cpp
)
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} Qt5::Sql marblewidget-qt5 )
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC main.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -13,7 +13,6 @@ set( routing-instructions_SRC
main.cpp
)
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( routing-instructions ${routing-instructions_SRC} )
target_link_libraries( routing-instructions Qt5::Core )
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC shp2pn2.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......@@ -7,7 +7,7 @@ include_directories(
)
set( ${TARGET}_SRC main.cpp tccore.cpp )
add_definitions( -DMAKE_MARBLE_LIB -DTILECREATOR )
add_definitions(-DTILECREATOR)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
......
......@@ -7,7 +7,6 @@ include_directories(
)
set( ${TARGET}_SRC main.cpp tccore.cpp )
add_definitions( -DMAKE_MARBLE_LIB )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} marblewidget-qt5 )
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