addon.gypi 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. {
  2. 'variables' : {
  3. 'node_engine_include_dir%': 'deps/v8/include',
  4. 'node_host_binary%': 'node',
  5. 'node_with_ltcg%': 'true',
  6. },
  7. 'target_defaults': {
  8. 'type': 'loadable_module',
  9. 'win_delay_load_hook': 'true',
  10. 'product_prefix': '',
  11. 'conditions': [
  12. [ 'node_engine=="chakracore"', {
  13. 'variables': {
  14. 'node_engine_include_dir%': 'deps/chakrashim/include'
  15. },
  16. }]
  17. ],
  18. 'include_dirs': [
  19. '<(node_root_dir)/include/node',
  20. '<(node_root_dir)/src',
  21. '<(node_root_dir)/deps/openssl/config',
  22. '<(node_root_dir)/deps/openssl/openssl/include',
  23. '<(node_root_dir)/deps/uv/include',
  24. '<(node_root_dir)/deps/zlib',
  25. '<(node_root_dir)/<(node_engine_include_dir)'
  26. ],
  27. 'defines!': [
  28. 'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
  29. 'BUILDING_V8_SHARED=1', # Inherited from common.gypi.
  30. ],
  31. 'defines': [
  32. 'NODE_GYP_MODULE_NAME=>(_target_name)',
  33. 'USING_UV_SHARED=1',
  34. 'USING_V8_SHARED=1',
  35. # Warn when using deprecated V8 APIs.
  36. 'V8_DEPRECATION_WARNINGS=1'
  37. ],
  38. 'target_conditions': [
  39. ['_type=="loadable_module"', {
  40. 'product_extension': 'node',
  41. 'defines': [
  42. 'BUILDING_NODE_EXTENSION'
  43. ],
  44. 'xcode_settings': {
  45. 'OTHER_LDFLAGS': [
  46. '-undefined dynamic_lookup'
  47. ],
  48. },
  49. }],
  50. ['_type=="static_library"', {
  51. # set to `1` to *disable* the -T thin archive 'ld' flag.
  52. # older linkers don't support this flag.
  53. 'standalone_static_library': '<(standalone_static_library)'
  54. }],
  55. ['_type!="executable"', {
  56. 'conditions': [
  57. [ 'OS=="android"', {
  58. 'cflags!': [ '-fPIE' ],
  59. }]
  60. ]
  61. }],
  62. ['_win_delay_load_hook=="true"', {
  63. # If the addon specifies `'win_delay_load_hook': 'true'` in its
  64. # binding.gyp, link a delay-load hook into the DLL. This hook ensures
  65. # that the addon will work regardless of whether the node/iojs binary
  66. # is named node.exe, iojs.exe, or something else.
  67. 'conditions': [
  68. [ 'OS=="win"', {
  69. 'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ],
  70. 'sources': [
  71. '<(node_gyp_dir)/src/win_delay_load_hook.cc',
  72. ],
  73. 'msvs_settings': {
  74. 'VCLinkerTool': {
  75. 'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],
  76. # Don't print a linker warning when no imports from either .exe
  77. # are used.
  78. 'AdditionalOptions': [ '/ignore:4199' ],
  79. },
  80. },
  81. }],
  82. ],
  83. }],
  84. ],
  85. 'conditions': [
  86. [ 'OS=="mac"', {
  87. 'defines': [
  88. '_DARWIN_USE_64_BIT_INODE=1'
  89. ],
  90. 'xcode_settings': {
  91. 'DYLIB_INSTALL_NAME_BASE': '@rpath'
  92. },
  93. }],
  94. [ 'OS=="aix"', {
  95. 'ldflags': [
  96. '-Wl,-bimport:<(node_exp_file)'
  97. ],
  98. }],
  99. [ 'OS=="zos"', {
  100. 'cflags': [
  101. '-q64',
  102. '-Wc,DLL',
  103. '-qlonglong',
  104. '-qenum=int',
  105. '-qxclang=-fexec-charset=ISO8859-1'
  106. ],
  107. 'defines': [
  108. '_ALL_SOURCE=1',
  109. 'MAP_FAILED=-1',
  110. '_UNIX03_SOURCE=1'
  111. ],
  112. 'ldflags': [
  113. '-q64',
  114. '<(node_exp_file)'
  115. ],
  116. }],
  117. [ 'OS=="win"', {
  118. 'conditions': [
  119. ['node_engine=="chakracore"', {
  120. 'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
  121. 'libraries': [ '<@(node_engine_libs)' ],
  122. }],
  123. ['node_with_ltcg=="true"', {
  124. 'msvs_settings': {
  125. 'VCCLCompilerTool': {
  126. 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
  127. },
  128. 'VCLibrarianTool': {
  129. 'AdditionalOptions': [
  130. '/LTCG:INCREMENTAL', # incremental link-time code generation
  131. ]
  132. },
  133. 'VCLinkerTool': {
  134. 'OptimizeReferences': 2, # /OPT:REF
  135. 'EnableCOMDATFolding': 2, # /OPT:ICF
  136. 'LinkIncremental': 1, # disable incremental linking
  137. 'AdditionalOptions': [
  138. '/LTCG:INCREMENTAL', # incremental link-time code generation
  139. ]
  140. }
  141. }
  142. }]
  143. ],
  144. 'libraries': [
  145. '-lkernel32.lib',
  146. '-luser32.lib',
  147. '-lgdi32.lib',
  148. '-lwinspool.lib',
  149. '-lcomdlg32.lib',
  150. '-ladvapi32.lib',
  151. '-lshell32.lib',
  152. '-lole32.lib',
  153. '-loleaut32.lib',
  154. '-luuid.lib',
  155. '-lodbc32.lib',
  156. '-lDelayImp.lib',
  157. '-l"<(node_lib_file)"'
  158. ],
  159. 'msvs_disabled_warnings': [
  160. # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
  161. # needs to have dll-interface to be used by
  162. # clients of class 'node::ObjectWrap'
  163. 4251
  164. ],
  165. }, {
  166. # OS!="win"
  167. 'defines': [
  168. '_LARGEFILE_SOURCE',
  169. '_FILE_OFFSET_BITS=64'
  170. ],
  171. }],
  172. [ 'OS in "freebsd openbsd netbsd solaris android" or \
  173. (OS=="linux" and target_arch!="ia32")', {
  174. 'cflags': [ '-fPIC' ],
  175. }],
  176. ]
  177. }
  178. }