From d2792e29870629faeaebd0eea91b5819fc58e719 Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Tue, 9 Dec 2014 03:41:05 +1100 Subject: [PATCH 1/5] Tidy up HeadlessView --- .../platform/default/headless_display.hpp | 4 +- .../mbgl/platform/default/headless_view.hpp | 14 +- platform/default/glfw_view.cpp | 1 - platform/default/headless_display.cpp | 36 +++-- platform/default/headless_view.cpp | 151 ++++++++++-------- 5 files changed, 110 insertions(+), 96 deletions(-) diff --git a/include/mbgl/platform/default/headless_display.hpp b/include/mbgl/platform/default/headless_display.hpp index 08c423c58..bf67e3c3b 100644 --- a/include/mbgl/platform/default/headless_display.hpp +++ b/include/mbgl/platform/default/headless_display.hpp @@ -15,8 +15,8 @@ public: #endif #if MBGL_USE_GLX - Display *x_display = nullptr; - GLXFBConfig *fb_configs = nullptr; + Display *xDisplay = nullptr; + GLXFBConfig *fbConfigs = nullptr; #endif }; diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp index 9d8acf70f..a521cff54 100644 --- a/include/mbgl/platform/default/headless_view.hpp +++ b/include/mbgl/platform/default/headless_view.hpp @@ -46,19 +46,19 @@ private: float pixelRatio_; #if MBGL_USE_CGL - CGLContextObj gl_context; + CGLContextObj glContext; #endif #if MBGL_USE_GLX - Display *x_display = nullptr; - GLXFBConfig *fb_configs = nullptr; - GLXContext gl_context = 0; - GLXPbuffer glx_pbuffer = 0; + Display *xDisplay = nullptr; + GLXFBConfig *fbConfigs = nullptr; + GLXContext glContext = 0; + GLXPbuffer glxPbuffer = 0; #endif GLuint fbo = 0; - GLuint fbo_depth_stencil = 0; - GLuint fbo_color = 0; + GLuint fboDepthStencil = 0; + GLuint fboColor = 0; }; } diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index 32b7e44ec..7cfb13213 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -65,7 +65,6 @@ void GLFWView::initialize(mbgl::Map *map_) { glfwSetScrollCallback(window, scroll); glfwSetKeyCallback(window, key); - const std::string extensions = (char *)glGetString(GL_EXTENSIONS); { using namespace mbgl; diff --git a/platform/default/headless_display.cpp b/platform/default/headless_display.cpp index ada48b864..40cc0640a 100644 --- a/platform/default/headless_display.cpp +++ b/platform/default/headless_display.cpp @@ -18,31 +18,35 @@ HeadlessDisplay::HeadlessDisplay() { GLint num; CGLError error = CGLChoosePixelFormat(attributes, &pixelFormat, &num); - if (error) { - fprintf(stderr, "Error pixel format: %s\n", CGLErrorString(error)); + if (error != kCGLNoError) { + throw std::runtime_error(std::string("Error choosing pixel format:") + CGLErrorString(error) + "\n"); + return; + } + if (num <= 0) { + throw std::runtime_error("No pixel formats found."); return; } #endif #if MBGL_USE_GLX if (!XInitThreads()) { - throw std::runtime_error("Failed to XInitThreads"); + throw std::runtime_error("Failed to XInitThreads."); } - x_display = XOpenDisplay(nullptr); - if (x_display == nullptr) { - throw std::runtime_error("Failed to open X display"); + xDisplay = XOpenDisplay(nullptr); + if (xDisplay == nullptr) { + throw std::runtime_error("Failed to open X display."); } - const char *extensions = (char *)glXQueryServerString(x_display, DefaultScreen(x_display), GLX_EXTENSIONS); + const char *extensions = (char *)glXQueryServerString(xDisplay, DefaultScreen(xDisplay), GLX_EXTENSIONS); if (!extensions) { - throw std::runtime_error("Cannot read GLX extensions"); + throw std::runtime_error("Cannot read GLX extensions."); } if (!strstr(extensions,"GLX_SGIX_fbconfig")) { - throw std::runtime_error("Extension GLX_SGIX_fbconfig was not found"); + throw std::runtime_error("Extension GLX_SGIX_fbconfig was not found."); } if (!strstr(extensions, "GLX_SGIX_pbuffer")) { - throw std::runtime_error("Cannot find glXCreateContextAttribsARB"); + throw std::runtime_error("Cannot find glXCreateContextAttribsARB."); } // We're creating a dummy pbuffer anyway that we're not using. @@ -52,9 +56,12 @@ HeadlessDisplay::HeadlessDisplay() { }; int configs = 0; - fb_configs = glXChooseFBConfig(x_display, DefaultScreen(x_display), pixelFormat, &configs); + fbConfigs = glXChooseFBConfig(xDisplay, DefaultScreen(xDisplay), pixelFormat, &configs); + if (fbConfigs == nullptr) { + throw std::runtime_error("Failed to glXChooseFBConfig."); + } if (configs <= 0) { - throw std::runtime_error("No Framebuffer configurations"); + throw std::runtime_error("No Framebuffer configurations."); } #endif } @@ -65,10 +72,9 @@ HeadlessDisplay::~HeadlessDisplay() { #endif #if MBGL_USE_GLX - XFree(fb_configs); - XCloseDisplay(x_display); + XFree(fbConfigs); + XCloseDisplay(xDisplay); #endif } } - diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index 5b95c7602..c84651c2e 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #if MBGL_USE_GLX #ifdef GLX_ARB_create_context @@ -23,7 +24,7 @@ CGLProc CGLGetProcAddress(const char *proc) { if (!framework) { framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); if (!framework) { - throw std::runtime_error("Failed to load OpenGL.framework"); + throw std::runtime_error("Failed to load OpenGL framework."); } } @@ -59,16 +60,25 @@ void HeadlessView::loadExtensions() { gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)CGLGetProcAddress("glDeleteVertexArraysAPPLE"); gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)CGLGetProcAddress("glGenVertexArraysAPPLE"); gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)CGLGetProcAddress("glIsVertexArrayAPPLE"); + assert(gl::BindVertexArray != nullptr); + assert(gl::DeleteVertexArrays != nullptr); + assert(gl::GenVertexArrays != nullptr); + assert(gl::IsVertexArray != nullptr); } #endif #ifdef MBGL_USE_GLX if (extensions.find("GL_ARB_vertex_array_object") != std::string::npos) { - gl::BindVertexArray = (gl::PFNGLBINDVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glBindVertexArrayARB"); - gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glDeleteVertexArraysARB"); - gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glGenVertexArraysARB"); - gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glIsVertexArrayARB"); + gl::BindVertexArray = (gl::PFNGLBINDVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glBindVertexArray"); + gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glDeleteVertexArrays"); + gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glGenVertexArrays"); + gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glIsVertexArray"); + assert(gl::BindVertexArray != nullptr); + assert(gl::DeleteVertexArrays != nullptr); + assert(gl::GenVertexArrays != nullptr); + assert(gl::IsVertexArray != nullptr); } #endif + make_inactive(); } @@ -78,7 +88,7 @@ void HeadlessView::loadExtensions() { // These are all of the OpenGL Core profile version that we know about. struct core_profile_version { int major, minor; }; -static const core_profile_version core_profile_versions[] = { +static const core_profile_version coreProfileVersions[] = { {4, 5}, {4, 4}, {4, 3}, @@ -93,33 +103,33 @@ static const core_profile_version core_profile_versions[] = { }; GLXContext createCoreProfile(Display *dpy, GLXFBConfig fbconfig) { - static bool context_creation_failed = false; + static bool contextCreationFailed = false; GLXContext ctx = 0; // Set the Error Handler to avoid crashing the program when the context creation fails. // It is expected that some context creation attempts fail, e.g. because the OpenGL // implementation does not support the version we're requesting. - int (*previous_error_handler)(Display *, XErrorEvent *) = XSetErrorHandler([](Display *, XErrorEvent *) { - context_creation_failed = true; + int (*previousErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler([](Display *, XErrorEvent *) { + contextCreationFailed = true; return 0; }); // Try to create core profiles from the highest known version on down. - for (int i = 0; !ctx && core_profile_versions[i].major; i++) { - context_creation_failed = false; - const int context_flags[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, core_profile_versions[i].major, - GLX_CONTEXT_MINOR_VERSION_ARB, core_profile_versions[i].minor, + for (int i = 0; !ctx && coreProfileVersions[i].major; i++) { + contextCreationFailed = false; + const int contextFlags[] = { + GLX_CONTEXT_MAJOR_VERSION_ARB, coreProfileVersions[i].major, + GLX_CONTEXT_MINOR_VERSION_ARB, coreProfileVersions[i].minor, 0 }; - ctx = glXCreateContextAttribsARB(dpy, fbconfig, 0, True, context_flags); - if (context_creation_failed) { + ctx = glXCreateContextAttribsARB(dpy, fbconfig, 0, True, contextFlags); + if (contextCreationFailed) { ctx = 0; } } // Restore the old error handler. - XSetErrorHandler(previous_error_handler); + XSetErrorHandler(previousErrorHandler); return ctx; } #endif @@ -127,14 +137,14 @@ GLXContext createCoreProfile(Display *dpy, GLXFBConfig fbconfig) { void HeadlessView::createContext() { #if MBGL_USE_CGL - CGLError error = CGLCreateContext(display_->pixelFormat, NULL, &gl_context); - if (error) { - throw std::runtime_error("Error creating GL context object\n"); + CGLError error = CGLCreateContext(display_->pixelFormat, NULL, &glContext); + if (error != kCGLNoError) { + throw std::runtime_error(std::string("Error creating GL context object:") + CGLErrorString(error) + "\n"); } - error = CGLEnable(gl_context, kCGLCEMPEngine); - if (error != kCGLNoError ) { - throw std::runtime_error("Error enabling OpenGL multithreading\n"); + error = CGLEnable(glContext, kCGLCEMPEngine); + if (error != kCGLNoError) { + throw std::runtime_error(std::string("Error enabling OpenGL multithreading:") + CGLErrorString(error) + "\n"); } #endif @@ -145,39 +155,39 @@ void HeadlessView::createContext() { } #endif - x_display = display_->x_display; - fb_configs = display_->fb_configs; + xDisplay = display_->xDisplay; + fbConfigs = display_->fbConfigs; #ifdef GLX_ARB_create_context if (glXCreateContextAttribsARB) { // Try to create a core profile context. - gl_context = createCoreProfile(x_display, fb_configs[0]); + glContext = createCoreProfile(xDisplay, fbConfigs[0]); } #endif - if (!gl_context) { + if (!glContext) { // Try to create a legacy context - gl_context = glXCreateNewContext(x_display, fb_configs[0], GLX_RGBA_TYPE, 0, True); - if (gl_context) { - if (!glXIsDirect(x_display, gl_context)) { - glXDestroyContext(x_display, gl_context); - gl_context = 0; + glContext = glXCreateNewContext(xDisplay, fbConfigs[0], GLX_RGBA_TYPE, 0, True); + if (glContext) { + if (!glXIsDirect(xDisplay, glContext)) { + glXDestroyContext(xDisplay, glContext); + glContext = 0; } } } - if (gl_context == 0) { - throw std::runtime_error("Error creating GL context object"); + if (glContext == 0) { + throw std::runtime_error("Error creating GL context object."); } // Create a dummy pbuffer. We will render to framebuffers anyway, but we need a pbuffer to // activate the context. - int pbuffer_attributes[] = { + int pbufferAttributes[] = { GLX_PBUFFER_WIDTH, 8, GLX_PBUFFER_HEIGHT, 8, 0 }; - glx_pbuffer = glXCreatePbuffer(x_display, fb_configs[0], pbuffer_attributes); + glxPbuffer = glXCreatePbuffer(xDisplay, fbConfigs[0], pbufferAttributes); #endif } @@ -194,35 +204,35 @@ void HeadlessView::resize(uint16_t width, uint16_t height, float pixelRatio) { make_active(); // Create depth/stencil buffer - glGenRenderbuffersEXT(1, &fbo_depth_stencil); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo_depth_stencil); + glGenRenderbuffersEXT(1, &fboDepthStencil); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fboDepthStencil); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, w, h); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); - glGenRenderbuffersEXT(1, &fbo_color); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo_color); + glGenRenderbuffersEXT(1, &fboColor); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fboColor); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, w, h); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glGenFramebuffersEXT(1, &fbo); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, fbo_color); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER_EXT, fbo_depth_stencil); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, fboColor); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER_EXT, fboDepthStencil); GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { std::stringstream error("Couldn't create framebuffer: "); switch (status) { - case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: (error << "incomplete attachment\n"); break; - case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: error << "incomplete missing attachment\n"; break; - case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: error << "incomplete dimensions\n"; break; - case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: error << "incomplete formats\n"; break; - case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: error << "incomplete draw buffer\n"; break; - case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: error << "incomplete read buffer\n"; break; - case GL_FRAMEBUFFER_UNSUPPORTED: error << "unsupported\n"; break; - default: error << "other\n"; break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: (error << "incomplete attachment.\n"); break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: error << "incomplete missing attachment.\n"; break; + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: error << "incomplete dimensions.\n"; break; + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: error << "incomplete formats.\n"; break; + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: error << "incomplete draw buffer.\n"; break; + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: error << "incomplete read buffer.\n"; break; + case GL_FRAMEBUFFER_UNSUPPORTED: error << "unsupported.\n"; break; + default: error << "othe.r\n"; break; } throw std::runtime_error(error.str()); } @@ -262,14 +272,14 @@ void HeadlessView::clear_buffers() { fbo = 0; } - if (fbo_color) { - glDeleteTextures(1, &fbo_color); - fbo_color = 0; + if (fboColor) { + glDeleteTextures(1, &fboColor); + fboColor = 0; } - if (fbo_depth_stencil) { - glDeleteRenderbuffersEXT(1, &fbo_depth_stencil); - fbo_depth_stencil = 0; + if (fboDepthStencil) { + glDeleteRenderbuffersEXT(1, &fboDepthStencil); + fboDepthStencil = 0; } make_inactive(); @@ -279,16 +289,16 @@ HeadlessView::~HeadlessView() { clear_buffers(); #if MBGL_USE_CGL - CGLDestroyContext(gl_context); + CGLDestroyContext(glContext); #endif #if MBGL_USE_GLX - if (glx_pbuffer) { - glXDestroyPbuffer(x_display, glx_pbuffer); - glx_pbuffer = 0; + if (glxPbuffer) { + glXDestroyPbuffer(xDisplay, glxPbuffer); + glxPbuffer = 0; } - glXDestroyContext(x_display, gl_context); + glXDestroyContext(xDisplay, glContext); #endif } @@ -302,15 +312,15 @@ void HeadlessView::notify_map_change(mbgl::MapChange /*change*/, mbgl::timestamp void HeadlessView::make_active() { #if MBGL_USE_CGL - CGLError error = CGLSetCurrentContext(gl_context); - if (error) { - throw std::runtime_error("Switching OpenGL context failed\n"); + CGLError error = CGLSetCurrentContext(glContext); + if (error != kCGLNoError) { + throw std::runtime_error(std::string("Switching OpenGL context failed:") + CGLErrorString(error) + "\n"); } #endif #if MBGL_USE_GLX - if (!glXMakeContextCurrent(x_display, glx_pbuffer, glx_pbuffer, gl_context)) { - throw std::runtime_error("Switching OpenGL context failed\n"); + if (!glXMakeContextCurrent(xDisplay, glxPbuffer, glxPbuffer, glContext)) { + throw std::runtime_error("Switching OpenGL context failed.\n"); } #endif } @@ -318,14 +328,14 @@ void HeadlessView::make_active() { void HeadlessView::make_inactive() { #if MBGL_USE_CGL CGLError error = CGLSetCurrentContext(nullptr); - if (error) { - throw std::runtime_error("Removing OpenGL context failed\n"); + if (error != kCGLNoError) { + throw std::runtime_error(std::string("Removing OpenGL context failed:") + CGLErrorString(error) + "\n"); } #endif #if MBGL_USE_GLX - if (!glXMakeContextCurrent(x_display, 0, 0, nullptr)) { - throw std::runtime_error("Removing OpenGL context failed\n"); + if (!glXMakeContextCurrent(xDisplay, 0, 0, nullptr)) { + throw std::runtime_error("Removing OpenGL context failed.\n"); } #endif } @@ -333,4 +343,3 @@ void HeadlessView::make_inactive() { void HeadlessView::swap() {} } - From 917c0168abcb964d2b7f75ff7bae80e0b5e61c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 9 Dec 2014 14:14:11 +0100 Subject: [PATCH 2/5] don't include the source file in every library --- gyp/version.gypi | 4 +--- scripts/build-version.py | 27 --------------------------- src/mbgl/util/version_info.cpp | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 30 deletions(-) create mode 100644 src/mbgl/util/version_info.cpp diff --git a/gyp/version.gypi b/gyp/version.gypi index ca68f0eb5..341d9d3a2 100644 --- a/gyp/version.gypi +++ b/gyp/version.gypi @@ -6,13 +6,12 @@ 'hard_dependency': 1, 'actions': [ { - 'action_name': 'Build Version File', + 'action_name': 'Build Version Header', 'inputs': [ '../scripts/build-version.py', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', - '<(SHARED_INTERMEDIATE_DIR)/src/mbgl/util/mbgl_version.cpp', ], 'action': ['<@(python)', 'scripts/build-version.py', '<(SHARED_INTERMEDIATE_DIR)', ' - -namespace mbgl {{ -namespace version {{ - -const int major = {major}; -const int minor = {minor}; -const int patch = {patch}; -const char *revision = "{rev}"; -const char *string = "{major}.{minor}.{patch}"; -const unsigned int number = 0x{major:02x}{minor:02x}{patch:02x}; - -}} -}} -""".format( - major = tag[0], - minor = tag[1], - patch = tag[2], - rev = rev -) - -# Note: We can't use version.cpp since libuv already has a file named version.c. -# Having another one here would overwrite that file and cause missing symbols errors. -source_path = os.path.join(output_dir, 'src/mbgl/util/mbgl_version.cpp') -mkdir_p(os.path.dirname(source_path)) -with open(source_path, 'w') as f: f.write(source) diff --git a/src/mbgl/util/version_info.cpp b/src/mbgl/util/version_info.cpp new file mode 100644 index 000000000..1d649d2b6 --- /dev/null +++ b/src/mbgl/util/version_info.cpp @@ -0,0 +1,14 @@ +#include + +namespace mbgl { +namespace version { + +const int major = MBGL_VERSION_MAJOR; +const int minor = MBGL_VERSION_MINOR; +const int patch = MBGL_VERSION_PATCH; +const char *revision = MBGL_VERSION_REV; +const char *string = MBGL_VERSION_STRING; +const unsigned int number = MBGL_VERSION; + +} +} \ No newline at end of file From 753b6eedd6dda787b813fa966987bf227c854ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 9 Dec 2014 14:35:27 +0100 Subject: [PATCH 3/5] also install the version header --- gyp/install.gypi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gyp/install.gypi b/gyp/install.gypi index 56591d27d..5338bfed1 100644 --- a/gyp/install.gypi +++ b/gyp/install.gypi @@ -16,7 +16,8 @@ { 'files': [ '<(PRODUCT_DIR)/libmbgl-core.a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '<(PRODUCT_DIR)/libmbgl-headless.a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '<(PRODUCT_DIR)/libmbgl-<(platform).a' ], 'destination': '<(install_prefix)/lib' }, - { 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' } + { 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }, + { 'files': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp' ], 'destination': '<(install_prefix)/include/mbgl/util' }, ], 'variables': { 'conditions': [ From 5ccc988ff76414e7b4a803d0d720de71d8e78b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 9 Dec 2014 14:55:32 +0100 Subject: [PATCH 4/5] fix typo --- platform/default/headless_view.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index c84651c2e..d414c3f45 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -232,7 +232,7 @@ void HeadlessView::resize(uint16_t width, uint16_t height, float pixelRatio) { case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: error << "incomplete draw buffer.\n"; break; case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: error << "incomplete read buffer.\n"; break; case GL_FRAMEBUFFER_UNSUPPORTED: error << "unsupported.\n"; break; - default: error << "othe.r\n"; break; + default: error << "other\n"; break; } throw std::runtime_error(error.str()); } From 538120bb7fb8ba739a58890ff6caf5202c05edc7 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Mon, 8 Dec 2014 09:05:44 -0800 Subject: [PATCH 5/5] wrap mbgl-core and mbgl-linux in -Wl,--start-group/-Wl,--end-group --- utils/mbgl-config/mbgl-config.template.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/mbgl-config/mbgl-config.template.sh b/utils/mbgl-config/mbgl-config.template.sh index 84fce43c1..89e28f64a 100644 --- a/utils/mbgl-config/mbgl-config.template.sh +++ b/utils/mbgl-config/mbgl-config.template.sh @@ -24,6 +24,12 @@ if test $# -eq 0; then usage 1 fi +if [ ${CONFIG_MBGL_PLATFORM} == 'linux' ]; then + LIBS="-Wl,--start-group -lmbgl-core -lmbgl-${CONFIG_MBGL_PLATFORM} -Wl,--end-group -lmbgl-headless" +else + LIBS="-lmbgl-core -lmbgl-${CONFIG_MBGL_PLATFORM} -lmbgl-headless" +fi + while test $# -gt 0; do case "$1" in esac @@ -43,7 +49,7 @@ while test $# -gt 0; do ;; --libs) - echo -L${CONFIG_MBGL_PREFIX}/lib -lmbgl-core -lmbgl-${CONFIG_MBGL_PLATFORM} -lmbgl-headless ${CONFIG_MBGL_LDFLAGS} + echo -L${CONFIG_MBGL_PREFIX}/lib ${LIBS} ${CONFIG_MBGL_LDFLAGS} ;; --includedir)