Skip to content

Commit c8d25c5

Browse files
authored
allow node-gyp to use open source toolchains on windows
It is a bit too biased towards propietary toolchains, this will diversify the supported toolchains of node-gyp
1 parent 7d883b5 commit c8d25c5

2 files changed

Lines changed: 218 additions & 104 deletions

File tree

addon.gypi

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
'node_engine_include_dir%': 'deps/v8/include',
44
'node_host_binary%': 'node',
55
'node_with_ltcg%': 'true',
6+
'os_type%': '<!(node -p "require(\'os\').type()")',
67
},
78
'target_defaults': {
89
'type': 'loadable_module',
@@ -165,23 +166,44 @@
165166
]
166167
}
167168
}
169+
}],
170+
# Detect MSYS2/MinGW vs MSVC based on os.type()
171+
[ 'os_type.startswith("MINGW")', {
172+
# MSYS2/MinGW/GCC libraries
173+
'libraries': [
174+
'-lkernel32',
175+
'-luser32',
176+
'-lgdi32',
177+
'-lwinspool',
178+
'-lcomdlg32',
179+
'-ladvapi32',
180+
'-lshell32',
181+
'-lole32',
182+
'-loleaut32',
183+
'-luuid',
184+
'-lodbc32',
185+
'-lDelayImp',
186+
'-lnode',
187+
],
188+
}, {
189+
# MSVC libraries (Windows_NT)
190+
'libraries': [
191+
'-lkernel32.lib',
192+
'-luser32.lib',
193+
'-lgdi32.lib',
194+
'-lwinspool.lib',
195+
'-lcomdlg32.lib',
196+
'-ladvapi32.lib',
197+
'-lshell32.lib',
198+
'-lole32.lib',
199+
'-loleaut32.lib',
200+
'-luuid.lib',
201+
'-lodbc32.lib',
202+
'-lDelayImp.lib',
203+
'-l"<(node_lib_file)"'
204+
],
168205
}]
169206
],
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-
],
185207
'msvs_disabled_warnings': [
186208
# warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
187209
# needs to have dll-interface to be used by

0 commit comments

Comments
 (0)