-
Notifications
You must be signed in to change notification settings - Fork 1
/
binding.gyp
250 lines (210 loc) · 6.7 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
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
{
"targets": [
{
"target_name": "greaseLog",
## required: build gperftools. Note the --enable-frame-pointers is needed on x86_64 systems
## ./configure --prefix=`pwd`/../build --enable-frame-pointers
##
## from their README
## NOTE: When compiling with programs with gcc, that you plan to link
## with libtcmalloc, it's safest to pass in the flags
##
## -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
"conditions": [
[
"OS=='mac'", {
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"WARNING_CFLAGS": [
"-Wno-unused-variable",
],
}
}
],
[
"OS=='linux'", {
"doit" : '<!(deps/install_deps.sh)',
"sources": [
"logger.cc",
"grease.cc",
"local_strdup.c",
"error-common.cc",
"grease_client.c",
"client_logger.cc",
"deps/twlib/tw_alloc.cpp",
"deps/twlib/tw_utils.cpp"
],
"ldflags" : [
],
"include_dirs": [
"deps/twlib/include",
"deps/build/include",
"node_modules/nan",
"<!(node -e \"require('nan')\")" # note, this is needed b/c with 'npm install' it places 'nan' in a different location - this may break in Yocto bb recipe
],
'link_settings': {
'libraries': [
'-ldl'
]
},
'configurations': {
'Debug': {
'defines': [ 'ERRCMN_DEBUG_BUILD', 'LOGGER_HEAVY_DEBUG', 'GREASE_DEBUG_MODE' ], # , 'LOGGER_HEAVY_DEBUG'
"cflags": [
"-Wall",
"-std=c++11",
"-D_POSIX_C_SOURCE=200809L",
"-D_GNU_SOURCE",
"-DERRCMN_DEBUG_BUILD=1",
# "-DLOGGER_HEAVY_DEBUG=1",
"-fno-omit-frame-pointer", # required by tcmalloc, but not a default on x86_64
## not needed since we explicitly call tcmalloc
## "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
],
"ldflags" : [
"-L../deps/build/lib",
## education: http://stackoverflow.com/questions/14889941/link-a-static-library-to-a-shared-one-during-build
"-Wl,-whole-archive ../deps/build/lib/libtcmalloc.a -Wl,-no-whole-archive"
]
## 'conditions': [
## ['target_arch=="x64"', {
## 'msvs_configuration_platform': 'x64',
## }],
## ]
},
'Release': {
"cflags": [
"-Wall",
"-std=c++11",
"-D_POSIX_C_SOURCE=200809L",
"-D_GNU_SOURCE",
"-fno-omit-frame-pointer", # required by tcmalloc, but not a default on x86_64
## not needed since we explicitly call tcmalloc
## "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
],
"ldflags" : [
"-L../deps/build/lib",
"-Wl,-whole-archive ../deps/build/lib/libtcmalloc.a -Wl,-no-whole-archive"
]
}
},
}
], # end Linux
]
}
,{
"target_name": "grease_echo",
"type": "executable",
'conditions': [
[ "OS =='linux'", {
"sources": [ "grease_echo.c", "grease_client.c" ],
'link_settings': {
'libraries': [
'-ldl'
]
},
'configurations': {
'Debug': {
"ldflags" : ["-ldl"],
"cflags" : ["-ldl","-DGLOG_DEFAULT_TAG=GREASE_TAG_ECHO"]
},
'Release': {
"ldflags" : ["-ldl"],
"cflags" : ["-ldl","-DGLOG_DEFAULT_TAG=GREASE_TAG_ECHO"]
}
}
} ] ]
},
{
"target_name": "greaseLogClient",
## required: build gperftools. Note the --enable-frame-pointers is needed on x86_64 systems
## ./configure --prefix=`pwd`/../build --enable-frame-pointers
##
## from their README
## NOTE: When compiling with programs with gcc, that you plan to link
## with libtcmalloc, it's safest to pass in the flags
##
## -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
"conditions": [
[
"OS=='mac'", {
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"WARNING_CFLAGS": [
"-Wno-unused-variable",
],
}
}
],
[
"OS=='linux'", {
"doit" : '<!(deps/install_deps.sh)',
"sources": [
"grease_clientonly.cc",
"local_strdup.c",
"error-common.cc",
"grease_client.c",
"client_logger.cc",
# "deps/twlib/tw_alloc.cpp",
# "deps/twlib/tw_utils.cpp"
],
"ldflags" : [
],
"include_dirs": [
"deps/twlib/include",
"deps/build/include",
"node_modules/nan",
"<!(node -e \"require('nan')\")" # note, this is needed b/c with 'npm install' it places 'nan' in a different location - this may break in Yocto bb recipe
],
'link_settings': {
'libraries': [
'-ldl'
]
},
'configurations': {
'Debug': {
'defines': [ 'ERRCMN_DEBUG_BUILD', 'LOGGER_HEAVY_DEBUG', 'GREASE_DEBUG_MODE' ], # , 'LOGGER_HEAVY_DEBUG'
"cflags": [
"-Wall",
"-std=c++11",
"-D_POSIX_C_SOURCE=200809L",
"-D_GNU_SOURCE",
"-DERRCMN_DEBUG_BUILD=1",
# "-DLOGGER_HEAVY_DEBUG=1",
"-fno-omit-frame-pointer", # required by tcmalloc, but not a default on x86_64
## not needed since we explicitly call tcmalloc
## "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
],
"ldflags" : [
"-L../deps/build/lib",
## education: http://stackoverflow.com/questions/14889941/link-a-static-library-to-a-shared-one-during-build
# "-Wl,-whole-archive ../deps/build/lib/libtcmalloc.a -Wl,-no-whole-archive"
]
## 'conditions': [
## ['target_arch=="x64"', {
## 'msvs_configuration_platform': 'x64',
## }],
## ]
},
'Release': {
"cflags": [
"-Wall",
"-std=c++11",
"-D_POSIX_C_SOURCE=200809L",
"-D_GNU_SOURCE",
"-fno-omit-frame-pointer", # required by tcmalloc, but not a default on x86_64
## not needed since we explicitly call tcmalloc
## "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
],
"ldflags" : [
"-L../deps/build/lib",
# "-Wl,-whole-archive ../deps/build/lib/libtcmalloc.a -Wl,-no-whole-archive"
]
}
},
}
], # end Linux
]
}
],
}