[build] Mark explicitly visible symbols

Easier to maintain than a linker script. We build
everything with visibility hidden by default.
This commit is contained in:
Thiago Marcos P. Santos
2019-07-23 17:45:54 +03:00
parent 79670593de
commit a849b38390
6 changed files with 33 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,7 @@
#pragma once
#include <mbgl/util/util.hpp>
#include <string>
#include <jni/jni.hpp>

View File

@@ -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

View File

@@ -1,5 +1,6 @@
#include "runtime.hpp"
#include "../jni.hpp"
#include "../jni_native.hpp"
#include <cassert>
#include <dlfcn.h>

View File

@@ -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