diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-07-23 17:45:54 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-08-15 20:41:07 +0300 |
commit | 01c1d1eb788598e8d84fde90cf057c8e22edf4b6 (patch) | |
tree | a3edd2d09e2aadd145849f848c497f757302fbeb | |
parent | b9a211869308e486c552abfa6c7bc1624fb40324 (diff) | |
download | qtlocation-mapboxgl-01c1d1eb788598e8d84fde90cf057c8e22edf4b6.tar.gz |
[build] Mark explicitly visible symbols
Easier to maintain than a linker script. We build
everything with visibility hidden by default.
-rw-r--r-- | benchmark/include/mbgl/benchmark.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/util/util.hpp | 21 | ||||
-rw-r--r-- | platform/android/src/jni.hpp | 4 | ||||
-rw-r--r-- | test/include/mbgl/test.hpp | 4 |
4 files changed, 30 insertions, 3 deletions
diff --git a/benchmark/include/mbgl/benchmark.hpp b/benchmark/include/mbgl/benchmark.hpp index 1a9904de51..f78bcb09c6 100644 --- a/benchmark/include/mbgl/benchmark.hpp +++ b/benchmark/include/mbgl/benchmark.hpp @@ -1,7 +1,9 @@ #pragma once +#include <mbgl/util/util.hpp> + namespace mbgl { -int runBenchmark(int argc, char* argv[]); +MBGL_PUBLIC int runBenchmark(int argc, char* argv[]); } // namespace mbgl diff --git a/include/mbgl/util/util.hpp b/include/mbgl/util/util.hpp index 7960b40299..6b6107b0e6 100644 --- a/include/mbgl/util/util.hpp +++ b/include/mbgl/util/util.hpp @@ -19,3 +19,24 @@ #else #define MBGL_CONSTEXPR inline #endif + +// Compiler defines for making symbols visible, otherwise they +// will be defined as hidden by default. + +#if defined WIN32 + #ifdef MBGL_BUILDING_LIB + #ifdef __GNUC__ + #define MBGL_PUBLIC __attribute__((dllexport)) + #else + #define MBGL_PUBLIC __declspec(dllexport) + #endif + #else + #ifdef __GNUC__ + #define MBGL_PUBLIC __attribute__((dllimport)) + #else + #define MBGL_PUBLIC __declspec(dllimport) + #endif + #endif +#else + #define MBGL_PUBLIC __attribute__((visibility ("default"))) +#endif diff --git a/platform/android/src/jni.hpp b/platform/android/src/jni.hpp index e5df92e701..d8b0417215 100644 --- a/platform/android/src/jni.hpp +++ b/platform/android/src/jni.hpp @@ -1,5 +1,7 @@ #pragma once +#include <mbgl/util/util.hpp> + #include <string> typedef struct _jmethodID* jmethodID; @@ -17,7 +19,7 @@ extern std::string dataPath; bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName); void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach); -extern void registerNatives(JavaVM* vm); +MBGL_PUBLIC extern void registerNatives(JavaVM* vm); } // namespace android } // namespace mbgl diff --git a/test/include/mbgl/test.hpp b/test/include/mbgl/test.hpp index ad5b868f30..4524b6bf23 100644 --- a/test/include/mbgl/test.hpp +++ b/test/include/mbgl/test.hpp @@ -1,7 +1,9 @@ #pragma once +#include <mbgl/util/util.hpp> + namespace mbgl { -int runTests(int argc, char* argv[]); +MBGL_PUBLIC int runTests(int argc, char* argv[]); } // namespace mbgl |