diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-09 10:12:33 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-09 14:35:34 +0300 |
commit | c69fae99a561a04cac79d2931b43e53892167a0e (patch) | |
tree | f35707fe2a8d0b90932efa8c563cc785ac0b4e5a | |
parent | 93ab5387d920f9ecb1d460bbea8c45a76ba4b682 (diff) | |
download | qtlocation-mapboxgl-c69fae99a561a04cac79d2931b43e53892167a0e.tar.gz |
[build] Suppress GLFW redefining GLAPIENTRY error
-rw-r--r-- | cmake/glfw.cmake | 11 | ||||
-rw-r--r-- | platform/glfw/glfw_view.cpp | 7 | ||||
-rw-r--r-- | platform/glfw/glfw_view.hpp | 6 |
3 files changed, 19 insertions, 5 deletions
diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake index ba6ba92e9f..f1ace9e6ef 100644 --- a/cmake/glfw.cmake +++ b/cmake/glfw.cmake @@ -11,6 +11,17 @@ target_sources(mbgl-glfw PRIVATE platform/default/mbgl/util/default_styles.cpp ) +# Our GL implementation is internal to mbgl-core, which causes the GL header to +# be included after GLFW's own header. They both attempt to define GLAPIENTRY, +# but unfortunately the GL header doesn't check if it was previously defined, +# causing a macro redefinition compiler error. +# There is no particular compiler warning flag to ignore this check on GCC +# neither it does accept ignoring '-Werror' via diagnostics pragmas. We can +# only suppress this by either replacing the header path inclusion from -I to +# -isystem, or completely suppressing errors. Until the former solution is not +# available, we'll suppress the errors from that definition file. +set_source_files_properties(platform/glfw/glfw_view.cpp PROPERTIES COMPILE_FLAGS -Wno-error) + target_compile_options(mbgl-glfw PRIVATE -fvisibility-inlines-hidden ) diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 26c946ed76..31b0b92c58 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -10,6 +10,13 @@ #include <mbgl/map/backend_scope.hpp> #include <mbgl/map/camera.hpp> +#if MBGL_USE_GLES2 +#define GLFW_INCLUDE_ES2 +#endif // MBGL_USE_GLES2 + +#define GL_GLEXT_PROTOTYPES +#include <GLFW/glfw3.h> + #include <cassert> #include <cstdlib> diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp index 09b8847ff2..77f4f64b01 100644 --- a/platform/glfw/glfw_view.hpp +++ b/platform/glfw/glfw_view.hpp @@ -7,11 +7,7 @@ #include <mbgl/util/timer.hpp> #include <mbgl/util/geometry.hpp> -#if MBGL_USE_GLES2 -#define GLFW_INCLUDE_ES2 -#endif -#define GL_GLEXT_PROTOTYPES -#include <GLFW/glfw3.h> +struct GLFWwindow; class GLFWView : public mbgl::View, public mbgl::Backend { public: |