[build] use GLFW as a submodule and update to most recent version

this fixes https://github.com/glfw/glfw/issues/1334 for macOS Mojave
This commit is contained in:
Konstantin Käfer
2018-11-20 16:45:53 +01:00
parent 53bbf9d699
commit f30429832e
8 changed files with 36 additions and 6 deletions

3
.gitmodules vendored
View File

@@ -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

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)

View File

@@ -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()

View File

@@ -1,5 +1,3 @@
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11)
include(cmake/loop-darwin.cmake)
macro(mbgl_platform_core)

1
vendor/glfw vendored Submodule

Submodule vendor/glfw added at 53c8c72c67

24
vendor/glfw.cmake vendored Normal file
View File

@@ -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}/$<CONFIG>")
endif()