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-17 12:28:55 +0300 |
commit | a849b38390c66f968678630eb44eb6061d82b333 (patch) | |
tree | b41926d00e546ab5bbf36c7608bae3716b5154ec | |
parent | 79670593de7ce2a7bfcf86d373dd145f5c52cb55 (diff) | |
download | qtlocation-mapboxgl-a849b38390c66f968678630eb44eb6061d82b333.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..f68c847a74 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_EXPORT int runBenchmark(int argc, char* argv[]); } // namespace mbgl diff --git a/include/mbgl/util/util.hpp b/include/mbgl/util/util.hpp index 7960b40299..178f1cba48 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_EXPORT __attribute__((dllexport)) + #else + #define MBGL_EXPORT __declspec(dllexport) + #endif + #else + #ifdef __GNUC__ + #define MBGL_EXPORT __attribute__((dllimport)) + #else + #define MBGL_EXPORT __declspec(dllimport) + #endif + #endif +#else + #define MBGL_EXPORT __attribute__((visibility ("default"))) // NOLINT +#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..1cc9a7e81b 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_EXPORT 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..db47ebb8d8 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_EXPORT int runTests(int argc, char* argv[]); } // namespace mbgl |