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