diff options
Diffstat (limited to 'platform/macos')
21 files changed, 172 insertions, 54 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index bc15b4667e..fe1a316fab 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,5 +1,12 @@ # 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)) +* Added a Simplified Chinese localization. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#7503](https://github.com/mapbox/mapbox-gl-native/pull/7503)) + ## 0.3.0 This version of the Mapbox macOS SDK corresponds to version 3.4.0 of the Mapbox iOS SDK. The two SDKs have very similar feature sets. The main differences are the lack of user location tracking and annotation views. Some APIs have been adapted to macOS conventions, particularly the use of NSPopover for callout views. diff --git a/platform/macos/DEVELOPING.md b/platform/macos/DEVELOPING.md index 823ad4656b..6737566a5c 100644 --- a/platform/macos/DEVELOPING.md +++ b/platform/macos/DEVELOPING.md @@ -54,6 +54,7 @@ To add any Objective-C type, constant, or member to the iOS SDK’s public inter To add an Objective-C class, protocol, category, typedef, enumeration, or global constant to the macOS SDK’s public interface: +1. _(Optional.)_ Add the macro `MGL_EXPORT` prior to the declaration for classes and global constants. To use this macro, include `MGLFoundation.h`. You can check whether all public symbols are exported correctly by running `make check-public-symbols`. 1. _(Optional.)_ Add the type or constant’s name to the relevant category in the `custom_categories` section of [the jazzy configuration file](./jazzy.yml). This is required for classes and protocols and also recommended for any other type that is strongly associated with a particular class or protocol. If you leave out this step, the symbol will appear in an “Other” section in the generated HTML documentation’s table of contents. 1. _(Optional.)_ If the symbol would also be publicly exposed in the iOS SDK, consult [the companion iOS document](../ios/DEVELOPING.md#making-a-type-or-constant-public) for further instructions. 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..2e4b7a01b2 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -1,9 +1,10 @@ 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) @@ -16,6 +17,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 +31,41 @@ 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 + PRIVATE -fvisibility=hidden ) target_include_directories(mbgl-core - PRIVATE platform/default + PUBLIC platform/darwin + PUBLIC platform/default ) target_link_libraries(mbgl-core @@ -106,6 +120,10 @@ macro(mbgl_platform_test) COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}" ) + target_compile_options(mbgl-test + PRIVATE -fvisibility=hidden + ) + target_link_libraries(mbgl-test PRIVATE mbgl-loop PRIVATE "-framework Foundation" @@ -118,6 +136,10 @@ macro(mbgl_platform_test) endmacro() macro(mbgl_platform_benchmark) + target_compile_options(mbgl-benchmark + PRIVATE -fvisibility=hidden + ) + target_sources(mbgl-benchmark PRIVATE benchmark/src/main.cpp ) @@ -140,8 +162,13 @@ macro(mbgl_platform_benchmark) endmacro() macro(mbgl_platform_node) + target_compile_options(mbgl-node + PRIVATE -fvisibility=hidden + ) + 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 e31bd7fa01..fc9e0c74e1 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -59,6 +59,8 @@ 40E1601D1DF217D6005EA6D9 /* MGLStyleLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E1601B1DF216E6005EA6D9 /* MGLStyleLayerTests.m */; }; 52BECB0A1CC5A26F009CD791 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */; }; 5548BE781D09E718005DDE81 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; + 556660C61E1BEA0100E2C41B /* MGLFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 556660C51E1BEA0100E2C41B /* MGLFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 556660D61E1D07E400E2C41B /* MGLVersionNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */; }; 558F18221D0B13B100123F46 /* libmbgl-loop.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 558F18211D0B13B000123F46 /* libmbgl-loop.a */; }; 55D9B4B11D005D3900C1CCE2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 55D9B4B01D005D3900C1CCE2 /* libz.tbd */; }; DA00FC8A1D5EEAC3009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -124,6 +126,7 @@ DA8F259C1D51CB000010E6B5 /* MGLStyleValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F259B1D51CB000010E6B5 /* MGLStyleValue_Private.h */; }; DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */; }; DA8F25B31D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */; }; + DAA1BB4A1E2D425C00ABB750 /* libmbgl-loop.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAA1BB491E2D425C00ABB750 /* libmbgl-loop.a */; }; DAA48EFD1D6A4731006A7E36 /* StyleLayerIconTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = DAA48EFC1D6A4731006A7E36 /* StyleLayerIconTransformer.m */; }; DAB2CCE51DF632ED001B2FE1 /* LimeGreenStyleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DAB2CCE41DF632ED001B2FE1 /* LimeGreenStyleLayer.m */; }; DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */; }; @@ -308,6 +311,8 @@ 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 5548BE791D0ACBB2005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = "<group>"; }; 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = "<group>"; }; + 556660C51E1BEA0100E2C41B /* MGLFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLFoundation.h; sourceTree = "<group>"; }; + 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLVersionNumber.m; path = ../../darwin/test/MGLVersionNumber.m; sourceTree = "<group>"; }; 558F18211D0B13B000123F46 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/osx/Debug/libmbgl-loop.a"; sourceTree = "<group>"; }; 55D9B4B01D005D3900C1CCE2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 55FE0E8D1D100A0900FD240B /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/macos/config.xcconfig; sourceTree = "<group>"; }; @@ -354,6 +359,8 @@ DA87A9971DC9D88400810D09 /* MGLTileSetTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTileSetTests.mm; sourceTree = "<group>"; }; DA87A99B1DC9D8DD00810D09 /* MGLShapeSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeSource_Private.h; sourceTree = "<group>"; }; DA87A99F1DC9DC6200810D09 /* MGLValueEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLValueEvaluator.h; sourceTree = "<group>"; }; + DA88520F1E0A4D0D009D7AD6 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; }; + DA8852101E0A4D3A009D7AD6 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Foundation.strings"; sourceTree = "<group>"; }; DA8933A61CCD287300E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MGLAnnotationCallout.xib; sourceTree = "<group>"; }; DA8933AC1CCD290700E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; }; DA8933B41CCD2C2500E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Foundation.strings; sourceTree = "<group>"; }; @@ -381,6 +388,7 @@ DA8F25B51D51D2240010E6B5 /* MGLStyleLayerTests.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; name = MGLStyleLayerTests.mm.ejs; path = ../test/MGLStyleLayerTests.mm.ejs; sourceTree = "<group>"; }; DA8F25B61D51D2240010E6B5 /* MGLStyleLayer.h.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.h.ejs; sourceTree = "<group>"; }; DA8F25B71D51D2240010E6B5 /* MGLStyleLayer.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.mm.ejs; sourceTree = "<group>"; }; + DAA1BB491E2D425C00ABB750 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/macos/Debug/libmbgl-loop.a"; sourceTree = "<group>"; }; DAA48EFB1D6A4731006A7E36 /* StyleLayerIconTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleLayerIconTransformer.h; sourceTree = "<group>"; }; DAA48EFC1D6A4731006A7E36 /* StyleLayerIconTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StyleLayerIconTransformer.m; sourceTree = "<group>"; }; DAB2CCE31DF632ED001B2FE1 /* LimeGreenStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LimeGreenStyleLayer.h; sourceTree = "<group>"; }; @@ -512,6 +520,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DAA1BB4A1E2D425C00ABB750 /* libmbgl-loop.a in Frameworks */, DAE0DD7A1D5F015A005A6BB1 /* libmbgl-core.a in Frameworks */, DAE6C3321CC30DB200DB3429 /* Mapbox.framework in Frameworks */, ); @@ -842,6 +851,7 @@ DAE6C31E1CC308BC00DB3429 /* Frameworks */ = { isa = PBXGroup; children = ( + DAA1BB491E2D425C00ABB750 /* libmbgl-loop.a */, 558F18211D0B13B000123F46 /* libmbgl-loop.a */, 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */, 5548BE791D0ACBB2005DDE81 /* libmbgl-loop-darwin.a */, @@ -889,6 +899,7 @@ DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */, 35C5D84B1D6DD75B00E95907 /* MGLPredicateTests.mm */, DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */, + 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */, DAE6C33A1CC30DB200DB3429 /* Info.plist */, DA2784FD1DF03060001D5B8D /* Media.xcassets */, DA35D0891E1A631B007DED41 /* one-liner.json */, @@ -911,6 +922,7 @@ DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */, DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */, DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */, + 556660C51E1BEA0100E2C41B /* MGLFoundation.h */, DAE6C34D1CC31E0400DB3429 /* MGLMapCamera.h */, DAE6C36E1CC31E2A00DB3429 /* MGLMapCamera.mm */, DD0902B01DB1AC6400C5BDCE /* MGLNetworkConfiguration.h */, @@ -965,6 +977,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 556660C61E1BEA0100E2C41B /* MGLFoundation.h in Headers */, DA8F258F1D51CA600010E6B5 /* MGLRasterStyleLayer.h in Headers */, 3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */, DAE6C38D1CC31E2A00DB3429 /* MGLOfflineRegion_Private.h in Headers */, @@ -1163,6 +1176,7 @@ knownRegions = ( en, Base, + "zh-Hans", ); mainGroup = DA839E891CC2E3400062CAFB; productRefGroup = DA839E931CC2E3400062CAFB /* Products */; @@ -1333,6 +1347,7 @@ 3599A3E81DF70E2000E77FB2 /* MGLStyleValueTests.m in Sources */, DAEDC4321D6033F1000224FF /* MGLAttributionInfoTests.m in Sources */, DA0CD58E1CF56F5800A5F5A5 /* MGLFeatureTests.mm in Sources */, + 556660D61E1D07E400E2C41B /* MGLVersionNumber.m in Sources */, DA2207BC1DC076940002F84D /* MGLStyleValueTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1381,6 +1396,7 @@ isa = PBXVariantGroup; children = ( DA8933AC1CCD290700E68420 /* Base */, + DA88520F1E0A4D0D009D7AD6 /* zh-Hans */, ); name = Localizable.strings; sourceTree = "<group>"; @@ -1389,6 +1405,7 @@ isa = PBXVariantGroup; children = ( DA8933B41CCD2C2500E68420 /* Base */, + DA8852101E0A4D3A009D7AD6 /* zh-Hans */, ); name = Foundation.strings; sourceTree = "<group>"; @@ -1408,6 +1425,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; @@ -1454,6 +1472,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; @@ -1496,6 +1515,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; }; @@ -1508,6 +1528,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; }; @@ -1556,6 +1577,7 @@ INFOPLIST_FILE = "$(SRCROOT)/sdk/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_LDFLAGS = ( "$(mbgl_core_LINK_LIBRARIES)", "$(mbgl_loop_LINK_LIBRARIES)", @@ -1564,7 +1586,7 @@ PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Debug; }; @@ -1574,7 +1596,9 @@ 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"; @@ -1586,6 +1610,7 @@ INFOPLIST_FILE = "$(SRCROOT)/sdk/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_LDFLAGS = ( "$(mbgl_core_LINK_LIBRARIES)", "$(mbgl_loop_LINK_LIBRARIES)", @@ -1593,8 +1618,9 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; + STRIP_STYLE = "non-global"; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Release; }; @@ -1607,6 +1633,7 @@ HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "$(variant_cflags)", @@ -1630,6 +1657,7 @@ HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "$(variant_cflags)", 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/scripts/package.sh b/platform/macos/scripts/package.sh index f8c24a17fa..6ae0cc65cc 100755 --- a/platform/macos/scripts/package.sh +++ b/platform/macos/scripts/package.sh @@ -88,3 +88,6 @@ sed -n -e '/^## /,$p' platform/macos/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md" step "Generating API documentation…" make xdocument OUTPUT="${OUTPUT}/documentation" + +step "Checking that all public symbols are exported…" +node platform/darwin/scripts/check-public-symbols.js macOS diff --git a/platform/macos/sdk/zh-Hans.lproj/Localizable.strings b/platform/macos/sdk/zh-Hans.lproj/Localizable.strings new file mode 100644 index 0000000000..40b61a2dba --- /dev/null +++ b/platform/macos/sdk/zh-Hans.lproj/Localizable.strings @@ -0,0 +1,15 @@ +/* Accessibility title */ +"MAP_A11Y_TITLE" = "Mapbox"; + +/* Label of Zoom In button */ +"ZOOM_IN_LABEL" = "+"; + +/* Tooltip of Zoom In button */ +"ZOOM_IN_TOOLTIP" = "放大"; + +/* Label of Zoom Out button; U+2212 MINUS SIGN */ +"ZOOM_OUT_LABEL" = "−"; + +/* Tooltip of Zoom Out button */ +"ZOOM_OUT_TOOLTIP" = "缩小"; + diff --git a/platform/macos/src/MGLAnnotationImage.h b/platform/macos/src/MGLAnnotationImage.h index 2738ea654c..0f248c721c 100644 --- a/platform/macos/src/MGLAnnotationImage.h +++ b/platform/macos/src/MGLAnnotationImage.h @@ -1,5 +1,7 @@ #import <AppKit/AppKit.h> +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -8,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN `NSImage` objects with annotation-related metadata. They may be recycled later and put into a reuse queue that is maintained by the map view. */ +MGL_EXPORT @interface MGLAnnotationImage : NSObject <NSSecureCoding> #pragma mark Initializing and Preparing the Image Object diff --git a/platform/macos/src/MGLAttributionButton.h b/platform/macos/src/MGLAttributionButton.h index 88fcdadf78..3e0b53a6d0 100644 --- a/platform/macos/src/MGLAttributionButton.h +++ b/platform/macos/src/MGLAttributionButton.h @@ -1,5 +1,6 @@ #import <Cocoa/Cocoa.h> +#import "MGLFoundation.h" #import "MGLTypes.h" NS_ASSUME_NONNULL_BEGIN @@ -7,6 +8,7 @@ NS_ASSUME_NONNULL_BEGIN @class MGLAttributionInfo; /// Button that looks like a hyperlink and opens a URL. +MGL_EXPORT @interface MGLAttributionButton : NSButton /// Returns an `MGLAttributionButton` instance with the given info. diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index 954e5a2c75..efe83d1573 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -1,6 +1,7 @@ #import <Cocoa/Cocoa.h> #import <CoreLocation/CoreLocation.h> +#import "MGLFoundation.h" #import "MGLTypes.h" #import "MGLGeometry.h" @@ -47,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN @note You are responsible for getting permission to use the map data and for ensuring that your use adheres to the relevant terms of use. */ -IB_DESIGNABLE +MGL_EXPORT IB_DESIGNABLE @interface MGLMapView : NSView #pragma mark Creating Instances diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 7bd8f3369e..0db059dcf2 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -19,13 +19,13 @@ #import "MGLAnnotationImage.h" #import "MGLMapViewDelegate.h" -#import <mbgl/mbgl.hpp> +#import <mbgl/map/map.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 +260,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 +301,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]; @@ -677,8 +685,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); } } @@ -2664,14 +2671,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 { @@ -2680,23 +2687,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/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/Mapbox.h b/platform/macos/src/Mapbox.h index 5b3be3ea67..1f30497184 100644 --- a/platform/macos/src/Mapbox.h +++ b/platform/macos/src/Mapbox.h @@ -1,10 +1,12 @@ #import <Cocoa/Cocoa.h> +#import "MGLFoundation.h" + /// Project version number for Mapbox. -FOUNDATION_EXPORT double MapboxVersionNumber; +FOUNDATION_EXPORT MGL_EXPORT double MapboxVersionNumber; /// Project version string for Mapbox. -FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; +FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLAccountManager.h" #import "MGLAnnotation.h" diff --git a/platform/macos/src/NSImage+MGLAdditions.mm b/platform/macos/src/NSImage+MGLAdditions.mm index e8e84f0a03..9c30d3c37b 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]); |