summaryrefslogtreecommitdiff
path: root/platform/macos/config.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos/config.cmake')
-rw-r--r--platform/macos/config.cmake48
1 files changed, 44 insertions, 4 deletions
diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake
index 8dc3c38245..b732309c0d 100644
--- a/platform/macos/config.cmake
+++ b/platform/macos/config.cmake
@@ -1,10 +1,13 @@
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
-mason_use(glfw VERSION 2017-02-09-77a8f10)
+mason_use(glfw VERSION 2017-04-07-f40d085)
mason_use(boost_libprogram_options VERSION 1.62.0)
mason_use(gtest VERSION 1.8.0)
mason_use(benchmark VERSION 1.0.0-1)
mason_use(icu VERSION 58.1-min-size)
+if(WITH_SWIFTSHADER)
+ mason_use(swiftshader VERSION 2017-04-08)
+endif()
include(cmake/loop-darwin.cmake)
@@ -47,9 +50,7 @@ macro(mbgl_platform_core)
# Headless view
PRIVATE platform/default/mbgl/gl/headless_backend.cpp
PRIVATE platform/default/mbgl/gl/headless_backend.hpp
- PRIVATE platform/darwin/src/headless_backend_cgl.cpp
PRIVATE platform/default/mbgl/gl/headless_display.hpp
- PRIVATE platform/darwin/src/headless_display_cgl.cpp
PRIVATE platform/default/mbgl/gl/offscreen_view.cpp
PRIVATE platform/default/mbgl/gl/offscreen_view.hpp
@@ -77,12 +78,25 @@ macro(mbgl_platform_core)
PUBLIC "-lz"
PUBLIC "-framework Foundation"
PUBLIC "-framework CoreGraphics"
- PUBLIC "-framework OpenGL"
PUBLIC "-framework ImageIO"
PUBLIC "-framework CoreServices"
PUBLIC "-framework SystemConfiguration"
PUBLIC "-lsqlite3"
)
+
+ if(WITH_SWIFTSHADER)
+ target_sources(mbgl-core
+ PRIVATE platform/default/headless_backend_egl.cpp
+ PRIVATE platform/default/headless_display_egl.cpp
+ )
+ target_add_mason_package(mbgl-core PRIVATE swiftshader)
+ else()
+ target_sources(mbgl-core
+ PRIVATE platform/darwin/src/headless_backend_cgl.cpp
+ PRIVATE platform/darwin/src/headless_display_cgl.cpp
+ )
+ target_link_libraries(mbgl-core PUBLIC "-framework OpenGL")
+ endif()
endmacro()
@@ -127,6 +141,7 @@ macro(mbgl_platform_test)
)
endmacro()
+
macro(mbgl_platform_benchmark)
target_compile_options(mbgl-benchmark
PRIVATE -fvisibility=hidden
@@ -147,6 +162,7 @@ macro(mbgl_platform_benchmark)
)
endmacro()
+
macro(mbgl_platform_node)
target_compile_options(mbgl-node
PRIVATE -fvisibility=hidden
@@ -156,3 +172,27 @@ macro(mbgl_platform_node)
PRIVATE "-Wl,-bind_at_load"
)
endmacro()
+
+
+macro(mbgl_platform_set_swiftshader_rpath TARGET)
+ # Add the GLES headers to the include path when building with SwiftShader.
+ target_include_directories(${TARGET}
+ PRIVATE "${MASON_PACKAGE_swiftshader_INCLUDE_DIRS}"
+ )
+
+ # Change the embedded rpath so that it looks in the folder where the executable is.
+ # However, node modules are loaded from another executable, so instead, we want the rpath to
+ # be the folder where the node module is located, so we're using @loader_path here instead.
+ # For applications, @loader_path is the same as @executable_path.
+ set_target_properties(${TARGET} PROPERTIES
+ XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@loader_path/"
+ )
+
+ # Copy libEGL.dylib and libGLESv2.dylib over to the executable's folder, because this is
+ # where dyld will be looking for, given that we've set the rpath above.
+ add_custom_command(
+ TARGET ${TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${MASON_PACKAGE_swiftshader_PREFIX}/lib/*.dylib $<TARGET_FILE_DIR:${TARGET}>
+ )
+endmacro()