diff options
author | Dane Springmeyer <dane@mapbox.com> | 2014-11-01 22:41:40 -0400 |
---|---|---|
committer | Dane Springmeyer <dane@mapbox.com> | 2014-11-01 22:41:40 -0400 |
commit | d7b0a34bddd9914253bcc496f9d62106743a682a (patch) | |
tree | e1d24e86caa07324e6f245e69f32de91101b8177 | |
parent | 551ff954a5e30c89c27f59a9848ba0a9be871adc (diff) | |
download | qtlocation-mapboxgl-d7b0a34bddd9914253bcc496f9d62106743a682a.tar.gz |
mason-based android port
-rw-r--r-- | Makefile | 17 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | gyp/common.gypi | 1 | ||||
-rw-r--r-- | include/mbgl/geometry/vao.hpp | 21 | ||||
-rw-r--r-- | include/mbgl/platform/gl.hpp | 3 | ||||
-rw-r--r-- | src/renderer/painter_prerender.cpp | 2 | ||||
-rw-r--r-- | src/renderer/prerendered_texture.cpp | 10 | ||||
-rw-r--r-- | src/storage/response.cpp | 2 |
8 files changed, 50 insertions, 12 deletions
@@ -69,6 +69,21 @@ build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj: ios/mapbox-gl-cocoa/app/ma build/linux/mapboxgl-app.xcodeproj: linux/mapboxgl-app.gyp config.gypi deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi -Dplatform=linux --depth=. --generator-output=./build -f xcode +.PHONY: android +android: + export CXX=`MASON_PLATFORM=android ~/.mason/mason env CXX` && \ + export CC=`MASON_PLATFORM=android ~/.mason/mason env CC` && \ + export LD=`MASON_PLATFORM=android ~/.mason/mason env LD` && \ + export AR=`MASON_PLATFORM=android ~/.mason/mason env AR` && \ + export RANLIB=`MASON_PLATFORM=android ~/.mason/mason env RANLIB` && \ + export LDFLAGS=`MASON_PLATFORM=android ~/.mason/mason env LDFLAGS` && \ + export CFLAGS=`MASON_PLATFORM=android ~/.mason/mason env CFLAGS` && \ + export CPPFLAGS=`MASON_PLATFORM=android ~/.mason/mason env CPPFLAGS` && \ + export PATH=`MASON_PLATFORM=android ~/.mason/mason env PATH` && \ + MASON_PLATFORM=android ./configure config-android.gypi && \ + deps/run_gyp mapboxgl.gyp -Iconfig-android.gypi -Dplatform=android --depth=. --generator-output=./build/android -f make-android && \ + $(MAKE) -C ./build/android BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-core + ##### Test cases ############################################################### test: build/test/Makefile @@ -131,7 +146,7 @@ clean: clear_xcode_cache -find ./deps/gyp -name "*.pyc" -exec rm {} \; -rm -rf ./build/ -rm -rf ./macosx/build/ - -rm -rf ./config.gypi ./config-ios.gypi + -rm -rf ./config.gypi ./config-ios.gypi ./config-android.gypi distclean: clean -rm -rf ./mason_packages @@ -24,6 +24,12 @@ case ${MASON_PLATFORM} in ZLIB_VERSION=system BOOST_VERSION=system ;; + 'android') + SQLITE_VERSION=3.8.6 + LIBUV_VERSION=0.11.29 + ZLIB_VERSION=system + BOOST_VERSION=system + ;; *) GLFW_VERSION=a21f2377 SQLITE_VERSION=system diff --git a/gyp/common.gypi b/gyp/common.gypi index b21e8b50d7..97b474b4b8 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -23,6 +23,7 @@ 'cflags_cc': [ '-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin. '-Wno-literal-suffix', # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61653 + '-Wno-unknown-warning-option' ], }], ], diff --git a/include/mbgl/geometry/vao.hpp b/include/mbgl/geometry/vao.hpp index bb1f571fff..e6e199b69a 100644 --- a/include/mbgl/geometry/vao.hpp +++ b/include/mbgl/geometry/vao.hpp @@ -69,11 +69,20 @@ private: class VertexArrayObject : public util::noncopyable { public: - template <typename Shader, typename Buffers> - void bind(Shader& shader, Buffers& buffers, char *offset) { - for (auto &buffer : buffers) { - buffer.bind(); - } + inline VertexArrayObject() {}; + + inline VertexArrayObject(VertexArrayObject &&) noexcept {}; + + template <typename Shader, typename VertexBuffer> + inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) { + vertexBuffer.bind(); + shader.bind(offset); + } + + template <typename Shader, typename VertexBuffer, typename ElementsBuffer> + inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, char *offset) { + vertexBuffer.bind(); + elementsBuffer.bind(); shader.bind(offset); } }; @@ -82,4 +91,4 @@ public: } -#endif +#endif
\ No newline at end of file diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp index d5162f2c70..d07b0561d5 100644 --- a/include/mbgl/platform/gl.hpp +++ b/include/mbgl/platform/gl.hpp @@ -35,6 +35,9 @@ #else #error Unsupported Apple platform #endif +#elif __ANDROID__ + #include <GLES2/gl2.h> + #include <GLES2/gl2ext.h> #else #define GL_GLEXT_PROTOTYPES #include <GL/gl.h> diff --git a/src/renderer/painter_prerender.cpp b/src/renderer/painter_prerender.cpp index f38470530b..22a2be9b64 100644 --- a/src/renderer/painter_prerender.cpp +++ b/src/renderer/painter_prerender.cpp @@ -10,7 +10,7 @@ void Painter::preparePrerender(RasterBucket &bucket) { glDisable(GL_STENCIL_TEST); // Render the actual tile. -#if GL_EXT_discard_framebuffer +#if GL_EXT_discard_framebuffer && !__ANDROID__ const GLenum discards[] = {GL_COLOR_ATTACHMENT0}; glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards); #endif diff --git a/src/renderer/prerendered_texture.cpp b/src/renderer/prerendered_texture.cpp index adb7a59105..2514efaf2f 100644 --- a/src/renderer/prerendered_texture.cpp +++ b/src/renderer/prerendered_texture.cpp @@ -49,8 +49,12 @@ void PrerenderedTexture::bindFramebuffer() { // Create depth/stencil buffer glGenRenderbuffers(1, &fbo_depth_stencil); glBindRenderbuffer(GL_RENDERBUFFER, fbo_depth_stencil); +#ifdef GL_ES_VERSION_2_0 + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, properties.size, properties.size); +#else glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, properties.size, properties.size); - glBindRenderbuffer(GL_RENDERBUFFER, 0); +#endif + glBindRenderbuffer(GL_RENDERBUFFER, 0); } if (fbo == 0) { @@ -117,7 +121,7 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) { for (int i = 0; i < passes; i++) { // Render horizontal glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, secondary_texture, 0); -#if GL_EXT_discard_framebuffer +#if GL_EXT_discard_framebuffer && !__ANDROID__ const GLenum discards[] = { GL_COLOR_ATTACHMENT0 }; glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards); #endif @@ -132,7 +136,7 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) { // Render vertical glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, original_texture, 0); -#if GL_EXT_discard_framebuffer +#if GL_EXT_discard_framebuffer && !__ANDROID__ glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards); #endif glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/storage/response.cpp b/src/storage/response.cpp index f1e1c35874..cdaf33e4e4 100644 --- a/src/storage/response.cpp +++ b/src/storage/response.cpp @@ -9,7 +9,7 @@ int64_t Response::parseCacheControl(const char *value) { uint64_t seconds = 0; // TODO: cache-control may contain other information as well: // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 - if (std::sscanf(value, "max-age=%lu", &seconds) == 1) { + if (std::sscanf(value, "max-age=%llu", &seconds) == 1) { return std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch()).count() + seconds; |