From 06e142631247cd0fe0f38d598c0f55aea0a14936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 3 Jan 2017 15:56:55 +0100 Subject: [PATCH 1/3] [build] add -fvisibility=hidden to macOS dynamic framework and export required symbols --- platform/darwin/src/MGLAccountManager.h | 3 +++ platform/darwin/src/MGLAttributionInfo.h | 2 ++ platform/darwin/src/MGLBackgroundStyleLayer.h | 2 ++ platform/darwin/src/MGLCircleStyleLayer.h | 2 ++ .../darwin/src/MGLClockDirectionFormatter.h | 3 +++ .../darwin/src/MGLCompassDirectionFormatter.h | 3 +++ platform/darwin/src/MGLCoordinateFormatter.h | 3 +++ platform/darwin/src/MGLFeature.h | 8 +++++++ platform/darwin/src/MGLFeature_Private.h | 2 ++ platform/darwin/src/MGLFillStyleLayer.h | 2 ++ platform/darwin/src/MGLForegroundStyleLayer.h | 2 ++ platform/darwin/src/MGLFoundation.h | 5 ++++ platform/darwin/src/MGLGeometry.h | 4 +++- platform/darwin/src/MGLGeometry.mm | 4 ++++ platform/darwin/src/MGLLineStyleLayer.h | 2 ++ platform/darwin/src/MGLMapCamera.h | 3 +++ platform/darwin/src/MGLMultiPoint.h | 2 ++ platform/darwin/src/MGLOfflinePack.h | 2 ++ platform/darwin/src/MGLOfflineStorage.h | 24 ++++++++++--------- platform/darwin/src/MGLOpenGLStyleLayer.h | 2 ++ platform/darwin/src/MGLPointAnnotation.h | 2 ++ platform/darwin/src/MGLPointCollection.h | 2 ++ platform/darwin/src/MGLPolygon.h | 3 +++ platform/darwin/src/MGLPolyline.h | 3 +++ platform/darwin/src/MGLRasterSource.h | 8 ++++--- platform/darwin/src/MGLRasterStyleLayer.h | 2 ++ platform/darwin/src/MGLShape.h | 2 ++ platform/darwin/src/MGLShapeCollection.h | 2 ++ platform/darwin/src/MGLShapeSource.h | 14 ++++++----- platform/darwin/src/MGLShapeSource_Private.h | 3 ++- platform/darwin/src/MGLSource.h | 3 +++ platform/darwin/src/MGLStyle.h | 4 +++- platform/darwin/src/MGLStyleLayer.h | 2 ++ platform/darwin/src/MGLStyleLayer.h.ejs | 2 ++ platform/darwin/src/MGLStyleValue.h | 5 ++++ platform/darwin/src/MGLSymbolStyleLayer.h | 2 ++ .../darwin/src/MGLTilePyramidOfflineRegion.h | 2 ++ platform/darwin/src/MGLTileSource.h | 16 +++++++------ platform/darwin/src/MGLTileSource_Private.h | 6 +++-- platform/darwin/src/MGLTypes.h | 4 +++- platform/darwin/src/MGLVectorSource.h | 2 ++ platform/darwin/src/MGLVectorStyleLayer.h | 2 ++ platform/darwin/test/MGLVersionNumber.m | 15 ++++++++++++ platform/ios/ios.xcodeproj/project.pbxproj | 16 +++++++++++-- platform/ios/src/Mapbox.h | 6 +++-- platform/macos/config.cmake | 21 ++++++++-------- .../macos/macos.xcodeproj/project.pbxproj | 18 ++++++++++---- platform/macos/src/MGLAnnotationImage.h | 3 +++ platform/macos/src/MGLAttributionButton.h | 2 ++ platform/macos/src/MGLMapView.h | 3 ++- platform/macos/src/Mapbox.h | 6 +++-- 51 files changed, 207 insertions(+), 54 deletions(-) create mode 100644 platform/darwin/src/MGLFoundation.h create mode 100644 platform/darwin/test/MGLVersionNumber.m diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h index fe602aa2109..c1aebd879cc 100644 --- a/platform/darwin/src/MGLAccountManager.h +++ b/platform/darwin/src/MGLAccountManager.h @@ -1,11 +1,14 @@ #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** The MGLAccountManager object provides a global way to set a Mapbox API access token. */ +MGL_EXPORT @interface MGLAccountManager : NSObject #pragma mark Authorizing Access diff --git a/platform/darwin/src/MGLAttributionInfo.h b/platform/darwin/src/MGLAttributionInfo.h index 7395e3f346c..28b4fe50e62 100644 --- a/platform/darwin/src/MGLAttributionInfo.h +++ b/platform/darwin/src/MGLAttributionInfo.h @@ -2,6 +2,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLTypes.h" NS_ASSUME_NONNULL_BEGIN @@ -10,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN Information about an attribution statement, usually a copyright or trademark statement, associated with a map content source. */ +MGL_EXPORT @interface MGLAttributionInfo : NSObject /** diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 656e104bbbc..e0773d14d95 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLStyleLayer.h" @@ -12,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN `style` and obtain the background layer using the `-[MGLStyle layerWithIdentifier:]` method and passing `background` for the identifier. */ +MGL_EXPORT @interface MGLBackgroundStyleLayer : MGLStyleLayer - (instancetype)initWithIdentifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER; diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 8c95b721232..17ac3e58810 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" @@ -44,6 +45,7 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { `MGLMapView` for its `style` and obtain existing layers using the `-[MGLStyle layerWithIdentifier:]` method. */ +MGL_EXPORT @interface MGLCircleStyleLayer : MGLVectorStyleLayer #pragma mark - Accessing the Paint Attributes diff --git a/platform/darwin/src/MGLClockDirectionFormatter.h b/platform/darwin/src/MGLClockDirectionFormatter.h index ea427aa7b1b..a428f51c639 100644 --- a/platform/darwin/src/MGLClockDirectionFormatter.h +++ b/platform/darwin/src/MGLClockDirectionFormatter.h @@ -1,6 +1,8 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -14,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` instead. */ +MGL_EXPORT @interface MGLClockDirectionFormatter : NSFormatter /** diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.h b/platform/darwin/src/MGLCompassDirectionFormatter.h index fde26ba42ad..714e1cc0355 100644 --- a/platform/darwin/src/MGLCompassDirectionFormatter.h +++ b/platform/darwin/src/MGLCompassDirectionFormatter.h @@ -1,6 +1,8 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -12,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN irrespective of the user’s current location. To format a direction relative to the user’s current location, use `MGLClockDirectionFormatter` instead. */ +MGL_EXPORT @interface MGLCompassDirectionFormatter : NSFormatter /** diff --git a/platform/darwin/src/MGLCoordinateFormatter.h b/platform/darwin/src/MGLCoordinateFormatter.h index 909c1e8935c..c42c196d5a3 100644 --- a/platform/darwin/src/MGLCoordinateFormatter.h +++ b/platform/darwin/src/MGLCoordinateFormatter.h @@ -1,6 +1,8 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -8,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN geographic coordinate pairs. Use this class to create localized coordinate strings when displaying location information to users. */ +MGL_EXPORT @interface MGLCoordinateFormatter : NSFormatter /** diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index ed4ff627b9c..b3a1868ed20 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLPolyline.h" #import "MGLPolygon.h" #import "MGLPointAnnotation.h" @@ -117,6 +118,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLPointFeature` class represents a point in a tile source. */ +MGL_EXPORT @interface MGLPointFeature : MGLPointAnnotation @end @@ -124,6 +126,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLPolylineFeature` class represents a polyline in a tile source. */ +MGL_EXPORT @interface MGLPolylineFeature : MGLPolyline @end @@ -131,6 +134,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLPolygonFeature` class represents a polygon in a tile source. */ +MGL_EXPORT @interface MGLPolygonFeature : MGLPolygon @end @@ -138,6 +142,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLPointCollectionFeature` class represents a multipoint in a tile source. */ +MGL_EXPORT @interface MGLPointCollectionFeature : MGLPointCollection @end @@ -145,6 +150,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLMultiPolylineFeature` class represents a multipolyline in a tile source. */ +MGL_EXPORT @interface MGLMultiPolylineFeature : MGLMultiPolyline @end @@ -152,6 +158,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLMultiPolygonFeature` class represents a multipolygon in a tile source. */ +MGL_EXPORT @interface MGLMultiPolygonFeature : MGLMultiPolygon @end @@ -159,6 +166,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLShapeCollectionFeature` class represents a shape collection in a tile source. */ +MGL_EXPORT @interface MGLShapeCollectionFeature : MGLShapeCollection @property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLShape *) *shapes; diff --git a/platform/darwin/src/MGLFeature_Private.h b/platform/darwin/src/MGLFeature_Private.h index 97af509893a..59c5ab86115 100644 --- a/platform/darwin/src/MGLFeature_Private.h +++ b/platform/darwin/src/MGLFeature_Private.h @@ -1,3 +1,4 @@ +#import "MGLFoundation.h" #import "MGLFeature.h" #import "MGLShape.h" @@ -11,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN Returns an array of `MGLFeature` objects converted from the given vector of vector tile features. */ +MGL_EXPORT NS_ARRAY_OF(MGLShape *) *MGLFeaturesFromMBGLFeatures(const std::vector &features); /** diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index cf8c18b5c27..c586ce413b7 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" @@ -28,6 +29,7 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { `MGLMapView` for its `style` and obtain existing layers using the `-[MGLStyle layerWithIdentifier:]` method. */ +MGL_EXPORT @interface MGLFillStyleLayer : MGLVectorStyleLayer #pragma mark - Accessing the Paint Attributes diff --git a/platform/darwin/src/MGLForegroundStyleLayer.h b/platform/darwin/src/MGLForegroundStyleLayer.h index 642dde49925..474e1f63078 100644 --- a/platform/darwin/src/MGLForegroundStyleLayer.h +++ b/platform/darwin/src/MGLForegroundStyleLayer.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -14,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN subclasses of this class. Instead, create instances of `MGLRasterStyleLayer` and the concrete subclasses of `MGLVectorStyleLayer`. */ +MGL_EXPORT @interface MGLForegroundStyleLayer : MGLStyleLayer #pragma mark Initializing a Style Layer diff --git a/platform/darwin/src/MGLFoundation.h b/platform/darwin/src/MGLFoundation.h new file mode 100644 index 00000000000..3400c63979f --- /dev/null +++ b/platform/darwin/src/MGLFoundation.h @@ -0,0 +1,5 @@ +#pragma once + +#import + +#define MGL_EXPORT __attribute__((visibility ("default"))) diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h index 8e36b86d960..408bdb26326 100644 --- a/platform/darwin/src/MGLGeometry.h +++ b/platform/darwin/src/MGLGeometry.h @@ -2,6 +2,8 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** Defines the area spanned by an `MGLCoordinateBounds`. */ @@ -33,7 +35,7 @@ NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, M } /** An area of zero width and zero height. */ -extern const MGLCoordinateSpan MGLCoordinateSpanZero; +extern MGL_EXPORT const MGLCoordinateSpan MGLCoordinateSpanZero; /** A rectangular area as measured on a two-dimensional map projection. */ typedef struct MGLCoordinateBounds { diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm index 57922e30b9d..36e096dd039 100644 --- a/platform/darwin/src/MGLGeometry.mm +++ b/platform/darwin/src/MGLGeometry.mm @@ -1,5 +1,7 @@ #import "MGLGeometry_Private.h" +#import "MGLFoundation.h" + #import /** Vertical field of view, measured in degrees, for determining the altitude @@ -30,6 +32,7 @@ CGRect MGLExtendRect(CGRect rect, CGPoint point) { return rect; } +MGL_EXPORT CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLocationDegrees latitude, CGSize size) { CLLocationDistance metersPerPixel = mbgl::Projection::getMetersPerPixelAtLatitude(latitude, zoomLevel); CLLocationDistance metersTall = metersPerPixel * size.height; @@ -37,6 +40,7 @@ CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLo return altitude * std::sin(M_PI_2 - MGLRadiansFromDegrees(pitch)) / std::sin(M_PI_2); } +MGL_EXPORT double MGLZoomLevelForAltitude(CLLocationDistance altitude, CGFloat pitch, CLLocationDegrees latitude, CGSize size) { CLLocationDistance eyeAltitude = altitude / std::sin(M_PI_2 - MGLRadiansFromDegrees(pitch)) * std::sin(M_PI_2); CLLocationDistance metersTall = eyeAltitude * 2 * std::tan(MGLRadiansFromDegrees(MGLAngularFieldOfView) / 2.); diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index c47c7d51660..6df0d38088c 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" @@ -68,6 +69,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { `MGLMapView` for its `style` and obtain existing layers using the `-[MGLStyle layerWithIdentifier:]` method. */ +MGL_EXPORT @interface MGLLineStyleLayer : MGLVectorStyleLayer #pragma mark - Accessing the Layout Attributes diff --git a/platform/darwin/src/MGLMapCamera.h b/platform/darwin/src/MGLMapCamera.h index f6bff36280d..3d492656af9 100644 --- a/platform/darwin/src/MGLMapCamera.h +++ b/platform/darwin/src/MGLMapCamera.h @@ -2,12 +2,15 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** An `MGLMapCamera` object represents a viewpoint from which the user observes some point on an `MGLMapView`. */ +MGL_EXPORT @interface MGLMapCamera : NSObject /** Coordinate at the center of the map view. */ diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h index ed40ee9cad2..eaac50af460 100644 --- a/platform/darwin/src/MGLMultiPoint.h +++ b/platform/darwin/src/MGLMultiPoint.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLShape.h" NS_ASSUME_NONNULL_BEGIN @@ -12,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN `MGLPolygon` classes. However, you can use the method and properties of this class to access information about the vertices of the line or polygon. */ +MGL_EXPORT @interface MGLMultiPoint : MGLShape /** diff --git a/platform/darwin/src/MGLOfflinePack.h b/platform/darwin/src/MGLOfflinePack.h index a14d001d0f4..de76228ff02 100644 --- a/platform/darwin/src/MGLOfflinePack.h +++ b/platform/darwin/src/MGLOfflinePack.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLOfflineRegion.h" NS_ASSUME_NONNULL_BEGIN @@ -100,6 +101,7 @@ typedef struct MGLOfflinePackProgress { `+[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method. A pack created using `-[MGLOfflinePack init]` is immediately invalid. */ +MGL_EXPORT @interface MGLOfflinePack : NSObject /** diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index b3fb7a2d54b..9557258b419 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLTypes.h" NS_ASSUME_NONNULL_BEGIN @@ -24,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN alternatively observe KVO change notifications to the pack’s `progress` key path. */ -extern const NSNotificationName MGLOfflinePackProgressChangedNotification; +extern MGL_EXPORT const NSNotificationName MGLOfflinePackProgressChangedNotification; /** Posted by the shared `MGLOfflineStorage` object whenever an `MGLOfflinePack` @@ -37,7 +38,7 @@ extern const NSNotificationName MGLOfflinePackProgressChangedNotification; `userInfo` dictionary contains the error object in the `MGLOfflinePackErrorUserInfoKey` key. */ -extern const NSNotificationName MGLOfflinePackErrorNotification; +extern MGL_EXPORT const NSNotificationName MGLOfflinePackErrorNotification; /** Posted by the shared `MGLOfflineStorage` object when the maximum number of @@ -52,7 +53,7 @@ extern const NSNotificationName MGLOfflinePackErrorNotification; calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. Contact your Mapbox sales representative to have the limit raised. */ -extern const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification; +extern MGL_EXPORT const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification; /** A key in the `userInfo` property of a notification posted by `MGLOfflinePack`. @@ -65,9 +66,9 @@ typedef NSString *MGLOfflinePackUserInfoKey NS_EXTENSIBLE_STRING_ENUM; `MGLOfflinePackProgressChangedNotification` notification. Call `-integerValue` on the object to receive the `MGLOfflinePackState`-typed state. */ -extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState; +extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState; -extern NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState"))); +extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState"))); /** The key for an `NSValue` object that indicates an offline pack’s current @@ -76,9 +77,9 @@ extern NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated `-MGLOfflinePackProgressValue` on the object to receive the `MGLOfflinePackProgress`-typed progress. */ -extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress; +extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress; -extern NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress"))); +extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress"))); /** The key for an `NSError` object that is encountered in the course of @@ -86,9 +87,9 @@ extern NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((depreca an `MGLOfflinePackErrorNotification` notification. The error’s domain is `MGLErrorDomain`. See `MGLErrorCode` for possible error codes. */ -extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError; +extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError; -extern NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError"))); +extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError"))); /** The key for an `NSNumber` object that indicates the maximum number of @@ -98,9 +99,9 @@ extern NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated `-unsignedLongLongValue` on the object to receive the `uint64_t`-typed tile limit. */ -extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount; +extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount; -extern NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount"))); +extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount"))); /** A block to be called once an offline pack has been completely created and @@ -135,6 +136,7 @@ typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error fact that offline resources are stored in a database. The shared object maintains a canonical collection of offline packs in its `packs` property. */ +MGL_EXPORT @interface MGLOfflineStorage : NSObject /** diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.h b/platform/darwin/src/MGLOpenGLStyleLayer.h index 8fbbd91854d..de4fc92b170 100644 --- a/platform/darwin/src/MGLOpenGLStyleLayer.h +++ b/platform/darwin/src/MGLOpenGLStyleLayer.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLStyleLayer.h" @@ -17,6 +18,7 @@ typedef struct MGLStyleLayerDrawingContext { CGFloat fieldOfView; } MGLStyleLayerDrawingContext; +MGL_EXPORT @interface MGLOpenGLStyleLayer : MGLStyleLayer @property (nonatomic, weak, readonly) MGLMapView *mapView; diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h index b552912f971..6b2e1dd43a1 100644 --- a/platform/darwin/src/MGLPointAnnotation.h +++ b/platform/darwin/src/MGLPointAnnotation.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLShape.h" NS_ASSUME_NONNULL_BEGIN @@ -11,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN situations where all you want to do is associate a point on the map with a title. */ +MGL_EXPORT @interface MGLPointAnnotation : MGLShape /** diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h index 95af9dae5e5..e090c60b100 100644 --- a/platform/darwin/src/MGLPointCollection.h +++ b/platform/darwin/src/MGLPointCollection.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLOverlay.h" #import "MGLShape.h" @@ -15,6 +16,7 @@ to the map view's style, the point collection represents as a group of distinct annotations. */ +MGL_EXPORT @interface MGLPointCollection : MGLShape /** diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h index b9ec6b83996..57402326d51 100644 --- a/platform/darwin/src/MGLPolygon.h +++ b/platform/darwin/src/MGLPolygon.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLMultiPoint.h" #import "MGLOverlay.h" @@ -14,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN are provided. The first and last points are connected to each other to create the closed shape. */ +MGL_EXPORT @interface MGLPolygon : MGLMultiPoint /** @@ -64,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN @note `MGLMultiPolygon` objects cannot be added to a map view using `-[MGLMapView addAnnotations:]` and related methods. */ +MGL_EXPORT @interface MGLMultiPolygon : MGLShape /** diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h index cb98df9a1bb..dfc471bae98 100644 --- a/platform/darwin/src/MGLPolyline.h +++ b/platform/darwin/src/MGLPolyline.h @@ -1,6 +1,7 @@ #import #import +#import "MGLFoundation.h" #import "MGLMultiPoint.h" #import "MGLOverlay.h" @@ -14,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN the order they are provided. The first and last points are not connected to each other. */ +MGL_EXPORT @interface MGLPolyline : MGLMultiPoint /** @@ -39,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN @note `MGLMultiPolyline` objects cannot be added to a map view using `-[MGLMapView addAnnotations:]` and related methods. */ +MGL_EXPORT @interface MGLMultiPolyline : MGLShape /** diff --git a/platform/darwin/src/MGLRasterSource.h b/platform/darwin/src/MGLRasterSource.h index 262e8f2ce15..80b740692c4 100644 --- a/platform/darwin/src/MGLRasterSource.h +++ b/platform/darwin/src/MGLRasterSource.h @@ -1,7 +1,8 @@ -#import "MGLTileSource.h" - #import +#import "MGLFoundation.h" +#import "MGLTileSource.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -18,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN This option is only applicable to `MGLRasterSource` objects; it is ignored when initializing `MGLVectorSource` objects. */ -extern const MGLTileSourceOption MGLTileSourceOptionTileSize; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize; /** `MGLRasterSource` is a map content source that supplies raster image tiles to @@ -36,6 +37,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionTileSize; can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. */ +MGL_EXPORT @interface MGLRasterSource : MGLTileSource #pragma mark Initializing a Source diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index def5221d623..1bdff12466e 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLForegroundStyleLayer.h" @@ -12,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN `MGLMapView` for its `style` and obtain existing layers using the `-[MGLStyle layerWithIdentifier:]` method. */ +MGL_EXPORT @interface MGLRasterStyleLayer : MGLForegroundStyleLayer #pragma mark - Accessing the Paint Attributes diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h index af815da0e98..cc545d783fe 100644 --- a/platform/darwin/src/MGLShape.h +++ b/platform/darwin/src/MGLShape.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLAnnotation.h" NS_ASSUME_NONNULL_BEGIN @@ -11,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN and providing an appropriate value for the coordinate property inherited from the `MGLAnnotation` protocol. */ +MGL_EXPORT @interface MGLShape : NSObject #pragma mark Creating a Shape diff --git a/platform/darwin/src/MGLShapeCollection.h b/platform/darwin/src/MGLShapeCollection.h index a617223ea75..dfad080de28 100644 --- a/platform/darwin/src/MGLShapeCollection.h +++ b/platform/darwin/src/MGLShapeCollection.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLShape.h" #import "MGLTypes.h" @@ -14,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN @note `MGLShapeCollection` objects cannot be added to a map view using `-[MGLMapView addAnnotations:]` and related methods. */ +MGL_EXPORT @interface MGLShapeCollection : MGLShape /** diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h index 68cb40a83f8..7bd85c8d1f8 100644 --- a/platform/darwin/src/MGLShapeSource.h +++ b/platform/darwin/src/MGLShapeSource.h @@ -1,5 +1,6 @@ #import "MGLSource.h" +#import "MGLFoundation.h" #import "MGLTypes.h" #import "MGLShape.h" @@ -17,14 +18,14 @@ typedef NSString *MGLShapeSourceOption NS_STRING_ENUM; If the `shape` property contains point shapes, setting this option to `YES` clusters the points by radius into groups. The default value is `NO`. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionClustered; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClustered; /** An `NSNumber` object containing an integer; specifies the radius of each cluster if clustering is enabled. A value of 512 produces a radius equal to the width of a tile. The default value is 50. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius; /** An `NSNumber` object containing an integer; specifies the maximum zoom level at @@ -32,14 +33,14 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius; less than the value of `MGLShapeSourceOptionMaximumZoomLevel` so that, at the maximum zoom level, the shapes are not clustered. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering; /** An `NSNumber` object containing an integer; specifies the maximum zoom level at which to create vector tiles. A greater value produces greater detail at high zoom levels. The default value is 18. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel; /** An `NSNumber` object containing an integer; specifies the size of the tile @@ -47,14 +48,14 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel; buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance. The default value is 128. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionBuffer; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionBuffer; /** An `NSNumber` object containing a double; specifies the Douglas-Peucker simplification tolerance. A greater value produces simpler geometries and improves performance. The default value is 0.375. */ -extern const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance; +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance; /** `MGLShapeSource` is a map content source that supplies vector shapes to be @@ -75,6 +76,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance; Any vector style layer initialized with a shape source should have a `nil` value in its `sourceLayerIdentifier` property. */ +MGL_EXPORT @interface MGLShapeSource : MGLSource #pragma mark Initializing a Source diff --git a/platform/darwin/src/MGLShapeSource_Private.h b/platform/darwin/src/MGLShapeSource_Private.h index 584a5a4b301..c14f4fbb592 100644 --- a/platform/darwin/src/MGLShapeSource_Private.h +++ b/platform/darwin/src/MGLShapeSource_Private.h @@ -1,5 +1,5 @@ +#import "MGLFoundation.h" #import "MGLShapeSource.h" -#import "MGLShapeSource_Private.h" NS_ASSUME_NONNULL_BEGIN @@ -16,6 +16,7 @@ namespace mbgl { @end +MGL_EXPORT mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h index 6b381fca19b..550996f51b3 100644 --- a/platform/darwin/src/MGLSource.h +++ b/platform/darwin/src/MGLSource.h @@ -1,5 +1,7 @@ #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -18,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN subclasses of this class. Instead, create instances of `MGLShapeSource` and the concrete subclasses of `MGLTileSource`. */ +MGL_EXPORT @interface MGLSource : NSObject #pragma mark Initializing a Source diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 96dd502c305..6192632e75a 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLStyleLayer.h" #import "MGLTypes.h" @@ -27,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN the constant itself. Such details may change significantly from version to version. */ -static const NSInteger MGLStyleDefaultVersion = 9; +static MGL_EXPORT const NSInteger MGLStyleDefaultVersion = 9; /** The proxy object for the current map style. @@ -45,6 +46,7 @@ static const NSInteger MGLStyleDefaultVersion = 9; or `-mapView:didFinishLoadingStyle:` as indicators that it's safe to modify the map's style. */ +MGL_EXPORT @interface MGLStyle : NSObject #pragma mark Accessing Default Styles diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h index 4032be92970..ac405453986 100644 --- a/platform/darwin/src/MGLStyleLayer.h +++ b/platform/darwin/src/MGLStyleLayer.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLTypes.h" NS_ASSUME_NONNULL_BEGIN @@ -18,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN `MGLBackgroundStyleLayer` and the concrete subclasses of `MGLForegroundStyleLayer`. */ +MGL_EXPORT @interface MGLStyleLayer : NSObject #pragma mark Initializing a Style Layer diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index 3b576e766ba..7d0f6922f46 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -8,6 +8,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGL<%- (type === 'background' ? '' : @@ -68,6 +69,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { `-[MGLStyle layerWithIdentifier:]` method. */ <% } -%> +MGL_EXPORT @interface MGL<%- camelize(type) %>StyleLayer : MGL<%- (type === 'background' ? '' : (type === 'raster' ? 'Foreground' : diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h index ab5e76bbe30..315d48b7619 100644 --- a/platform/darwin/src/MGLStyleValue.h +++ b/platform/darwin/src/MGLStyleValue.h @@ -1,6 +1,8 @@ #import #import +#import "MGLFoundation.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -25,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
  • `NSArray`
  • */ +MGL_EXPORT @interface MGLStyleValue : NSObject #pragma mark Creating a Style Value @@ -68,6 +71,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates the Foundation class being wrapped by this class. */ +MGL_EXPORT @interface MGLStyleConstantValue : MGLStyleValue #pragma mark Creating a Style Constant Value @@ -111,6 +115,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLStyleFunction` class takes a generic parameter `T` that indicates the Foundation class being wrapped by this class. */ +MGL_EXPORT @interface MGLStyleFunction : MGLStyleValue #pragma mark Creating a Style Function diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 5a216e03546..57a8f718278 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -1,6 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. +#import "MGLFoundation.h" #import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" @@ -228,6 +229,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { `MGLMapView` for its `style` and obtain existing layers using the `-[MGLStyle layerWithIdentifier:]` method. */ +MGL_EXPORT @interface MGLSymbolStyleLayer : MGLVectorStyleLayer #pragma mark - Accessing the Layout Attributes diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.h b/platform/darwin/src/MGLTilePyramidOfflineRegion.h index 4e9f394e74b..4c6237702d6 100644 --- a/platform/darwin/src/MGLTilePyramidOfflineRegion.h +++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLOfflineRegion.h" #import "MGLGeometry.h" @@ -9,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN An offline region defined by a style URL, geographic coordinate bounds, and range of zoom levels. */ +MGL_EXPORT @interface MGLTilePyramidOfflineRegion : NSObject /** diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index caf915637ef..7e1a8206a3a 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLSource.h" #import "MGLTypes.h" @@ -20,7 +21,7 @@ typedef NSString *MGLTileSourceOption NS_STRING_ENUM; `MGLTileSourceOptionMaximumZoomLevel`, if specified. The default value for this option is 0. */ -extern const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel; /** An `NSNumber` object containing an unsigned integer that specifies the maximum @@ -30,7 +31,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel; `MGLTileSourceOptionMinimumZoomLevel`, if specified. The default value for this option is 22. */ -extern const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel; #if TARGET_OS_IPHONE /** @@ -42,7 +43,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel; `MGLTileSourceOptionAttributionInfos` option is specified, this option is ignored. */ -extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; /** An array of `MGLAttributionInfo` objects defining the buttons to be displayed @@ -51,7 +52,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; By default, no attribution statements are displayed. */ -extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; #else /** An HTML string defining the buttons to be displayed in the map view’s @@ -61,7 +62,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; `MGLTileSourceOptionAttributionInfos` option is specified, this option is ignored. */ -extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; /** An array of `MGLAttributionInfo` objects defining the buttons to be displayed @@ -70,7 +71,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString; By default, no attribution statements are displayed. */ -extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; #endif /** @@ -80,7 +81,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; The default value for this option is `MGLTileCoordinateSystemXYZ`. */ -extern const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem; +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem; /** Tile coordinate systems that determine how tile coordinates in tile URLs are @@ -119,6 +120,7 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) { subclasses of this class. Instead, create instances of `MGLRasterSource` and `MGLVectorSource`. */ +MGL_EXPORT @interface MGLTileSource : MGLSource #pragma mark Initializing a Source diff --git a/platform/darwin/src/MGLTileSource_Private.h b/platform/darwin/src/MGLTileSource_Private.h index ca80e3d960d..8da69274f2b 100644 --- a/platform/darwin/src/MGLTileSource_Private.h +++ b/platform/darwin/src/MGLTileSource_Private.h @@ -1,7 +1,8 @@ -#import "MGLTileSource.h" - #import +#import "MGLFoundation.h" +#import "MGLTileSource.h" + NS_ASSUME_NONNULL_BEGIN namespace mbgl { @@ -31,6 +32,7 @@ namespace mbgl { @end +MGL_EXPORT mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTemplates, NS_DICTIONARY_OF(MGLTileSourceOption, id) * _Nullable options); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h index a6b7254b587..8cd2cacaa60 100644 --- a/platform/darwin/src/MGLTypes.h +++ b/platform/darwin/src/MGLTypes.h @@ -1,5 +1,7 @@ #import +#import "MGLFoundation.h" + #pragma once #if TARGET_OS_IPHONE @@ -28,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN #endif /** Indicates an error occurred in the Mapbox SDK. */ -extern NSErrorDomain const MGLErrorDomain; +extern MGL_EXPORT NSErrorDomain const MGLErrorDomain; /** Error constants for the Mapbox SDK. */ typedef NS_ENUM(NSInteger, MGLErrorCode) { diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorSource.h index f91a0cbb23c..a5fd2584f88 100644 --- a/platform/darwin/src/MGLVectorSource.h +++ b/platform/darwin/src/MGLVectorSource.h @@ -1,3 +1,4 @@ +#import "MGLFoundation.h" #import "MGLTileSource.h" NS_ASSUME_NONNULL_BEGIN @@ -25,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN layer initialized with a vector source must have a non-`nil` value in its `sourceLayerIdentifier` property. */ +MGL_EXPORT @interface MGLVectorSource : MGLTileSource - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL NS_DESIGNATED_INITIALIZER; diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h index 1197d76807c..f59ef4bf7f3 100644 --- a/platform/darwin/src/MGLVectorStyleLayer.h +++ b/platform/darwin/src/MGLVectorStyleLayer.h @@ -1,5 +1,6 @@ #import +#import "MGLFoundation.h" #import "MGLForegroundStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -13,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN subclasses: `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLLineStyleLayer`, and `MGLSymbolStyleLayer`. */ +MGL_EXPORT @interface MGLVectorStyleLayer : MGLForegroundStyleLayer #pragma mark Refining a Style Layer’s Content diff --git a/platform/darwin/test/MGLVersionNumber.m b/platform/darwin/test/MGLVersionNumber.m new file mode 100644 index 00000000000..fae08a087d0 --- /dev/null +++ b/platform/darwin/test/MGLVersionNumber.m @@ -0,0 +1,15 @@ +#import + +#import + +@interface MGLVersionTests : XCTestCase + +@end + +@implementation MGLVersionTests + +- (void)testVersionNumber { + XCTAssertEqual(1, MapboxVersionNumber); +} + +@end diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index c606c74ea16..6f2ee38e945 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -163,6 +163,9 @@ 40F887711D7A1E59008ECB67 /* MGLShapeSource_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 40F8876F1D7A1DB8008ECB67 /* MGLShapeSource_Private.h */; }; 40FDA76B1CCAAA6800442548 /* MBXAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */; }; 554180421D2E97DE00012372 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 554180411D2E97DE00012372 /* OpenGLES.framework */; }; + 556660CA1E1BF3A900E2C41B /* MGLFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 556660C91E1BF3A900E2C41B /* MGLFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 556660D81E1D085500E2C41B /* MGLVersionNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 556660D71E1D085500E2C41B /* MGLVersionNumber.m */; }; + 556660DB1E1D8E8D00E2C41B /* MGLFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 556660C91E1BF3A900E2C41B /* MGLFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 55D8C9961D0F18CE00F42F10 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */; }; 7E016D7E1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */; }; 7E016D7F1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */; }; @@ -609,6 +612,8 @@ 40FDA7691CCAAA6800442548 /* MBXAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXAnnotationView.h; sourceTree = ""; }; 40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXAnnotationView.m; sourceTree = ""; }; 554180411D2E97DE00012372 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 556660C91E1BF3A900E2C41B /* MGLFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLFoundation.h; sourceTree = ""; }; + 556660D71E1D085500E2C41B /* MGLVersionNumber.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLVersionNumber.m; path = ../../darwin/test/MGLVersionNumber.m; sourceTree = ""; }; 55D8C9941D0F133500F42F10 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/ios/config.xcconfig; sourceTree = ""; }; 55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLPolyline+MGLAdditions.h"; sourceTree = ""; }; @@ -1097,6 +1102,7 @@ DA2E885F1CC0382C00F24E7B /* MGLOfflineStorageTests.m */, DA2E88601CC0382C00F24E7B /* MGLStyleTests.mm */, DD58A4C51D822BD000E1F038 /* MGLExpressionTests.mm */, + 556660D71E1D085500E2C41B /* MGLVersionNumber.m */, DA2E88551CC036F400F24E7B /* Info.plist */, DA2784FB1DF02FF4001D5B8D /* Media.xcassets */, ); @@ -1135,6 +1141,7 @@ DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */, DAF0D8171DFE6B2800B28378 /* MGLAttributionInfo_Private.h */, DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */, + 556660C91E1BF3A900E2C41B /* MGLFoundation.h */, DA8847E21CBAFA5100AB86E3 /* MGLMapCamera.h */, DA8848031CBAFA6200AB86E3 /* MGLMapCamera.mm */, DD0902A41DB18F1B00C5BDCE /* MGLNetworkConfiguration.h */, @@ -1442,6 +1449,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 556660DB1E1D8E8D00E2C41B /* MGLFoundation.h in Headers */, 35D13AC31D3D19DD00AFB4E0 /* MGLFillStyleLayer.h in Headers */, DA88483A1CBAFB8500AB86E3 /* MGLAnnotationImage.h in Headers */, DA35A2BB1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */, @@ -1555,6 +1563,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 556660CA1E1BF3A900E2C41B /* MGLFoundation.h in Headers */, 4032C5C01DE1FC780062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */, 35B82BF91D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */, DA35A2CA1CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */, @@ -1962,6 +1971,7 @@ 353D23961D0B0DFE002BE09D /* MGLAnnotationViewTests.m in Sources */, 35E208A71D24210F00EC9A46 /* MGLNSDataAdditionsTests.m in Sources */, DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */, + 556660D81E1D085500E2C41B /* MGLVersionNumber.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2432,7 +2442,7 @@ PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Debug; }; @@ -2465,7 +2475,7 @@ PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Release; }; @@ -2513,6 +2523,7 @@ PRODUCT_NAME = Mapbox; PUBLIC_HEADERS_FOLDER_PATH = Headers; SKIP_INSTALL = YES; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Debug; }; @@ -2538,6 +2549,7 @@ PRODUCT_NAME = Mapbox; PUBLIC_HEADERS_FOLDER_PATH = Headers; SKIP_INSTALL = YES; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Release; }; diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h index 69c718ddea7..88efdd5cb40 100644 --- a/platform/ios/src/Mapbox.h +++ b/platform/ios/src/Mapbox.h @@ -1,10 +1,12 @@ #import +#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 "MGLAnnotationView.h" #import "MGLAccountManager.h" diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake index dab507d42a2..2e4b7a01b21 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -9,8 +9,6 @@ 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 @@ -62,6 +60,7 @@ macro(mbgl_platform_core) target_compile_options(mbgl-core PRIVATE -fobjc-arc + PRIVATE -fvisibility=hidden ) target_include_directories(mbgl-core @@ -85,8 +84,6 @@ 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" @@ -100,8 +97,6 @@ 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" @@ -115,8 +110,6 @@ endmacro() macro(mbgl_platform_test) - set_xcode_property(mbgl-test GCC_SYMBOLS_PRIVATE_EXTERN YES) - target_sources(mbgl-test PRIVATE test/src/main.cpp ) @@ -127,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" @@ -139,7 +136,9 @@ macro(mbgl_platform_test) endmacro() macro(mbgl_platform_benchmark) - set_xcode_property(mbgl-benchmark GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_compile_options(mbgl-benchmark + PRIVATE -fvisibility=hidden + ) target_sources(mbgl-benchmark PRIVATE benchmark/src/main.cpp @@ -163,7 +162,9 @@ macro(mbgl_platform_benchmark) endmacro() macro(mbgl_platform_node) - set_xcode_property(mbgl-node GCC_SYMBOLS_PRIVATE_EXTERN YES) + target_compile_options(mbgl-node + PRIVATE -fvisibility=hidden + ) target_link_libraries(mbgl-node PRIVATE "-framework Foundation" diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index f00f56e058c..6f6aad2436a 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -58,6 +58,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, ); }; }; @@ -305,6 +307,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 = ""; }; 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = ""; }; + 556660C51E1BEA0100E2C41B /* MGLFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLFoundation.h; sourceTree = ""; }; + 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLVersionNumber.m; path = ../../darwin/test/MGLVersionNumber.m; sourceTree = ""; }; 558F18211D0B13B000123F46 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/osx/Debug/libmbgl-loop.a"; sourceTree = ""; }; 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 = ""; }; @@ -882,6 +886,7 @@ DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */, DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */, DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */, + 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */, DAE6C33A1CC30DB200DB3429 /* Info.plist */, DA2784FD1DF03060001D5B8D /* Media.xcassets */, ); @@ -903,6 +908,7 @@ DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */, DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */, DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */, + 556660C51E1BEA0100E2C41B /* MGLFoundation.h */, DAE6C34D1CC31E0400DB3429 /* MGLMapCamera.h */, DAE6C36E1CC31E2A00DB3429 /* MGLMapCamera.mm */, DD0902B01DB1AC6400C5BDCE /* MGLNetworkConfiguration.h */, @@ -957,6 +963,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 */, @@ -1322,6 +1329,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; @@ -1489,6 +1497,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"; }; @@ -1501,6 +1510,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"; }; @@ -1542,7 +1552,6 @@ 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)", @@ -1550,6 +1559,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)", @@ -1558,7 +1568,7 @@ PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Debug; }; @@ -1575,7 +1585,6 @@ 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)", @@ -1583,6 +1592,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)", @@ -1592,7 +1602,7 @@ SKIP_INSTALL = YES; STRIP_STYLE = "non-global"; VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + VERSION_INFO_PREFIX = "__attribute__((visibility (\"default\"))) "; }; name = Release; }; diff --git a/platform/macos/src/MGLAnnotationImage.h b/platform/macos/src/MGLAnnotationImage.h index 37d43d7277d..d41fd32ec47 100644 --- a/platform/macos/src/MGLAnnotationImage.h +++ b/platform/macos/src/MGLAnnotationImage.h @@ -1,5 +1,7 @@ #import +#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 #pragma mark Initializing and Preparing the Image Object diff --git a/platform/macos/src/MGLAttributionButton.h b/platform/macos/src/MGLAttributionButton.h index 88fcdadf78a..3e0b53a6d04 100644 --- a/platform/macos/src/MGLAttributionButton.h +++ b/platform/macos/src/MGLAttributionButton.h @@ -1,5 +1,6 @@ #import +#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 ea87f3b338a..c934ba6e974 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -1,6 +1,7 @@ #import #import +#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/Mapbox.h b/platform/macos/src/Mapbox.h index 524ff1a93a3..b16aaf7e67a 100644 --- a/platform/macos/src/Mapbox.h +++ b/platform/macos/src/Mapbox.h @@ -1,10 +1,12 @@ #import +#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" From 60055aea1b2d8b2fa91b938fbc3f6c8f74da8e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 3 Jan 2017 16:14:29 +0100 Subject: [PATCH 2/3] [macOS] use SourceKit to ensure that all public symbols are exported --- Makefile | 4 + .../darwin/scripts/check-public-symbols.js | 83 +++++++++++++++++++ platform/macos/scripts/package.sh | 3 + 3 files changed, 90 insertions(+) create mode 100755 platform/darwin/scripts/check-public-symbols.js diff --git a/Makefile b/Makefile index 393dad481b2..5469fb1f703 100644 --- a/Makefile +++ b/Makefile @@ -277,6 +277,10 @@ idocument: darwin-style-code: node platform/darwin/scripts/generate-style-code.js style-code: darwin-style-code + +.PHONY: check-public-symbols +check-public-symbols: + node platform/darwin/scripts/check-public-symbols.js macOS endif #### Linux targets ##################################################### diff --git a/platform/darwin/scripts/check-public-symbols.js b/platform/darwin/scripts/check-public-symbols.js new file mode 100755 index 00000000000..4dde5d677b1 --- /dev/null +++ b/platform/darwin/scripts/check-public-symbols.js @@ -0,0 +1,83 @@ +#!/usr/bin/env node + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const execFileSync = require('child_process').execFileSync; +const _ = require('lodash'); + +const keyword = /\bMGL_EXPORT\b/; + +let scanned = []; + +function hasMissingSymbols(os) { + let missing = false; + let sdk = os === 'iOS' ? 'iphonesimulator' : 'macosx'; + let sysroot = execFileSync('xcrun', ['--show-sdk-path', '--sdk', sdk]).toString().trim(); + let umbrellaPath = `platform/${os.toLowerCase()}/src/Mapbox.h`; + let docArgs = ['doc', '--objc', umbrellaPath, '--', + '-x', 'objective-c', '-I', 'platform/darwin/src/', '-isysroot', sysroot]; + let docStr = execFileSync('sourcekitten', docArgs).toString().trim(); + let docJson = JSON.parse(docStr); + _.forEach(docJson, function (result) { + _.forEach(result, function (structure, path) { + // Prevent multiple scans of the same file. + if (scanned.indexOf(path) >= 0) return; + scanned.push(path); + + const src = fs.readFileSync(path, 'utf8').split('\n'); + _.forEach(structure['key.substructure'], function (substructure) { + switch (substructure['key.kind']) { + case 'sourcekitten.source.lang.objc.decl.class': + if (!(keyword.test(src[substructure['key.doc.line'] - 1]) || keyword.test(src[substructure['key.doc.line'] - 2]))) { + console.warn(`- missing symbol export for class ${substructure['key.name']} in ${path}:${substructure['key.doc.line']}:${substructure['key.doc.column']}`); + missing = true; + } + break; + case 'sourcekitten.source.lang.objc.decl.constant': + if (!keyword.test(src[substructure['key.doc.line'] - 1])) { + console.warn(`- missing symbol export for constant ${substructure['key.name']} in ${path}:${substructure['key.doc.line']}:${substructure['key.doc.column']}`); + missing = true; + } + break; + } + }); + }); + }); + + return missing; +} + +function ensureSourceKittenIsInstalled() { + try { + execFileSync('which', ['sourcekitten']); + } catch (e) { + console.log(`Installing SourceKitten via Homebrew…`); + execFileSync('brew', ['install', 'sourcekitten']); + } +} + +if (process.argv.length < 3) { + console.warn(`Usage: ${path.relative(process.cwd(), process.argv[1])} [macOS|iOS] ...`); + process.exit(1); +} + +ensureSourceKittenIsInstalled(); + +let missing = false; +for (var i = 2; i < process.argv.length; i++) { + let os = process.argv[i]; + if (os == 'iOS' || os == 'macOS') { + missing |= hasMissingSymbols(os); + } else { + console.warn(`Argument must be one of iOS or macOS`); + process.exit(1); + } +} + +if (missing) { + process.exit(1); +} else { + console.warn(`All symbols are correctly exported.`); +} diff --git a/platform/macos/scripts/package.sh b/platform/macos/scripts/package.sh index 9cb38c6c714..2f30b0917d3 100755 --- a/platform/macos/scripts/package.sh +++ b/platform/macos/scripts/package.sh @@ -75,3 +75,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 From e26042ef1b80df5baec5ffd53fb3eb0c14514408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 3 Jan 2017 16:17:04 +0100 Subject: [PATCH 3/3] [docs] Add note about MGL_EXPORT to macOS documentation --- platform/ios/DEVELOPING.md | 1 + platform/macos/DEVELOPING.md | 1 + 2 files changed, 2 insertions(+) diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md index 94ff49ee1b3..22635be2649 100644 --- a/platform/ios/DEVELOPING.md +++ b/platform/ios/DEVELOPING.md @@ -77,6 +77,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 iOS SDK’s public interface: +1. _(Optional.)_ Add the macro `MGL_EXPORT` prior to the declaration for classes and global constants when adding them in shared headers located in `platform/darwin`. 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 macOS SDK, consult [the companion macOS document](../macos/DEVELOPING.md#making-a-type-or-constant-public) for further instructions. diff --git a/platform/macos/DEVELOPING.md b/platform/macos/DEVELOPING.md index 71eb7995c8f..c8e064fbed6 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.