Commit c2ca5478 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Use GCC visibility support, export only neccessary symbols with BUILD_SHARED_LIBS.

This will allow building with shared libraries for KDE without the
-D__KDE_HAVE_GCC_VISIBILITY=OFF hack.
parent 30858289
......@@ -59,10 +59,6 @@ include (KDE4Defaults)
set(WITH_BINDIR ${BIN_INSTALL_DIR})
set(WITH_LIBDIR ${LIB_INSTALL_DIR})
if (BUILD_SHARED_LIBS AND __KDE_HAVE_GCC_VISIBILITY)
message(WARNING "Use -D__KDE_HAVE_GCC_VISIBILITY=OFF to build KDE shared libraries")
endif (BUILD_SHARED_LIBS AND __KDE_HAVE_GCC_VISIBILITY)
else (WITH_KDE)
find_package(Threads)
......@@ -165,6 +161,10 @@ if (WIN32)
link_directories($ENV{LIB})
endif (WIN32)
if (BUILD_SHARED_LIBS)
add_definitions(-DKID3_SHARED)
endif (BUILD_SHARED_LIBS)
### Check for taglib
set(TAGLIB_LIBRARIES)
set(TAGLIB_CFLAGS)
......@@ -414,10 +414,19 @@ if (WITH_PHONON)
endif (WITH_PHONON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -D_REENTRANT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -D_REENTRANT")
add_definitions(${QT_DEFINITIONS} ${TAGLIB_CFLAGS} ${ID3LIB_DEFINITIONS} ${FLAC_DEFINITIONS} -DHAVE_CONFIG_H=1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -D_REENTRANT")
add_definitions(${QT_DEFINITIONS} ${TAGLIB_CFLAGS} ${ID3LIB_DEFINITIONS} ${FLAC_DEFINITIONS} -DHAVE_CONFIG_H=1 -DQT_NO_EXCEPTIONS -DQT_NO_STL)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${QT_INCLUDES} ${PHONON_INCLUDE_DIR} ${MP4V2_INCLUDE_DIR} ${ID3LIB_INCLUDE_DIR} ${CHROMAPRINT_INCLUDES} ${VORBIS_INCLUDE_DIR} ${FLACPP_INCLUDE_DIR})
if (NOT WIN32)
include (CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fvisibility=hidden _HAVE_GCC_VISIBILITY)
if (_HAVE_GCC_VISIBILITY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
endif (_HAVE_GCC_VISIBILITY)
endif (NOT WIN32)
if (UNIX AND NOT APPLE)
set(KID3_EXECUTABLE kid3-qt)
else (UNIX AND NOT APPLE)
......
......@@ -4,10 +4,11 @@ if (WITH_GCC_PCH)
else (WITH_KDE)
set(_includeRegex "#include <[Qcp]")
endif (WITH_KDE)
set(_additionalFlags "-fno-exceptions -D_REENTRANT -DQT_NO_EXCEPTIONS -DQT_NO_STL -fvisibility=hidden -fvisibility-inlines-hidden")
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(_additionalFlags "-g -DQT_DEBUG -D_REENTRANT")
set(_additionalFlags "${_additionalFlags} -g -DQT_DEBUG")
else (CMAKE_BUILD_TYPE MATCHES Debug)
set(_additionalFlags "-O3 -DQT_NO_DEBUG -D_REENTRANT -DNDEBUG")
set(_additionalFlags "${_additionalFlags} -O3 -DQT_NO_DEBUG -DNDEBUG")
endif (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Winvalid-pch -include ${CMAKE_BINARY_DIR}/allsys.h")
......
......@@ -8,6 +8,7 @@ foreach (_subdir utils config tags formats export import model)
set(core_MOC_HDRS ${core_MOC_HDRS} ${${_subdir}_MOC_HDRS})
endforeach()
add_definitions(-DKID3_BUILD_CORE_LIB)
if (WIN32 AND HAVE_CHROMAPRINT)
add_definitions(-DCHROMAPRINT_NODLL)
endif (WIN32 AND HAVE_CHROMAPRINT)
......
......@@ -43,7 +43,7 @@ class ShortcutsModel;
/**
* Configuration storage.
*/
class ConfigStore {
class KID3_CORE_EXPORT ConfigStore {
public:
/**
* Constructor.
......
......@@ -30,11 +30,12 @@
#include <QStringList>
#include "config.h"
#include "generalconfig.h"
#include "kid3api.h"
/**
* Filter configuration.
*/
class FilterConfig : public GeneralConfig {
class KID3_CORE_EXPORT FilterConfig : public GeneralConfig {
public:
/**
* Constructor.
......
......@@ -30,6 +30,7 @@
#include "config.h"
#include "generalconfig.h"
#include <QMap>
#include "kid3api.h"
class QString;
class FrameCollection;
......@@ -37,7 +38,7 @@ class FrameCollection;
/**
* Format configuration.
*/
class FormatConfig : public GeneralConfig
class KID3_CORE_EXPORT FormatConfig : public GeneralConfig
{
public:
/** Case conversion options. */
......
......@@ -32,13 +32,14 @@
#include "config.h"
#include "generalconfig.h"
#include "trackdata.h"
#include "kid3api.h"
class QString;
/**
* Miscellaneous Configuration.
*/
class MiscConfig : public GeneralConfig
class KID3_CORE_EXPORT MiscConfig : public GeneralConfig
{
public:
/** The ID3v2 version used for new tags. */
......
......@@ -30,11 +30,12 @@
#include <QString>
#include "config.h"
#include "generalconfig.h"
#include "kid3api.h"
/**
* Playlist configuration.
*/
class PlaylistConfig : public GeneralConfig {
class KID3_CORE_EXPORT PlaylistConfig : public GeneralConfig {
public:
/**
* Playlist format.
......
......@@ -29,11 +29,12 @@
#include "generalconfig.h"
#include <QString>
#include "kid3api.h"
/**
* Freedb configuration.
*/
class ServerImporterConfig : public GeneralConfig {
class KID3_CORE_EXPORT ServerImporterConfig : public GeneralConfig {
public:
/**
* Constructor.
......
......@@ -30,6 +30,7 @@
#include <QAbstractItemModel>
#include <QList>
#include "config.h"
#include "kid3api.h"
class QAction;
class QSettings;
......@@ -43,7 +44,7 @@ class QSettings;
* action can be found. The model can be used in a QTreeView, to edit the
* @ref ShortcutColumn, a ShortcutsDelegate can be used.
*/
class ShortcutsModel : public QAbstractItemModel {
class KID3_CORE_EXPORT ShortcutsModel : public QAbstractItemModel {
Q_OBJECT
#ifndef CONFIG_USE_KDE
public:
......
......@@ -29,11 +29,12 @@
#include <QObject>
#include "trackdata.h"
#include "kid3api.h"
/**
* Export text from tags.
*/
class TextExporter : public QObject {
class KID3_CORE_EXPORT TextExporter : public QObject {
public:
/**
* Constructor.
......
......@@ -28,13 +28,14 @@
#define IMPORTCLIENT_H
#include "httpclient.h"
#include "kid3api.h"
class ServerImporterConfig;
/**
* Client to connect to server with import data.
*/
class ImportClient : public HttpClient
class KID3_CORE_EXPORT ImportClient : public HttpClient
{
Q_OBJECT
......
......@@ -31,13 +31,14 @@
#include <QRegExp>
#include <QMap>
#include <QList>
#include "kid3api.h"
class FrameCollection;
/**
* Import parser.
*/
class ImportParser {
class KID3_CORE_EXPORT ImportParser {
public:
/**
* Constructor.
......
......@@ -45,7 +45,7 @@ class FingerprintCalculator;
/**
* MusicBrainz client.
*/
class MusicBrainzClient : public QObject
class KID3_CORE_EXPORT MusicBrainzClient : public QObject
{
Q_OBJECT
......
......@@ -28,6 +28,7 @@
#define TEXTIMPORTER_H
#include <QString>
#include "kid3api.h"
class ImportTrackDataVector;
class ImportParser;
......@@ -37,7 +38,7 @@ class FrameCollection;
/**
* Import tags from text.
*/
class TextImporter {
class KID3_CORE_EXPORT TextImporter {
public:
/**
* Constructor.
......
......@@ -27,6 +27,8 @@
#ifndef TRACKDATAMATCHER_H
#define TRACKDATAMATCHER_H
#include "kid3api.h"
class TrackDataModel;
/**
......@@ -41,7 +43,7 @@ namespace TrackDataMatcher {
* @param diffCheckEnable true if time difference check is enabled
* @param maxDiff maximum allowed time difference
*/
bool matchWithLength(TrackDataModel* trackDataModel,
bool KID3_CORE_EXPORT matchWithLength(TrackDataModel* trackDataModel,
bool diffCheckEnable, int maxDiff);
/**
......@@ -49,14 +51,14 @@ bool matchWithLength(TrackDataModel* trackDataModel,
*
* @param trackDataModel tracks to match
*/
bool matchWithTrack(TrackDataModel* trackDataModel);
bool KID3_CORE_EXPORT matchWithTrack(TrackDataModel* trackDataModel);
/**
* Match import data with title.
*
* @param trackDataModel tracks to match
*/
bool matchWithTitle(TrackDataModel* trackDataModel);
bool KID3_CORE_EXPORT matchWithTitle(TrackDataModel* trackDataModel);
}
......
......@@ -33,6 +33,7 @@
#ifdef HAVE_PHONON
#include <QStringList>
#include "kid3api.h"
namespace Phonon {
class AudioOutput;
......@@ -42,7 +43,7 @@ namespace Phonon {
/**
* Audio player toolbar.
*/
class AudioPlayer : public QObject {
class KID3_CORE_EXPORT AudioPlayer : public QObject {
Q_OBJECT
public:
......
......@@ -32,7 +32,7 @@
/**
* Replaces context command format codes in a string.
*/
class CommandFormatReplacer : public FrameFormatReplacer {
class KID3_CORE_EXPORT CommandFormatReplacer : public FrameFormatReplacer {
public:
/**
* Constructor.
......
......@@ -31,11 +31,12 @@
#include <QHeaderView>
#include <QList>
#include "miscconfig.h"
#include "kid3api.h"
/**
* Context menu commands configuration table model.
*/
class CommandsTableModel : public QAbstractTableModel {
class KID3_CORE_EXPORT CommandsTableModel : public QAbstractTableModel {
public:
/**
* Constructor.
......
......@@ -32,11 +32,12 @@
#include <QStringList>
#include <QPair>
#include <QMap>
#include "kid3api.h"
/**
* Context menu commands configuration table model.
*/
class ConfigTableModel : public QAbstractTableModel {
class KID3_CORE_EXPORT ConfigTableModel : public QAbstractTableModel {
public:
/**
* Constructor.
......
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