summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/config.cmake3
-rw-r--r--platform/darwin/mbgl/gl/gl_impl.hpp12
-rw-r--r--platform/glfw/glfw_view.cpp10
-rw-r--r--platform/ios/config.cmake2
-rw-r--r--platform/macos/config.cmake16
5 files changed, 34 insertions, 9 deletions
diff --git a/platform/android/config.cmake b/platform/android/config.cmake
index a0143aee9d..714d566bd8 100644
--- a/platform/android/config.cmake
+++ b/platform/android/config.cmake
@@ -1,4 +1,5 @@
-add_definitions(-DMBGL_USE_GLES2=1)
+set(USE_GLES2 ON)
+
include(cmake/nunicode.cmake)
# Build thin archives.
diff --git a/platform/darwin/mbgl/gl/gl_impl.hpp b/platform/darwin/mbgl/gl/gl_impl.hpp
index b4c062a474..0db125c7b4 100644
--- a/platform/darwin/mbgl/gl/gl_impl.hpp
+++ b/platform/darwin/mbgl/gl/gl_impl.hpp
@@ -8,9 +8,15 @@
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif TARGET_OS_MAC
- #include <OpenGL/OpenGL.h>
- #include <OpenGL/gl.h>
- #include <OpenGL/glext.h>
+ #if MBGL_USE_GLES2
+ #define GL_GLEXT_PROTOTYPES
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+ #else
+ #include <OpenGL/OpenGL.h>
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glext.h>
+ #endif
#else
#error Unsupported Apple platform
#endif
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index f1cbdbbaeb..9179113139 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -54,13 +54,19 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
height = videoMode->height;
}
+#if __APPLE__
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GL_TRUE);
+#endif
+
+#if MBGL_WITH_EGL
+ glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
+#endif
#ifdef DEBUG
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
#endif
-#ifdef GL_ES_VERSION_2_0
+#if MBGL_USE_GLES2
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
@@ -652,7 +658,7 @@ void GLFWView::toggle3DExtrusions(bool visible) {
namespace mbgl {
namespace platform {
-#ifndef GL_ES_VERSION_2_0
+#ifndef MBGL_USE_GLES2
void showDebugImage(std::string name, const char *data, size_t width, size_t height) {
glfwInit();
diff --git a/platform/ios/config.cmake b/platform/ios/config.cmake
index 48bb27a696..6bed436f64 100644
--- a/platform/ios/config.cmake
+++ b/platform/ios/config.cmake
@@ -1,4 +1,4 @@
-add_definitions(-DMBGL_USE_GLES2=1)
+set(USE_GLES2 ON)
macro(initialize_ios_target target)
set_xcode_property(${target} IPHONEOS_DEPLOYMENT_TARGET "9.0")
diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake
index d53f61f3b3..f164b8491e 100644
--- a/platform/macos/config.cmake
+++ b/platform/macos/config.cmake
@@ -27,7 +27,6 @@ macro(mbgl_platform_core)
PRIVATE platform/default/mbgl/gl/headless_frontend.hpp
PRIVATE platform/default/mbgl/gl/headless_backend.cpp
PRIVATE platform/default/mbgl/gl/headless_backend.hpp
- PRIVATE platform/darwin/src/headless_backend_cgl.cpp
# Snapshotting
PRIVATE platform/default/mbgl/map/map_snapshotter.cpp
@@ -40,6 +39,20 @@ macro(mbgl_platform_core)
PRIVATE platform/default/mbgl/util/default_thread_pool.cpp
)
+ if(WITH_EGL)
+ target_sources(mbgl-core
+ PRIVATE platform/linux/src/headless_backend_egl.cpp
+ )
+ target_add_mason_package(mbgl-core PUBLIC swiftshader)
+ else()
+ target_sources(mbgl-core
+ PRIVATE platform/darwin/src/headless_backend_cgl.cpp
+ )
+ target_link_libraries(mbgl-core
+ PUBLIC "-framework OpenGL"
+ )
+ endif()
+
target_add_mason_package(mbgl-core PUBLIC geojson)
target_add_mason_package(mbgl-core PUBLIC polylabel)
target_add_mason_package(mbgl-core PRIVATE icu)
@@ -58,7 +71,6 @@ macro(mbgl_platform_core)
PUBLIC "-framework Foundation"
PUBLIC "-framework CoreText"
PUBLIC "-framework CoreGraphics"
- PUBLIC "-framework OpenGL"
PUBLIC "-framework ImageIO"
PUBLIC "-framework CoreServices"
PUBLIC "-framework SystemConfiguration"