common.gypi 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. {
  2. 'includes': [
  3. 'toolchain.gypi',
  4. 'brightray/brightray.gypi',
  5. ],
  6. 'variables': {
  7. # Tell crashpad to build as external project.
  8. 'crashpad_dependencies': 'external',
  9. # Required by breakpad.
  10. 'os_bsd': 0,
  11. 'chromeos': 0,
  12. # Reflects node's config.gypi.
  13. 'component%': 'static_library',
  14. 'debug_http2': 'false',
  15. 'debug_nghttp2': 'false',
  16. # XXX(alexeykuzmin): Must match the clang version we use. See `clang -v`.
  17. 'llvm_version': '6.0',
  18. 'python': 'python',
  19. 'openssl_fips': '',
  20. 'openssl_no_asm': 1,
  21. 'use_openssl_def': 0,
  22. 'openssl_product': 'libopenssl.a',
  23. 'node_release_urlbase': 'https://atom.io/download/electron',
  24. 'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)',
  25. 'node_target_type': 'shared_library',
  26. 'node_install_npm': 'false',
  27. 'node_prefix': '',
  28. 'node_shared': 'true',
  29. 'node_shared_cares': 'false',
  30. 'node_shared_http_parser': 'false',
  31. 'node_shared_libuv': 'false',
  32. 'node_shared_openssl': 'false',
  33. 'node_shared_v8': 'true',
  34. 'node_shared_zlib': 'false',
  35. 'node_tag': '',
  36. 'node_use_dtrace': 'false',
  37. 'node_use_etw': 'false',
  38. 'node_use_mdb': 'false',
  39. 'node_use_openssl': 'true',
  40. 'node_use_perfctr': 'false',
  41. 'node_use_v8_platform': 'false',
  42. 'node_use_bundled_v8': 'false',
  43. 'node_enable_d8': 'false',
  44. 'uv_library': 'static_library',
  45. 'uv_parent_path': 'vendor/node/deps/uv',
  46. 'uv_use_dtrace': 'false',
  47. 'v8_base': '',
  48. 'v8_postmortem_support': 'false',
  49. 'v8_enable_i18n_support': 'false',
  50. 'v8_enable_inspector': '1',
  51. },
  52. # Settings to compile node under Windows.
  53. 'target_defaults': {
  54. 'target_conditions': [
  55. ['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node_lib", "zlib", "nghttp2"]', {
  56. 'msvs_disabled_warnings': [
  57. 4003, # not enough actual parameters for macro 'V'
  58. 4013, # 'free' undefined; assuming extern returning int
  59. 4018, # signed/unsigned mismatch
  60. 4054, #
  61. 4055, # 'type cast' : from data pointer 'void *' to function pointer
  62. 4057, # 'function' : 'volatile LONG *' differs in indirection to slightly different base types from 'unsigned long *'
  63. 4065, # switch statement contains 'default' but no 'case' labels
  64. 4129, # unrecognized character escape sequence
  65. 4189, #
  66. 4131, # uses old-style declarator
  67. 4133, # incompatible types
  68. 4146, # unary minus operator applied to unsigned type, result still unsigned
  69. 4164, # intrinsic function not declared
  70. 4152, # function/data pointer conversion in expression
  71. 4206, # translation unit is empty
  72. 4204, # non-constant aggregate initializer
  73. 4210, # nonstandard extension used : function given file scope
  74. 4214, # bit field types other than int
  75. 4232, # address of dllimport 'free' is not static, identity not guaranteed
  76. 4291, # no matching operator delete found
  77. 4295, # array is too small to include a terminating null character
  78. 4309, # 'static_cast': truncation of constant value
  79. 4311, # 'type cast': pointer truncation from 'void *const ' to 'unsigned long'
  80. 4389, # '==' : signed/unsigned mismatch
  81. 4456, # declaration of 'm' hides previous local declaration
  82. 4457, # declaration of 'message' hides function parameter
  83. 4459, # declaration of 'wq' hides global declaration
  84. 4477, # format string '%.*s' requires an argument of type 'int'
  85. 4505, # unreferenced local function has been removed
  86. 4701, # potentially uninitialized local variable 'sizew' used
  87. 4703, # potentially uninitialized local pointer variable 'req' used
  88. 4706, # assignment within conditional expression
  89. 4804, # unsafe use of type 'bool' in operation
  90. 4996, # this function or variable may be unsafe.
  91. ],
  92. 'msvs_settings': {
  93. 'VCCLCompilerTool': {
  94. 'WarnAsError': 'false',
  95. },
  96. },
  97. 'xcode_settings': {
  98. 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
  99. 'WARNING_CFLAGS': [
  100. '-Wno-unknown-warning-option',
  101. '-Wno-parentheses-equality',
  102. '-Wno-unused-function',
  103. '-Wno-sometimes-uninitialized',
  104. '-Wno-pointer-sign',
  105. '-Wno-sign-compare',
  106. '-Wno-string-plus-int',
  107. '-Wno-unused-variable',
  108. '-Wno-deprecated-declarations',
  109. '-Wno-return-type',
  110. '-Wno-gnu-folding-constant',
  111. '-Wno-shift-negative-value',
  112. '-Wno-varargs', # https://git.io/v6Olj
  113. '-Wno-unused-private-field',
  114. ],
  115. },
  116. 'conditions': [
  117. ['OS=="linux"', {
  118. 'cflags': [
  119. '-Wno-unused-function',
  120. '-Wno-unused-variable',
  121. '-Wno-unused-value',
  122. '-Wno-deprecated-declarations',
  123. '-Wno-return-type',
  124. '-Wno-format',
  125. '-Wno-varargs', # https://git.io/v6Olj
  126. # Required when building as shared library.
  127. '-fPIC',
  128. ],
  129. }],
  130. ['OS=="linux" and clang==1', {
  131. 'cflags': [
  132. '-Wno-pointer-sign',
  133. '-Wno-parentheses-equality',
  134. '-Wno-sometimes-uninitialized',
  135. '-Wno-string-plus-int',
  136. '-Wno-shift-negative-value',
  137. '-Wno-reserved-user-defined-literal',
  138. '-Wno-implicit-function-declaration',
  139. '-Wno-long-long',
  140. ],
  141. }],
  142. ],
  143. }],
  144. ['_target_name=="node_lib"', {
  145. 'include_dirs': [
  146. '<(libchromiumcontent_src_dir)',
  147. '<(libchromiumcontent_src_dir)/third_party/icu/source/common',
  148. '<(libchromiumcontent_src_dir)/third_party/icu/source/i18n',
  149. '<(libchromiumcontent_src_dir)/v8',
  150. '<(libchromiumcontent_src_dir)/v8/include',
  151. ],
  152. 'defines': [
  153. # Export V8 symbols from node.dll / libnode.so
  154. 'BUILDING_V8_SHARED',
  155. 'BUILDING_V8_PLATFORM_SHARED',
  156. 'BUILDING_V8_BASE_SHARED',
  157. ],
  158. 'conditions': [
  159. ['OS=="mac" and libchromiumcontent_component==0', {
  160. # -all_load is the "whole-archive" on macOS.
  161. 'xcode_settings': {
  162. 'OTHER_LDFLAGS': [ '-Wl,-all_load' ],
  163. },
  164. }],
  165. ['OS=="win"', {
  166. # Fix passing fd across modules, see |osfhandle.h| for more.
  167. 'sources': [
  168. '<(DEPTH)/atom/node/osfhandle.cc',
  169. '<(DEPTH)/atom/node/osfhandle.h',
  170. ],
  171. 'include_dirs': [
  172. '<(DEPTH)/atom/node',
  173. ],
  174. 'libraries': [
  175. # Node is using networking API but linking with this itself.
  176. '-lwinmm.lib',
  177. # Needed by V8.
  178. '-ldbghelp.lib',
  179. '-lshlwapi.lib',
  180. ],
  181. 'msvs_settings': {
  182. # Change location of some hard-coded paths.
  183. 'VCLinkerTool': {
  184. 'AdditionalOptions!': [
  185. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)',
  186. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)',
  187. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libopenssl<(openssl_product)',
  188. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\<(openssl_product)',
  189. ],
  190. 'AdditionalOptions': [
  191. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\vendor\\node\\deps\\zlib\\zlib<(STATIC_LIB_SUFFIX)',
  192. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\vendor\\node\\deps\\uv\\libuv<(STATIC_LIB_SUFFIX)',
  193. '/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\vendor\\node\\deps\\openssl\\openssl<(STATIC_LIB_SUFFIX)',
  194. ],
  195. },
  196. },
  197. }],
  198. ['OS=="linux" and libchromiumcontent_component==0', {
  199. # Prevent the linker from stripping symbols.
  200. 'ldflags': [
  201. '-Wl,--whole-archive',
  202. '<@(libchromiumcontent_v8_libraries)',
  203. '-Wl,--no-whole-archive',
  204. ],
  205. }, {
  206. 'libraries': [
  207. '<@(libchromiumcontent_v8_libraries)',
  208. ],
  209. }],
  210. ],
  211. }],
  212. ['_target_name=="openssl"', {
  213. 'xcode_settings': {
  214. 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
  215. 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
  216. 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
  217. },
  218. 'cflags': [
  219. '-fvisibility=hidden',
  220. ],
  221. }],
  222. ['_target_name=="openssl-cli"', {
  223. 'ldflags!': [
  224. '-nostdlib++',
  225. ]
  226. }],
  227. ['_target_name=="libuv"', {
  228. 'conditions': [
  229. ['OS=="win"', {
  230. # Expose libuv's symbols.
  231. 'defines': [
  232. 'BUILDING_UV_SHARED=1',
  233. ],
  234. }], # OS=="win"
  235. ],
  236. }],
  237. ['_target_name.startswith("crashpad")', {
  238. 'conditions': [
  239. ['OS=="mac"', {
  240. 'xcode_settings': {
  241. 'WARNING_CFLAGS': [
  242. '-Wno-unused-private-field',
  243. '-Wno-address-of-packed-member',
  244. ],
  245. },
  246. }], # OS=="mac"
  247. ],
  248. }],
  249. ['_target_name.startswith("breakpad") or _target_name in ["crash_report_sender", "dump_syms"]', {
  250. 'conditions': [
  251. ['OS=="mac"', {
  252. 'xcode_settings': {
  253. 'WARNING_CFLAGS': [
  254. '-Wno-deprecated-declarations',
  255. '-Wno-deprecated-register',
  256. '-Wno-unused-private-field',
  257. '-Wno-unused-function',
  258. ],
  259. },
  260. }], # OS=="mac"
  261. ['OS=="linux"', {
  262. 'cflags': [
  263. '-Wno-empty-body',
  264. ],
  265. }], # OS=="linux"
  266. ['OS=="win"', {
  267. 'msvs_disabled_warnings': [
  268. # unreferenced local function has been removed.
  269. 4505,
  270. ],
  271. }], # OS=="win"
  272. ],
  273. }],
  274. ['OS=="linux" and _toolset=="target" and _target_name in ["dump_syms", "node_lib"]', {
  275. 'conditions': [
  276. ['libchromiumcontent_component==0', {
  277. 'libraries': [
  278. '<(libchromiumcontent_dir)/libc++.a',
  279. ],
  280. 'ldflags': [
  281. '-lpthread',
  282. ],
  283. }, {
  284. 'libraries': [
  285. '<(libchromiumcontent_dir)/libc++.so',
  286. ],
  287. 'ldflags': [
  288. '-Wl,-rpath=\$$ORIGIN',
  289. ],
  290. }],
  291. ],
  292. }]
  293. ],
  294. 'msvs_cygwin_shell': 0, # Strangely setting it to 1 would make building under cygwin fail.
  295. 'msvs_disabled_warnings': [
  296. 4005, # (node.h) macro redefinition
  297. 4091, # (node_extern.h) '__declspec(dllimport)' : ignored on left of 'node::Environment' when no variable is declared
  298. 4099, # (pdf_render_settings.h) type name first seen using 'class' now seen using 'struct'
  299. 4189, # local variable is initialized but not referenced
  300. 4201, # (uv.h) nameless struct/union
  301. 4267, # conversion from 'size_t' to 'int', possible loss of data
  302. 4302, # (atldlgs.h) 'type cast': truncation from 'LPCTSTR' to 'WORD'
  303. 4458, # (atldlgs.h) declaration of 'dwCommonButtons' hides class member
  304. 4503, # decorated name length exceeded, name was truncated
  305. 4530, # C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  306. 4577, # 'noexcept' used with no exception handling mode specified
  307. 4714, # (atomicstring.h) function marked as __forceinline not inlined
  308. 4800, # (v8.h) forcing value to bool 'true' or 'false'
  309. 4819, # The file contains a character that cannot be represented in the current code page
  310. 4838, # (atlgdi.h) conversion from 'int' to 'UINT' requires a narrowing conversion
  311. 4996, # (atlapp.h) 'GetVersionExW': was declared deprecated
  312. ],
  313. },
  314. 'conditions': [
  315. # The breakdpad on Windows assumes Debug_x64 and Release_x64 configurations.
  316. ['OS=="win"', {
  317. 'target_defaults': {
  318. 'configurations': {
  319. 'Debug_x64': {
  320. },
  321. 'Release_x64': {
  322. },
  323. },
  324. },
  325. }], # OS=="win"
  326. # The breakdpad on Mac assumes Release_Base configuration.
  327. ['OS=="mac"', {
  328. 'target_defaults': {
  329. 'configurations': {
  330. 'Release_Base': {
  331. },
  332. },
  333. },
  334. }], # OS=="mac"
  335. ],
  336. }