-
Notifications
You must be signed in to change notification settings - Fork 8
/
binding.gyp
159 lines (158 loc) · 7.25 KB
/
binding.gyp
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
# This file inherits default targets for Node addons, see https://github.com/nodejs/node-gyp/blob/master/addon.gypi
{
# https://github.com/springmeyer/gyp/blob/master/test/make_global_settings/wrapper/wrapper.gyp
'make_global_settings': [
['CXX', '<(module_root_dir)/mason_packages/.link/bin/clang++'],
['CC', '<(module_root_dir)/mason_packages/.link/bin/clang'],
['LINK', '<(module_root_dir)/mason_packages/.link/bin/clang++'],
['AR', '<(module_root_dir)/mason_packages/.link/bin/llvm-ar'],
['NM', '<(module_root_dir)/mason_packages/.link/bin/llvm-nm']
],
'includes': [ 'common.gypi' ],
'variables': { # custom variables we use specific to this file
'error_on_warnings%':'true', # can be overriden by a command line variable because of the % sign using "WERROR" (defined in Makefile)
# Use this variable to silence warnings from mason dependencies
# It's a variable to make easy to pass to
# cflags (linux) and xcode (mac)
'system_includes': [
"-isystem <!@(node -p \"require('node-addon-api').include.slice(1,-1)\")",
"-isystem <(module_root_dir)/mason_packages/.link/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/variant/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/optional",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/geometry.hpp/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/geojson.hpp/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/extras/rapidjson/include",
'-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/wagyu/include',
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/nunicode/include",
'-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/boost/include',
"-isystem <(module_root_dir)/mason_packages/.link/src",
"-isystem <(module_root_dir)/mason_packages/.link/platform",
],
# Flags we pass to the compiler to ensure the compiler
# warns us about potentially buggy or dangerous code
'compiler_checks': [
'-Wall',
'-Wextra',
# disabled since this now breaks on gl-native's platform/default/src/mbgl/layermanager/layer_manager.cpp
# which we cannot easily change here
#'-Weffc++',
'-Wconversion',
'-pedantic-errors',
'-Wconversion',
'-Wshadow',
'-Wfloat-equal',
'-Wuninitialized',
'-Wunreachable-code',
'-Wold-style-cast',
'-Wno-error=unused-variable',
'-Wno-error=unused-value',
'-DRAPIDJSON_HAS_STDSTRING=1',
'-Wno-deprecated-declarations',
'-Wno-float-equal',
'-Wno-float-conversion'
]
},
'targets': [
{
'target_name': 'action_before_build',
'type': 'none',
'hard_dependency': 1,
'actions': [
{
'action_name': 'install_deps',
'inputs': ['./node_modules/.bin/mason-js'],
'outputs': ['./mason_packages'],
'action': ['./node_modules/.bin/mason-js', 'install']
},
{
'action_name': 'link_deps',
'inputs': ['./node_modules/.bin/mason-js'],
'outputs': ['./mason_packages/.link'],
'action': ['./node_modules/.bin/mason-js', 'link']
}
]
},
{
'target_name': '<(module_name)',
'dependencies': [ 'action_before_build' ],
'product_dir': '<(module_path)',
'defines': [
# we set protozero_assert to avoid the tests asserting
# since we test they throw instead
'protozero_assert(x)',
'MBGL_USE_BUILTIN_ICU'
],
'sources': [
'./src/vtshaver.cpp',
'./src/shave.cpp',
'./src/filters.cpp',
'./mason_packages/.link/src/mbgl/tile/geometry_tile_data.cpp',
'./mason_packages/.link/platform/default/src/mbgl/layermanager/layer_manager.cpp',
# mbgl::LayerManager::annotationsEnabled
'./mason_packages/.link/platform/default/src/mbgl/layermanager/layer_manager.cpp',
# mbgl::util::impl::ThreadLocalBase::~ThreadLocalBase()
'./mason_packages/.link/platform/default/src/mbgl/util/thread_local.cpp',
# mbgl::platform::Collator::resolvedLocale() const
'./mason_packages/.link/platform/default/src/mbgl/i18n/collator.cpp',
# mbgl::util::convertUTF8ToUTF16(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
'./mason_packages/.link/platform/default/src/mbgl/util/utf.cpp',
# mbgl::platform::lowercase and mbgl::platform::upcase
'./mason_packages/.link/platform/default/src/mbgl/util/string_stdlib.cpp',
'./vendor/nunicode/src/libnu/ducet.c',
'./vendor/nunicode/src/libnu/strcoll.c',
'./vendor/nunicode/src/libnu/strings.c',
'./vendor/nunicode/src/libnu/tolower.c',
'./vendor/nunicode/src/libnu/tounaccent.c',
'./vendor/nunicode/src/libnu/toupper.c',
'./vendor/nunicode/src/libnu/utf8.c',
# Bring in mbgl::platform::formatNumber
'./mason_packages/.link/platform/default/src/mbgl/i18n/number_format.cpp',
],
# Not enabling eager binding because there are unused symbols declared but not defined (e.g., heatmap program)
# 'ldflags': [
# '-Wl,-z,now'
# ],
"libraries": [
# static linking (combining): Take a lib and smoosh it into the thing you're building.
# A portable file extension name. Build static lib (.a) then when you're linking,
# you're smooshing it into your lib. Static lib is linked when we build a project, rather than at runtime.
# But Dynamic lib is loaded at runtime. (.node is a type of dynamic lib cause it's loaded into node at runtime)
"<(module_root_dir)/mason_packages/.link/lib/libmbgl-core.a"
],
'conditions': [
['error_on_warnings == "true"', {
'cflags_cc' : [ '-Werror' ],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-Werror' ],
'OTHER_LDFLAGS': ['-framework Foundation']
}
}]
],
# Add to cpp glossary (or other doc in cpp repo) different types of binaries (.node, .a, static, dynamic (.so on linux and .dylib on osx))
# talk from cppcon by person from Apple, exploration of every builds systems in c++ are awful since theyre system-specific
'cflags': [
'<@(system_includes)',
'<@(compiler_checks)'
],
'xcode_settings': {
'OTHER_LDFLAGS':[
'-framework Foundation'
],
'OTHER_CFLAGS': [
"-isystem <(module_root_dir)/vendor/nunicode/include"
],
'OTHER_CPLUSPLUSFLAGS': [
'<@(system_includes)',
'<@(compiler_checks)'
],
'GCC_ENABLE_CPP_RTTI': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET':'10.11',
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_CXX_LANGUAGE_STANDARD':'c++14',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0'
}
}
]
}