summaryrefslogtreecommitdiff
path: root/mbgl.gypi
blob: c06139a0cacf830d0a3448fb78e8f24d57c8b9e6 (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
{
  'target_defaults': {
    'default_configuration': 'Release',
    'conditions': [
      ['OS=="mac"', {
        'xcode_settings': {
          'CLANG_CXX_LIBRARY': 'libc++',
          'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
          'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
          'GCC_ENABLE_CPP_RTTI': 'YES',
          'OTHER_CPLUSPLUSFLAGS': [
            '-std=c++14',
            '-Werror',
            '-Wall',
            '-Wextra',
            '-Wshadow',
            '-Wno-variadic-macros',
            '-frtti',
            '-fexceptions',
            '${CFLAGS}',
          ],
          'GCC_WARN_PEDANTIC': 'YES',
          'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
          'MACOSX_DEPLOYMENT_TARGET': '10.10',
          'ALWAYS_SEARCH_USER_PATHS': 'NO',
          'COMBINE_HIDPI_IMAGES': 'YES',
        },
      }, {
        'cflags_cc': [
          '-std=c++14',
          '-Werror',
          '-Wall',
          '-Wextra',
          '-Wshadow',
          '-Wno-variadic-macros',
          '-Wno-error=unused-parameter',
          '-frtti',
          '-fexceptions',
          '${CFLAGS}',
        ],
      }],
      ['OS=="linux"', {
        'cflags_cc': [
          '-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin.
        ],
      }],
    ],
    'target_conditions': [
      ['_type == "static_library"', {
        'conditions': [
          ['OS=="mac"', {
            'xcode_settings': {
              'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ],
              'SKIP_INSTALL': 'YES',
            },
          }, {
            'cflags_cc': [ '-fPIC' ],
          }],
        ],
      }],
    ],
    'configurations': {
      'Debug': {
        'conditions': [
          ['OS=="mac"', {
            'xcode_settings': {
              'DEBUG_INFORMATION_FORMAT': 'dwarf',
              'GCC_OPTIMIZATION_LEVEL': '0',
              'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
              'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
              'DEAD_CODE_STRIPPING': 'NO',
              'OTHER_CPLUSPLUSFLAGS': [ '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ],
              'conditions': [
                ['coverage', {
                  'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',
                  'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
                  'OTHER_CPLUSPLUSFLAGS': [ '--coverage' ],
                }],
              ],
            },
          }, {
            'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ],
            'conditions': [
              ['coverage', { 'cflags_cc': [ '--coverage' ] }],
            ],
          }],
        ],
        'defines': [ 'DEBUG' ],
        'target_conditions': [
          ['_type == "executable"', {
            'conditions': [
              ['OS=="mac" and coverage', {
                 'xcode_settings': { 'OTHER_LDFLAGS': [ '--coverage' ] },
              }, {
                'ldflags': [ '--coverage' ],
              }],
            ],
          }],
        ],
      },
      'Release': {
        'defines': [ 'NDEBUG' ],
        'conditions': [
          ['OS=="mac"', {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
              'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
              'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
              'DEAD_CODE_STRIPPING': 'NO',
            },
          }, {
            'cflags_cc': [ '-g', '-O3' ],
          }],
        ],
      },
    },
  },
  'configurations': {
    'Debug': {
      'xcode_settings': {
        'ENABLE_TESTABILITY': 'YES',
        'ONLY_ACTIVE_ARCH': 'YES',
      },
    },
  },
  'targets': [
    {
      'target_name': 'core',
      'product_name': 'mbgl-core',
      'type': 'static_library',
      'standalone_static_library': 1,
      'hard_dependency': 1,

      'sources': [
        '<!@(find <(DEPTH)/src -name "*.hpp")',
        '<!@(find <(DEPTH)/src -name "*.cpp")',
        '<!@(find <(DEPTH)/src -name "*.c")',
        '<!@(find <(DEPTH)/src -name "*.h")',
        '<!@(find <(DEPTH)/include -name "*.hpp")',
        '<!@(find <(DEPTH)/include -name "*.h")',
        '<!@(find -H <(DEPTH)/node_modules/mapbox-gl-shaders -name "*.glsl")',
        '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp',
      ],

      'rules': [
        {
          'rule_name': 'Build Shaders',
          'message': 'Building shader',
          'extension': 'glsl',
          'inputs': [ '<(DEPTH)/scripts/build-shaders.py' ],
          'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ],
          'action': [ '<@(_inputs)', '<(RULE_INPUT_PATH)', '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ],
          'process_outputs_as_sources': 1,
        }
      ],

      'actions': [
        {
          'action_name': 'Build Version Header',
          'inputs': [ '<(DEPTH)/scripts/build-version.py', ],
          'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', ],
          'action': [ '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)' ],
        }
      ],

      'include_dirs': [
        'include',
        'src',
        '<(SHARED_INTERMEDIATE_DIR)/include',
      ],

      'variables': {
        'cflags_cc': [
          '<@(opengl_cflags)',
          '<@(protozero_cflags)',
          '<@(boost_cflags)',
          '<@(geometry_cflags)',
          '<@(geojsonvt_cflags)',
          '<@(rapidjson_cflags)',
          '<@(variant_cflags)',
          '<@(earcut_cflags)',
          '<@(unique_resource_cflags)',
        ],
        'cflags': [
          '<@(opengl_cflags)',
          '<@(rapidjson_cflags)',
          '-fPIC'
        ],
        'ldflags': [
          '<@(opengl_ldflags)',
        ],
        'libraries': [
          '<@(geojsonvt_static_libs)',
        ],
      },

      'conditions': [
        ['OS == "mac"', {
          'xcode_settings': {
            'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
            'OTHER_CFLAGS': [ '<@(cflags)' ],
          },
        }, {
          'cflags_cc': [ '<@(cflags_cc)' ],
          'cflags': [ '<@(cflags)' ],
        }],

        ['headless_lib == "cgl"', {
          'sources': [
            'platform/default/headless_display.cpp',
            'platform/default/headless_view.cpp',
            'platform/darwin/src/headless_view_cgl.cpp',
          ],

          'link_settings': {
            'libraries': [
              '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
            ],
          },
        }],

        ['headless_lib == "eagl"', {
          'sources': [
            'platform/default/headless_display.cpp',
            'platform/default/headless_view.cpp',
            'platform/darwin/src/headless_view_eagl.mm',
          ],
        }],

        ['headless_lib == "glx"', {
          'sources': [
            'platform/default/headless_display.cpp',
            'platform/default/headless_view.cpp',
            'platform/default/headless_view_glx.cpp',
          ],

          'cflags_cc': [ '<@(opengl_cflags)' ],

          'link_settings': {
            'libraries': [ '<@(opengl_ldflags)' ],
          },
        }],

        ['loop_lib == "darwin"', {
          'sources': [
            'platform/darwin/src/async_task.cpp',
            'platform/darwin/src/run_loop.cpp',
            'platform/darwin/src/timer.cpp',
          ],
        }],

        ['loop_lib == "android"', {
          'sources': [
            'platform/android/src/async_task.cpp',
            'platform/android/src/run_loop.cpp',
            'platform/android/src/timer.cpp',
          ],
        }],

        ['loop_lib == "uv"', {
          'sources': [
            'platform/default/async_task.cpp',
            'platform/default/run_loop.cpp',
            'platform/default/timer.cpp',
          ],

          'cflags_cc': [
            '<@(libuv_cflags)',
          ],

          'link_settings': {
            'libraries': [
              '<@(libuv_static_libs)',
              '<@(libuv_ldflags)',
            ],
          },
        }],
      ],

      'link_settings': {
        'conditions': [
          ['OS == "mac"', {
            'libraries': [ '<@(libraries)' ],
            'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] }
          }, {
            'libraries': [ '<@(libraries)', '<@(ldflags)' ],
          }]
        ],
      },

      'direct_dependent_settings': {
        'cflags_cc': [
          '<@(variant_cflags)',
          '<@(geometry_cflags)',
          '<@(unique_resource_cflags)',
        ],
        'xcode_settings': {
          'OTHER_CPLUSPLUSFLAGS': [
            '<@(variant_cflags)',
            '<@(geometry_cflags)',
            '<@(unique_resource_cflags)',
          ],
        },
      },
    },
    {
      'target_name': 'copy_certificate_bundle',
      'type': 'none',
      'hard_dependency': 1,
      'copies': [{
        'files': [ 'common/ca-bundle.crt' ],
        'destination': '<(PRODUCT_DIR)'
      }],
    },
  ],
}