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-09-05 13:29:00 +0300 |
commit | 2786768ec5c76674a51bef092c62b13a2bcab0c3 (patch) | |
tree | 61b1e12ea259836583be88f586687d60301254bf | |
parent | 1b4222b0bd70566b1a0ac6ac9585a7b16681b38c (diff) | |
download | qtlocation-mapboxgl-2786768ec5c76674a51bef092c62b13a2bcab0c3.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 | 2 | ||||
-rw-r--r-- | platform/android/src/jni_native.hpp | 4 | ||||
-rw-r--r-- | platform/android/src/test/runtime.cpp | 1 | ||||
-rw-r--r-- | test/include/mbgl/test.hpp | 4 |
6 files changed, 33 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 cb519f911d..9bfe2ce5b7 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> #include <jni/jni.hpp> diff --git a/platform/android/src/jni_native.hpp b/platform/android/src/jni_native.hpp index a4c89d3036..c8e284a523 100644 --- a/platform/android/src/jni_native.hpp +++ b/platform/android/src/jni_native.hpp @@ -1,11 +1,13 @@ #pragma once +#include <mbgl/util/util.hpp> + #include "jni.hpp" namespace mbgl { namespace android { -void registerNatives(JavaVM* vm); +MBGL_PUBLIC void registerNatives(JavaVM* vm); } // namespace android } // namespace mbgl diff --git a/platform/android/src/test/runtime.cpp b/platform/android/src/test/runtime.cpp index 9cf79c501c..1f8f16da3c 100644 --- a/platform/android/src/test/runtime.cpp +++ b/platform/android/src/test/runtime.cpp @@ -1,5 +1,6 @@ #include "runtime.hpp" #include "../jni.hpp" +#include "../jni_native.hpp" #include <cassert> #include <dlfcn.h> 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 |