diff options
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/CHANGELOG.md | 6 | ||||
-rw-r--r-- | platform/macos/bitrise.yml | 30 | ||||
-rw-r--r-- | platform/macos/config.cmake | 42 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/project.pbxproj | 5 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/xcshareddata/xcschemes/CI.xcscheme | 2 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme | 2 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/xcshareddata/xcschemes/macosapp.xcscheme | 2 | ||||
-rw-r--r-- | platform/macos/scripts/executable.xcscheme | 8 | ||||
-rw-r--r-- | platform/macos/scripts/library.xcscheme | 2 | ||||
-rwxr-xr-x | platform/macos/scripts/metrics.sh | 7 | ||||
-rw-r--r-- | platform/macos/scripts/node.xcscheme | 5 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 46 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView_Private.h | 2 | ||||
-rw-r--r-- | platform/macos/src/MGLOpenGLLayer.mm | 2 | ||||
-rw-r--r-- | platform/macos/src/NSImage+MGLAdditions.mm | 4 |
15 files changed, 115 insertions, 50 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 8482cc5e0b..2495cd0e06 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog for Mapbox macOS SDK +## master + +* Labels written in Arabic, Hebrew, and other scripts are written right-to-left. Arabic characters are correctly shaped. ([#6984](https://github.com/mapbox/mapbox-gl-native/pull/6984), [#7123](https://github.com/mapbox/mapbox-gl-native/pull/7123)) +* Improved the line wrapping behavior of point-placed labels written in Chinese, Japanese, and Yi. ([#6828](https://github.com/mapbox/mapbox-gl-native/pull/6828)) +* Fixed an issue where translucent point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832)) + ## 0.3.0 ### Packaging diff --git a/platform/macos/bitrise.yml b/platform/macos/bitrise.yml index 340d72e27c..2de6bce1fc 100644 --- a/platform/macos/bitrise.yml +++ b/platform/macos/bitrise.yml @@ -2,6 +2,8 @@ format_version: 1.1.0 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git trigger_map: +- pattern: nightly-release + workflow: nightly-release - pattern: "*" is_pull_request_allowed: true workflow: primary @@ -78,3 +80,31 @@ workflows: failed' - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png + nightly-release: + steps: + - script: + title: Install Dependencies + inputs: + - content: |- + #!/bin/bash + set -eu -o pipefail + brew install cmake + - is_debug: 'yes' + - script: + title: Configure AWS-CLI + inputs: + - content: |- + #!/bin/bash + apt-get install -y python-pip python-dev build-essential + pip install awscli + - script: + title: Build package + inputs: + - content: |- + #!/bin/bash + set -eu -o pipefail + export BUILDTYPE=Release + export SYMBOLS=NO + make xpackage + CLOUDWATCH=true platform/macos/scripts/metrics.sh + - is_debug: 'yes' diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake index 27bf555ec6..dab507d42a 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -1,13 +1,16 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10) mason_use(glfw VERSION 3.2.1) -mason_use(boost_libprogram_options VERSION 1.60.0) +mason_use(boost_libprogram_options VERSION 1.62.0) mason_use(gtest VERSION 1.7.0${MASON_CXXABI_SUFFIX}) mason_use(benchmark VERSION 1.0.0) +mason_use(icu VERSION 58.1) include(cmake/loop-darwin.cmake) macro(mbgl_platform_core) + set_xcode_property(mbgl-core GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_sources(mbgl-core # File source PRIVATE platform/darwin/src/http_file_source.mm @@ -16,6 +19,10 @@ macro(mbgl_platform_core) PRIVATE platform/default/local_file_source.cpp PRIVATE platform/default/online_file_source.cpp + # Default styles + PRIVATE platform/default/mbgl/util/default_styles.hpp + PRIVATE platform/default/mbgl/util/default_styles.cpp + # Offline PRIVATE platform/default/mbgl/storage/offline.cpp PRIVATE platform/default/mbgl/storage/offline_database.cpp @@ -26,32 +33,40 @@ macro(mbgl_platform_core) PRIVATE platform/default/sqlite3.hpp # Misc - PRIVATE platform/darwin/src/log_nslog.mm + PRIVATE platform/darwin/mbgl/storage/reachability.h + PRIVATE platform/darwin/mbgl/storage/reachability.m + PRIVATE platform/darwin/src/logging_nslog.mm PRIVATE platform/darwin/src/nsthread.mm - PRIVATE platform/darwin/src/reachability.m PRIVATE platform/darwin/src/string_nsstring.mm + PRIVATE platform/default/bidi.cpp # Image handling PRIVATE platform/darwin/src/image.mm # 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/headless_backend.cpp - PRIVATE platform/default/headless_display.cpp - PRIVATE platform/default/offscreen_view.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 # Thread pool - PRIVATE platform/default/thread_pool.cpp + PRIVATE platform/default/mbgl/util/default_thread_pool.cpp + PRIVATE platform/default/mbgl/util/default_thread_pool.cpp ) target_add_mason_package(mbgl-core PUBLIC geojson) + target_add_mason_package(mbgl-core PUBLIC icu) target_compile_options(mbgl-core PRIVATE -fobjc-arc ) target_include_directories(mbgl-core - PRIVATE platform/default + PUBLIC platform/darwin + PUBLIC platform/default ) target_link_libraries(mbgl-core @@ -70,6 +85,8 @@ endmacro() macro(mbgl_platform_render) + set_xcode_property(mbgl-render GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_link_libraries(mbgl-render PRIVATE mbgl-loop PRIVATE "-framework Foundation" @@ -83,6 +100,8 @@ endmacro() macro(mbgl_platform_offline) + set_xcode_property(mbgl-offline GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_link_libraries(mbgl-offline PRIVATE mbgl-loop PRIVATE "-framework Foundation" @@ -96,6 +115,8 @@ endmacro() macro(mbgl_platform_test) + set_xcode_property(mbgl-test GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_sources(mbgl-test PRIVATE test/src/main.cpp ) @@ -118,6 +139,8 @@ macro(mbgl_platform_test) endmacro() macro(mbgl_platform_benchmark) + set_xcode_property(mbgl-benchmark GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_sources(mbgl-benchmark PRIVATE benchmark/src/main.cpp ) @@ -140,8 +163,11 @@ macro(mbgl_platform_benchmark) endmacro() macro(mbgl_platform_node) + set_xcode_property(mbgl-node GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_link_libraries(mbgl-node PRIVATE "-framework Foundation" PRIVATE "-framework OpenGL" + PRIVATE "-Wl,-bind_at_load" ) endmacro() diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 5edb4429fb..106c370998 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -1535,6 +1535,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_loop_INCLUDE_DIRECTORIES)", @@ -1560,11 +1561,14 @@ buildSettings = { COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; + DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_loop_INCLUDE_DIRECTORIES)", @@ -1579,6 +1583,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; + STRIP_STYLE = "non-global"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/CI.xcscheme b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/CI.xcscheme index eca3be86dc..a049928fdd 100644 --- a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/CI.xcscheme +++ b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/CI.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0800" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme index 189596d94f..95351f7f04 100644 --- a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme +++ b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0800" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/macosapp.xcscheme b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/macosapp.xcscheme index 0867fc0c23..a58ef5c9cf 100644 --- a/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/macosapp.xcscheme +++ b/platform/macos/macos.xcodeproj/xcshareddata/xcschemes/macosapp.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0800" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/platform/macos/scripts/executable.xcscheme b/platform/macos/scripts/executable.xcscheme index 4353aad846..c6a8d04d30 100644 --- a/platform/macos/scripts/executable.xcscheme +++ b/platform/macos/scripts/executable.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0730" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -46,7 +46,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" - useCustomWorkingDirectory = "NO" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "{{WORKING_DIRECTORY}}" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" @@ -81,7 +82,8 @@ buildConfiguration = "Release" shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "{{WORKING_DIRECTORY}}" debugDocumentVersioning = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> diff --git a/platform/macos/scripts/library.xcscheme b/platform/macos/scripts/library.xcscheme index 012bc900c2..5472d3c821 100644 --- a/platform/macos/scripts/library.xcscheme +++ b/platform/macos/scripts/library.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0730" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/platform/macos/scripts/metrics.sh b/platform/macos/scripts/metrics.sh new file mode 100755 index 0000000000..56790fc1e6 --- /dev/null +++ b/platform/macos/scripts/metrics.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# Track individual architectures +scripts/log_binary_size.sh "build/macos/pkg/Mapbox.framework/Versions/Current/Mapbox" "Platform=macOS,Arch=x86_64" diff --git a/platform/macos/scripts/node.xcscheme b/platform/macos/scripts/node.xcscheme index 361ed58a37..6f541deca3 100644 --- a/platform/macos/scripts/node.xcscheme +++ b/platform/macos/scripts/node.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0730" + LastUpgradeVersion = "0810" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -76,7 +76,8 @@ buildConfiguration = "Release" shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "{{WORKING_DIRECTORY}}" debugDocumentVersioning = "YES"> <MacroExpansion> <BuildableReference diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index bf31daffad..92aa0a6c6b 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -19,13 +19,12 @@ #import "MGLAnnotationImage.h" #import "MGLMapViewDelegate.h" -#import <mbgl/mbgl.hpp> +#import <mbgl/map/view.hpp> #import <mbgl/annotation/annotation.hpp> #import <mbgl/map/camera.hpp> -#import <mbgl/platform/darwin/reachability.h> -#import <mbgl/platform/default/thread_pool.hpp> +#import <mbgl/storage/reachability.h> +#import <mbgl/util/default_thread_pool.hpp> #import <mbgl/gl/extension.hpp> -#import <mbgl/gl/gl.hpp> #import <mbgl/gl/context.hpp> #import <mbgl/map/backend.hpp> #import <mbgl/sprite/sprite_image.hpp> @@ -260,10 +259,8 @@ public: mbgl::DefaultFileSource* mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource; - const std::array<uint16_t, 2> size = {{ static_cast<uint16_t>(self.bounds.size.width), - static_cast<uint16_t>(self.bounds.size.height) }}; _mbglThreadPool = new mbgl::ThreadPool(4); - _mbglMap = new mbgl::Map(*_mbglView, size, [NSScreen mainScreen].backingScaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); + _mbglMap = new mbgl::Map(*_mbglView, self.size, [NSScreen mainScreen].backingScaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); [self validateTileCacheSize]; // Install the OpenGL layer. Interface Builder’s synchronous drawing means @@ -303,6 +300,16 @@ public: _pendingLongitude = NAN; } +- (mbgl::Size)size { + return { static_cast<uint32_t>(self.bounds.size.width), + static_cast<uint32_t>(self.bounds.size.height) }; +} + +- (mbgl::Size)framebufferSize { + NSRect bounds = [self convertRectToBacking:self.bounds]; + return { static_cast<uint32_t>(bounds.size.width), static_cast<uint32_t>(bounds.size.height) }; +} + /// Adds zoom controls to the lower-right corner. - (void)installZoomControls { _zoomControls = [[NSSegmentedControl alloc] initWithFrame:NSZeroRect]; @@ -671,8 +678,7 @@ public: [self validateTileCacheSize]; } if (!_isTargetingInterfaceBuilder) { - _mbglMap->setSize({{ static_cast<uint16_t>(self.bounds.size.width), - static_cast<uint16_t>(self.bounds.size.height) }}); + _mbglMap->setSize(self.size); } } @@ -2679,14 +2685,14 @@ public: } mbgl::gl::value::Viewport::Type getViewport() const { - return { 0, 0, static_cast<uint16_t>(nativeView.bounds.size.width), - static_cast<uint16_t>(nativeView.bounds.size.height) }; + return { 0, 0, nativeView.framebufferSize }; } void updateViewBinding() { fbo = mbgl::gl::value::BindFramebuffer::Get(); getContext().bindFramebuffer.setCurrentValue(fbo); getContext().viewport.setCurrentValue(getViewport()); + assert(mbgl::gl::value::Viewport::Get() == getContext().viewport.getCurrentValue()); } void bind() override { @@ -2695,23 +2701,7 @@ public: } mbgl::PremultipliedImage readStillImage() { - NSRect bounds = [nativeView convertRectToBacking:nativeView.bounds]; - const uint16_t width = bounds.size.width; - const uint16_t height = bounds.size.height; - mbgl::PremultipliedImage image{ width, height }; - MBGL_CHECK_ERROR( - glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image.data.get())); - - const size_t stride = image.stride(); - auto tmp = std::make_unique<uint8_t[]>(stride); - uint8_t *rgba = image.data.get(); - for (int i = 0, j = height - 1; i < j; i++, j--) { - std::memcpy(tmp.get(), rgba + i * stride, stride); - std::memcpy(rgba + i * stride, rgba + j * stride, stride); - std::memcpy(rgba + j * stride, tmp.get(), stride); - } - - return image; + return getContext().readFramebuffer<mbgl::PremultipliedImage>(nativeView.framebufferSize); } private: diff --git a/platform/macos/src/MGLMapView_Private.h b/platform/macos/src/MGLMapView_Private.h index f0a61773a9..0980252fb5 100644 --- a/platform/macos/src/MGLMapView_Private.h +++ b/platform/macos/src/MGLMapView_Private.h @@ -1,6 +1,6 @@ #import "MGLMapView.h" -#import <mbgl/mbgl.hpp> +#include <mbgl/map/map.hpp> @interface MGLMapView (Private) diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm index e8fa521351..296e30179b 100644 --- a/platform/macos/src/MGLOpenGLLayer.mm +++ b/platform/macos/src/MGLOpenGLLayer.mm @@ -2,8 +2,6 @@ #import "MGLMapView_Private.h" -#import <mbgl/gl/gl.hpp> - @implementation MGLOpenGLLayer - (MGLMapView *)mapView { diff --git a/platform/macos/src/NSImage+MGLAdditions.mm b/platform/macos/src/NSImage+MGLAdditions.mm index 9036ab24ae..72ddec83f7 100644 --- a/platform/macos/src/NSImage+MGLAdditions.mm +++ b/platform/macos/src/NSImage+MGLAdditions.mm @@ -21,8 +21,8 @@ NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:{ NSZeroPoint, self.size }]; [self unlockFocus]; - mbgl::PremultipliedImage cPremultipliedImage(rep.pixelsWide, rep.pixelsHigh); - std::copy(rep.bitmapData, rep.bitmapData + cPremultipliedImage.size(), cPremultipliedImage.data.get()); + mbgl::PremultipliedImage cPremultipliedImage({ static_cast<uint32_t>(rep.pixelsWide), static_cast<uint32_t>(rep.pixelsHigh) }); + std::copy(rep.bitmapData, rep.bitmapData + cPremultipliedImage.bytes(), cPremultipliedImage.data.get()); return std::make_unique<mbgl::SpriteImage>(std::move(cPremultipliedImage), (float)(rep.pixelsWide / self.size.width), [self isTemplate]); |