From 7e0a74931f37d4893db1ce648565c90ec8ca07c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 20 Nov 2018 16:45:53 +0100 Subject: [build] use GLFW as a submodule and update to most recent version this fixes https://github.com/glfw/glfw/issues/1334 for macOS Mojave --- .gitmodules | 3 +++ CMakeLists.txt | 4 +++- cmake/glfw.cmake | 2 +- cmake/mason-dependencies.cmake | 2 -- cmake/vendor.cmake | 4 ++++ platform/macos/config.cmake | 2 -- vendor/glfw | 1 + vendor/glfw.cmake | 24 ++++++++++++++++++++++++ 8 files changed, 36 insertions(+), 6 deletions(-) create mode 160000 vendor/glfw create mode 100644 vendor/glfw.cmake diff --git a/.gitmodules b/.gitmodules index 780e5ad43a..b7cb5780c8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -73,3 +73,6 @@ [submodule "vendor/jni.hpp"] path = vendor/jni.hpp url = https://github.com/mapbox/jni.hpp.git +[submodule "vendor/glfw"] + path = vendor/glfw + url = https://github.com/glfw/glfw.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a48e2c2b01..5db8b45894 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,8 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11) + option(WITH_CXX11ABI "Use the C++11 ABI" OFF) option(WITH_COVERAGE "Enable coverage reports" OFF) option(WITH_OSMESA "Use OSMesa headless backend" OFF) @@ -31,8 +33,8 @@ if (WITH_ERROR) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif() -include(cmake/vendor.cmake) include(cmake/mbgl.cmake) +include(cmake/vendor.cmake) include(cmake/mason.cmake) include(cmake/xcode.cmake) diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake index 4ab4ad9c8d..fe514196d5 100644 --- a/cmake/glfw.cmake +++ b/cmake/glfw.cmake @@ -18,10 +18,10 @@ target_include_directories(mbgl-glfw target_link_libraries(mbgl-glfw PRIVATE mbgl-core + PRIVATE glfw PRIVATE cheap-ruler-cpp ) -target_add_mason_package(mbgl-glfw PRIVATE glfw) target_add_mason_package(mbgl-glfw PRIVATE args) mbgl_platform_glfw() diff --git a/cmake/mason-dependencies.cmake b/cmake/mason-dependencies.cmake index f007ab4c26..71a94f096f 100644 --- a/cmake/mason-dependencies.cmake +++ b/cmake/mason-dependencies.cmake @@ -5,7 +5,6 @@ if(MBGL_PLATFORM STREQUAL "android") elseif(MBGL_PLATFORM STREQUAL "ios") # noop elseif(MBGL_PLATFORM STREQUAL "linux") - mason_use(glfw VERSION 2018-06-27-0be4f3f) mason_use(libuv VERSION 1.9.1) mason_use(libpng VERSION 1.6.25) mason_use(libjpeg-turbo VERSION 1.5.0) @@ -15,7 +14,6 @@ elseif(MBGL_PLATFORM STREQUAL "linux") mason_use(swiftshader VERSION 2018-05-31) endif() elseif(MBGL_PLATFORM STREQUAL "macos") - mason_use(glfw VERSION 2018-06-27-0be4f3f) mason_use(args VERSION 6.2.0 HEADER_ONLY) if(WITH_EGL) diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index 17128d10ee..557b0062d9 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -26,3 +26,7 @@ include(${CMAKE_SOURCE_DIR}/vendor/unique_resource.cmake) include(${CMAKE_SOURCE_DIR}/vendor/variant.cmake) include(${CMAKE_SOURCE_DIR}/vendor/vector-tile.cmake) include(${CMAKE_SOURCE_DIR}/vendor/wagyu.cmake) + +if(MBGL_PLATFORM STREQUAL "linux" OR MBGL_PLATFORM STREQUAL "macos") + include(${CMAKE_SOURCE_DIR}/vendor/glfw.cmake) +endif() diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake index 62f1713107..e2335842dd 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -1,5 +1,3 @@ -set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11) - include(cmake/loop-darwin.cmake) macro(mbgl_platform_core) diff --git a/vendor/glfw b/vendor/glfw new file mode 160000 index 0000000000..53c8c72c67 --- /dev/null +++ b/vendor/glfw @@ -0,0 +1 @@ +Subproject commit 53c8c72c676ca97c10aedfe3d0eb4271c5b23dba diff --git a/vendor/glfw.cmake b/vendor/glfw.cmake new file mode 100644 index 0000000000..e99ecc86b1 --- /dev/null +++ b/vendor/glfw.cmake @@ -0,0 +1,24 @@ +set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "Build the GLFW example programs" FORCE) +set(GLFW_BUILD_TESTS OFF CACHE BOOL "Build the GLFW test programs" FORCE) +set(GLFW_BUILD_DOCS OFF CACHE BOOL "Build the GLFW documentation" FORCE) +set(GLFW_INSTALL OFF CACHE BOOL "Generate installation target" FORCE) + +unset(CMAKE_C_VISIBILITY_PRESET) +add_subdirectory(vendor/glfw) +set(CMAKE_C_VISIBILITY_PRESET hidden) + +target_compile_options(glfw PRIVATE -Wno-shadow -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers) + +if(APPLE) + # Don't show OpenGL deprecation warnings. + target_compile_options(glfw PRIVATE -Wno-deprecated-declarations -Wno-unguarded-availability-new) + + # get_target_property(DEPLOYMENT_TARGET_VERSION glfw MACOSX_DEPLOYMENT_TARGET) + # message(STATUS "target: ${DEPLOYMENT_TARGET_VERSION}") + set_target_properties(glfw PROPERTIES OSX_DEPLOYMENT_TARGET 10.11) +endif() + +if(CMAKE_GENERATOR STREQUAL "Xcode") + # The Xcode generator always tries to link from this directory instead of the actual output dir. + set_target_properties(glfw PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") +endif() -- cgit v1.2.1