summaryrefslogtreecommitdiff
path: root/platform/osx/platform.gyp
blob: a8c6ce070468e46df5332dfd4edc94ec6845842a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
{
  'variables': {
    'loop_lib': 'darwin',
    'headless_lib': 'cgl',
  },
  'xcode_settings': {
     # Force all build output to the build directory. Must
     # be an absolute path or xcodebuild will ignore it.
    'SYMROOT': '<!(cd ../../build/osx-x86_64 && pwd)',
  },
  'includes': [
    '../../mbgl.gypi',
    '../../test/test.gypi',
    '../../bin/glfw.gypi',
    '../../bin/render.gypi',
    '../../bin/offline.gypi',
  ],
  'targets': [
    {
      'target_name': 'test',
      'type': 'executable',

      'dependencies': [
        'test-lib',
        'platform-lib',
      ],

      'sources': [
        '../../test/src/main.cpp',
      ],
    },
    {
      'target_name': 'platform-lib',
      'product_name': 'mbgl-platform-osx',
      'type': 'static_library',
      'standalone_static_library': 1,
      'hard_dependency': 1,
      'dependencies': [
        'core',
      ],

      'include_dirs': [
        'include',
        '../darwin/include',
        '../default',
        '../../include',
        '../../src', # TODO: eliminate
      ],

      'sources': [
        '../default/asset_file_source.cpp',
        '../default/default_file_source.cpp',
        '../default/online_file_source.cpp',
        '../default/mbgl/storage/offline.hpp',
        '../default/mbgl/storage/offline.cpp',
        '../default/mbgl/storage/offline_database.hpp',
        '../default/mbgl/storage/offline_database.cpp',
        '../default/mbgl/storage/offline_download.hpp',
        '../default/mbgl/storage/offline_download.cpp',
        '../default/sqlite3.hpp',
        '../default/sqlite3.cpp',
        '../darwin/src/http_file_source.mm',
        '../darwin/src/log_nslog.mm',
        '../darwin/src/string_nsstring.mm',
        '../darwin/src/image.mm',
        '../darwin/src/nsthread.mm',
        '../darwin/src/reachability.m',
      ],

      'xcode_settings': {
        'OTHER_CPLUSPLUSFLAGS': [
          '<@(boost_cflags)',
          '<@(sqlite_cflags)',
          '<@(zlib_cflags)',
          '<@(rapidjson_cflags)',
          '<@(variant_cflags)',
        ],
        'CLANG_ENABLE_OBJC_ARC': 'YES',
        'CLANG_ENABLE_MODULES': 'YES',
      },

      'link_settings': {
        'libraries': [
          '<@(sqlite_static_libs)',
          '<@(zlib_static_libs)',
          '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
          '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework',
          '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
          '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
          '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
        ],
        'xcode_settings': {
          'OTHER_LDFLAGS': [ '<@(zlib_ldflags)' ],
        },
      },
    },
    {
      'target_name': 'osxsdk',
      'product_name': 'Mapbox',
      'type': 'shared_library',
      'mac_bundle': 1,

      'dependencies': [
        'platform-lib',
      ],

      'xcode_settings': {
        'CLANG_ENABLE_OBJC_ARC': 'YES',
        'CURRENT_PROJECT_VERSION': '0',
        'DEFINES_MODULE': 'YES',
        'DYLIB_INSTALL_NAME_BASE': '@rpath',
        'INFOPLIST_FILE': 'sdk/Info.plist',
        'LD_RUNPATH_SEARCH_PATHS': [
          '${inherited}',
          '@executable_path/../Frameworks',
          '@loader_path/Frameworks',
        ],
        'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL',
        'OTHER_CPLUSPLUSFLAGS': [
          '<@(boost_cflags)',
          '<@(variant_cflags)',
        ],
        'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ],
        'SDKROOT': 'macosx',
        'SKIP_INSTALL': 'YES',
        'SUPPORTED_PLATFORMS':'macosx',
        'VERSIONING_SYSTEM': 'apple-generic',
      },

      'mac_framework_headers': [
        'sdk/Mapbox.h',
        '<!@(find ../{darwin,osx}/include -type f \! -name \'.*\')',
      ],

      'mac_bundle_resources': [
        '<!@(find src/resources -type f \! -name \'.*\')',
      ],

      'include_dirs': [
        'include',
        '../darwin/include',
        '../../include',
      ],

      'sources': [
        '../darwin/src/NSException+MGLAdditions.h',
        '../darwin/src/NSString+MGLAdditions.h',
        '../darwin/src/NSString+MGLAdditions.m',
        '../darwin/src/MGLTypes.m',
        '../darwin/src/MGLStyle.mm',
        '../darwin/src/MGLGeometry_Private.h',
        '../darwin/src/MGLGeometry.mm',
        '../darwin/src/MGLShape.m',
        '../darwin/src/MGLMultiPoint_Private.h',
        '../darwin/src/MGLMultiPoint.mm',
        '../darwin/src/MGLPointAnnotation.m',
        '../darwin/src/MGLPolyline.mm',
        '../darwin/src/MGLPolygon.mm',
        '../darwin/src/MGLMapCamera.mm',
        '../darwin/src/MGLOfflinePack.mm',
        '../darwin/src/MGLOfflinePack_Private.h',
        '../darwin/src/MGLOfflineStorage.mm',
        '../darwin/src/MGLOfflineStorage_Private.h',
        '../darwin/src/MGLOfflineRegion_Private.h',
        '../darwin/src/MGLTilePyramidOfflineRegion.mm',
        '../darwin/src/MGLAccountManager_Private.h',
        '../darwin/src/MGLAccountManager.m',
        '../darwin/src/NSBundle+MGLAdditions.h',
        '../darwin/src/NSBundle+MGLAdditions.m',
        '../darwin/src/NSProcessInfo+MGLAdditions.h',
        '../darwin/src/NSProcessInfo+MGLAdditions.m',
        'src/MGLMapView_Private.h',
        'src/MGLMapView.mm',
        'src/MGLMapView+IBAdditions.m',
        'src/MGLOpenGLLayer.h',
        'src/MGLOpenGLLayer.mm',
        'src/MGLCompassCell.h',
        'src/MGLCompassCell.m',
        'src/MGLAttributionButton.h',
        'src/MGLAttributionButton.m',
        'src/MGLAnnotationImage.m',
      ],

      'configurations': {
        'Debug': {
          'xcode_settings': {
            'GCC_OPTIMIZATION_LEVEL': '0',
          },
        },
        'Release': {
          'xcode_settings': {
            'GCC_OPTIMIZATION_LEVEL': 's',
          },
        },
      },

      'direct_dependent_settings': {
        'libraries': [
          '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
          '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework',
        ],
      },
    },
    {
      'target_name': 'osxtest',
      'product_name': 'osxtest',
      'type': 'loadable_module',
      'mac_xctest_bundle': 1,

      'dependencies': [
        'osxsdk',
      ],

      'xcode_settings': {
        'CLANG_ENABLE_MODULES': 'YES',
        'CLANG_ENABLE_OBJC_ARC': 'YES',
        'ENABLE_STRICT_OBJC_MSGSEND': 'YES',
        'GCC_DYNAMIC_NO_PIC': 'NO',
        'GCC_NO_COMMON_BLOCKS': 'YES',
        'INFOPLIST_FILE': 'test/Info.plist',
        'LD_RUNPATH_SEARCH_PATHS': [
          '${inherited}',
          '@executable_path/../Frameworks',
          '@loader_path/../Frameworks',
        ],
        'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.osxtest',
        'SDKROOT': 'macosx',
        'SKIP_INSTALL': 'YES',
        'SUPPORTED_PLATFORMS':'macosx',
      },

      'sources': [
        '../darwin/test/MGLGeometryTests.mm',
        '../darwin/test/MGLOfflinePackTests.m',
        '../darwin/test/MGLOfflineRegionTests.m',
        '../darwin/test/MGLOfflineStorageTests.m',
        '../darwin/test/MGLStyleTests.mm',
      ],

      'include_dirs': [
        'include',
        '../darwin/include',
        '../../include',
      ],

      'configurations': {
        'Debug': {
          'xcode_settings': {
            'COPY_PHASE_STRIP': 'NO',
            'DEBUG_INFORMATION_FORMAT': 'dwarf',
            'ENABLE_TESTABILITY': 'YES',
            'GCC_OPTIMIZATION_LEVEL': '0',
            'GCC_PREPROCESSOR_DEFINITIONS': [
              'DEBUG=1',
              '${inherited}',
            ],
            'ONLY_ACTIVE_ARCH': 'YES',
          },
        },
        'Release': {
          'xcode_settings': {
            'COPY_PHASE_STRIP': 'YES',
            'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
            'ENABLE_NS_ASSERTIONS': 'NO',
          },
        },
      },
    },
    {
      'target_name': 'osxapp',
      'product_name': 'Mapbox GL',
      'type': 'executable',
      'product_extension': 'app',
      'mac_bundle': 1,
      'mac_bundle_resources': [
        'app/Credits.rtf',
        'app/Icon.icns',
        'app/MainMenu.xib',
        'app/MapDocument.xib',
      ],

      'dependencies': [
        'osxsdk',
      ],

      'sources': [
        'app/AppDelegate.h',
        'app/AppDelegate.m',
        'app/DroppedPinAnnotation.h',
        'app/DroppedPinAnnotation.m',
        'app/LocationCoordinate2DTransformer.h',
        'app/LocationCoordinate2DTransformer.m',
        'app/MapDocument.h',
        'app/MapDocument.m',
        'app/OfflinePackNameValueTransformer.h',
        'app/OfflinePackNameValueTransformer.m',
        'app/TimeIntervalTransformer.h',
        'app/TimeIntervalTransformer.m',
        'app/NSValue+Additions.h',
        'app/NSValue+Additions.m',
        'app/main.m',
      ],

      'xcode_settings': {
        'CLANG_ENABLE_OBJC_ARC': 'YES',
        'INFOPLIST_FILE': 'app/Info.plist',
        'LD_RUNPATH_SEARCH_PATHS': [
          '\${inherited}',
          '@executable_path/../Frameworks',
        ],
        'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL',
        'SDKROOT': 'macosx',
        'SUPPORTED_PLATFORMS': 'macosx',
      },

      'configurations': {
        'Debug': {
          'xcode_settings': {
            'COPY_PHASE_STRIP': 'NO',
          },
        },
        'Release': {
          'xcode_settings': {
            'COPY_PHASE_STRIP': 'YES',
          },
        },
      },

      'copies': [
        {
          'destination': '<(PRODUCT_DIR)/${FRAMEWORKS_FOLDER_PATH}',
          'files': [
            '<(PRODUCT_DIR)/Mapbox.framework',
          ],
          'xcode_code_sign': 1,
        }
      ],
    },
  ],
}