diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-30 18:24:51 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-30 18:24:51 +0100 |
commit | 95f7e4c5b9608c550d008c662dc41fa049a6b725 (patch) | |
tree | ff52e80085cf49afb5e68225c1d9af51e0c5e92b | |
parent | 181875f3385391aed537c7e5fcff8fda199d39e6 (diff) |
clean up the visibility mess in a messiest way possible
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | facetracknoir/global-settings.cpp | 12 | ||||
-rw-r--r-- | facetracknoir/global-settings.h | 15 | ||||
-rw-r--r-- | opentrack-api/context.cpp | 15 | ||||
-rw-r--r-- | opentrack-api/opentrack-guts.h | 24 | ||||
-rw-r--r-- | opentrack-api/opentrack.h | 7 |
6 files changed, 65 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 239cafb5..1aafaa16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,8 +154,8 @@ else() endif() # main app -file(GLOB opentrack-lib-c "opentrack-api/*.cpp") -file(GLOB opentrack-lib-h "opentrack-api/*.h") +file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp") +file(GLOB opentrack-lib-h "opentrack-api/*.h" "facetracknoir/global-settings.h") file(GLOB opentrack-bin-c "facetracknoir/*.cpp" "facetracknoir/*.rc") file(GLOB opentrack-bin-h "facetracknoir/*.h") @@ -614,9 +614,12 @@ configure_file("${CMAKE_SOURCE_DIR}/opentrack-version.h" "${CMAKE_BINARY_DIR}/op add_library(opentrack-api SHARED ${opentrack-lib-c} ${opentrack-lib-h} ${opentrack-lib-moc}) target_link_libraries(opentrack-api ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-api - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/opentrack-api/gnuc-version-script.txt") +if(CMAKE_COMPILER_IS_GNUCXX) + SET_TARGET_PROPERTIES(opentrack-api PROPERTIES + LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/opentrack-api/gnuc-version-script.txt" + COMPILE_FLAGS "-fvisibility=protected -fvisibility-inlines-hidden" + COMPILE_DEFINITIONS IN_OPENTRACK_API + ) endif() set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index b198f327..42646742 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -4,6 +4,12 @@ # include <dlfcn.h> #endif +#ifdef IN_OPENTRACK_API +# ifdef __GNUC__ +# pragma GCC visibility push(protected) +# endif +#endif + SelectedLibraries* Libraries = NULL; SelectedLibraries::~SelectedLibraries() @@ -128,3 +134,9 @@ DynamicLibrary::~DynamicLibrary() (void) dlclose(handle); #endif } + +#ifdef IN_OPENTRACK_API +# ifdef __GNUC__ +# pragma GCC visibility pop +# endif +#endif diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h index b2a54e20..ea36abac 100644 --- a/facetracknoir/global-settings.h +++ b/facetracknoir/global-settings.h @@ -12,6 +12,14 @@ # define MAYBE_STDCALL_UNDERSCORE "" #endif +#include <cstdio> + +#ifdef IN_OPENTRACK_API +# ifdef __GNUC__ +# pragma GCC visibility push(protected) +# endif +#endif + #include <QWidget> #include <QDebug> #include <QString> @@ -83,3 +91,10 @@ public: virtual DynamicLibrary* current_filter() = 0; virtual QFrame* get_video_widget() = 0; }; + + +#ifdef IN_OPENTRACK_API +# ifdef __GNUC__ +# pragma GCC visibility pop +# endif +#endif diff --git a/opentrack-api/context.cpp b/opentrack-api/context.cpp index 100acf5c..1fdf6713 100644 --- a/opentrack-api/context.cpp +++ b/opentrack-api/context.cpp @@ -17,7 +17,10 @@ # define LIB_PREFIX "lib" #endif -// shamelessly copied from core +#ifdef __GNUC__ +# pragma GCC visibility push(protected) +#endif + static Metadata* get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon) { Metadata* meta; @@ -89,20 +92,24 @@ opentrack_ctx::~opentrack_ctx() extern "C" { -const char** OPENTRACK_EXPORT opentrack_enum_trackers(opentrack ctx) +const char** opentrack_enum_trackers(opentrack ctx) { return const_cast<const char**>(ctx->list); } -opentrack OPENTRACK_EXPORT opentrack_make_ctx(const char *dir) +opentrack opentrack_make_ctx(const char *dir) { QDir d(dir); return new opentrack_ctx(d); } -void OPENTRACK_EXPORT opentrack_finalize_ctx(opentrack foo) +void opentrack_finalize_ctx(opentrack foo) { delete foo; } } + +#ifdef __GNUC__ +# pragma GCC visibility pop +#endif diff --git a/opentrack-api/opentrack-guts.h b/opentrack-api/opentrack-guts.h index 3f8806cc..01463cfc 100644 --- a/opentrack-api/opentrack-guts.h +++ b/opentrack-api/opentrack-guts.h @@ -1,8 +1,9 @@ #pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/global-settings.h" -#include <QString> +#ifdef __GNUC__ +# pragma GCC visibility push(protected) +#endif + #include <QDir> #include <QList> #include <QStringList> @@ -10,16 +11,13 @@ #include <QIcon> #include <iostream> #include <cstring> - -#ifdef __GNUC__ -# define OPENTRACK_HIDDEN __attribute__((visibility ("hidden"))) -#else -# define OPENTRACK_HIDDEN -#endif +#include <QString> +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/global-settings.h" typedef ITracker* opentrack_tracker; -class OPENTRACK_HIDDEN opentrack_meta { +class opentrack_meta { public: Metadata* meta; QString path; @@ -35,7 +33,7 @@ public: } }; -typedef class OPENTRACK_HIDDEN opentrack_ctx { +typedef class opentrack_ctx { public: QDir dir; char** list; @@ -44,3 +42,7 @@ public: opentrack_ctx(QDir& dir); ~opentrack_ctx(); } *opentrack; + +#ifdef __GNUC__ +# pragma GCC visibility pop +#endif diff --git a/opentrack-api/opentrack.h b/opentrack-api/opentrack.h index 8d28b5b8..1c8fcee5 100644 --- a/opentrack-api/opentrack.h +++ b/opentrack-api/opentrack.h @@ -15,7 +15,11 @@ typedef opentrack_opaque_tracker* opentrack_tracker; # ifdef _WIN32 # define OPENTRACK_EXPORT __declspec(dllexport) # else -# define OPENTRACK_EXPORT +# ifdef __GNUC__ +# define OPENTRACK_EXPORT __attribute__((visibility ("default"))) +# else +# define OPENTRACK_EXPORT +# endif # endif #else # ifdef _WIN32 @@ -55,3 +59,4 @@ void opentrack_finalize_tracker(opentrack_tracker tracker); #ifdef __cplusplus } #endif + |