diff --git a/android/cpp/JNI.cpp b/android/cpp/jni.cpp similarity index 99% rename from android/cpp/JNI.cpp rename to android/cpp/jni.cpp index 708063f24..45b8f7fd2 100644 --- a/android/cpp/JNI.cpp +++ b/android/cpp/jni.cpp @@ -11,9 +11,10 @@ #include -#include "log.h" - -#include "NativeMapView.hpp" +#include +#include +#include +#include #pragma clang diagnostic ignored "-Wunused-parameter" diff --git a/android/cpp/NativeMapView.cpp b/android/cpp/native_map_view.cpp similarity index 99% rename from android/cpp/NativeMapView.cpp rename to android/cpp/native_map_view.cpp index 5644b284d..ab06275f0 100644 --- a/android/cpp/NativeMapView.cpp +++ b/android/cpp/native_map_view.cpp @@ -5,12 +5,13 @@ #include +#include +#include + +#include #include #include - -#include "log.h" - -#include "NativeMapView.hpp" +#include namespace mbgl { namespace android { diff --git a/android/mapboxgl-app.gyp b/android/mapboxgl-app.gyp index ac8937fb3..118669542 100644 --- a/android/mapboxgl-app.gyp +++ b/android/mapboxgl-app.gyp @@ -8,8 +8,8 @@ 'product_name': 'mapbox-gl', 'type': 'shared_library', 'sources': [ - './cpp/NativeMapView.cpp', - './cpp/JNI.cpp', + './cpp/native_map_view.cpp', + './cpp/jni.cpp', ], 'cflags_cc': [ '-I<(boost_root)/include', diff --git a/include/mbgl/android/jni.hpp b/include/mbgl/android/jni.hpp new file mode 100644 index 000000000..c1af07c64 --- /dev/null +++ b/include/mbgl/android/jni.hpp @@ -0,0 +1,37 @@ +#ifndef MBGL_ANDROID_JNI +#define MBGL_ANDROID_JNI + +#include +#include + +namespace mbgl { +namespace android { + +extern std::string cache_path; +extern std::string data_path; + +extern jmethodID on_map_changed_id; + +extern jclass lon_lat_class; +extern jmethodID lon_lat_constructor_id; +extern jfieldID lon_lat_lon_id; +extern jfieldID lon_lat_lat_id; + +extern jclass lon_lat_zoom_class; +extern jmethodID lon_lat_zoom_constructor_id; +extern jfieldID lon_lat_zoom_lon_id; +extern jfieldID lon_lat_zoom_lat_id; +extern jfieldID lon_lat_zoom_zoom_id; + +extern jclass runtime_exception_class; + +extern jmethodID list_to_array_id; + +extern jclass array_list_class; +extern jmethodID array_list_constructor_id; +extern jmethodID array_list_add_id; + +} +} + +#endif diff --git a/android/cpp/log.h b/include/mbgl/android/log.hpp similarity index 94% rename from android/cpp/log.h rename to include/mbgl/android/log.hpp index 3cf203853..50b6bec1e 100644 --- a/android/cpp/log.h +++ b/include/mbgl/android/log.hpp @@ -1,5 +1,5 @@ -#ifndef LOG_H -#define LOG_H +#ifndef MBGL_ANDROID_LOG +#define MBGL_ANDROID_LOG #include @@ -22,4 +22,4 @@ #define LOG_WARN(fmt, args...) __android_log_print(ANDROID_LOG_WARN, __FILE__ ":" S__LINE__, fmt, ##args) #define LOG_ERROR(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, __FILE__ ":" S__LINE__, fmt, ##args) -#endif // LOG_H +#endif diff --git a/android/cpp/NativeMapView.hpp b/include/mbgl/android/native_map_view.hpp similarity index 68% rename from android/cpp/NativeMapView.hpp rename to include/mbgl/android/native_map_view.hpp index 75aba6985..04949abe1 100644 --- a/android/cpp/NativeMapView.hpp +++ b/include/mbgl/android/native_map_view.hpp @@ -1,43 +1,15 @@ -#ifndef MAP_VIEW_HPP -#define MAP_VIEW_HPP +#ifndef MBGL_ANDROID_NATIVE_MAP_VIEW +#define MBGL_ANDROID_NATIVE_MAP_VIEW +#include #include - #include - #include - #include -#include - namespace mbgl { namespace android { -extern std::string cache_path; -extern std::string data_path; - -extern jmethodID on_map_changed_id; - -extern jclass lon_lat_class; -extern jmethodID lon_lat_constructor_id; -extern jfieldID lon_lat_lon_id; -extern jfieldID lon_lat_lat_id; - -extern jclass lon_lat_zoom_class; -extern jmethodID lon_lat_zoom_constructor_id; -extern jfieldID lon_lat_zoom_lon_id; -extern jfieldID lon_lat_zoom_lat_id; -extern jfieldID lon_lat_zoom_zoom_id; - -extern jclass runtime_exception_class; - -extern jmethodID list_to_array_id; - -extern jclass array_list_class; -extern jmethodID array_list_constructor_id; -extern jmethodID array_list_add_id; - class MBGLView; class NativeMapView { @@ -116,7 +88,7 @@ private: NativeMapView* nativeView = nullptr; }; -} // namespace android -} // namespace mbgl +} +} -#endif // MAP_VIEW_HPP +#endif diff --git a/platform/android/cache_database_data.cpp b/platform/android/cache_database_data.cpp index 61c4efc15..5f13a44f6 100644 --- a/platform/android/cache_database_data.cpp +++ b/platform/android/cache_database_data.cpp @@ -1,5 +1,5 @@ #include -#include "../../android/cpp/NativeMapView.hpp" +#include namespace mbgl { namespace platform { diff --git a/platform/default/http_request_baton_curl.cpp b/platform/default/http_request_baton_curl.cpp index 5238283fd..a88b949e0 100644 --- a/platform/default/http_request_baton_curl.cpp +++ b/platform/default/http_request_baton_curl.cpp @@ -1,8 +1,10 @@ +#include #include #include #include + #ifdef __ANDROID__ - #include "../../android/cpp/NativeMapView.hpp" + #include #endif #include