Skip to content

Commit 0138b4d

Browse files
Stewart AddisonMyles Borins
Stewart Addison
authored and
Myles Borins
committed
build: windows sharedlib support
Original Commit Message: Added "dll" option to vcbuild.bat Insure that Unix SO name is not used on Windows (i.e. produce a .dll file) Insure that Node and its V8 dependency link against the Visual C++ Runtime dynamically. Requires backported V8 patch, see PR 7802. Ref: #7802 PR-URL: #7487 Reviewed-By: Alexis Campailla <[email protected]> Reviewed-By: Michael Dawson <[email protected]> PR-URL: #9385 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent f21c2b9 commit 0138b4d

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

common.gypi

+28-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@
7979
['OS == "android"', {
8080
'cflags': [ '-fPIE' ],
8181
'ldflags': [ '-fPIE', '-pie' ]
82+
}],
83+
['node_shared=="true"', {
84+
'msvs_settings': {
85+
'VCCLCompilerTool': {
86+
'RuntimeLibrary': 3 # MultiThreadedDebugDLL (/MDd)
87+
}
88+
}
89+
}],
90+
['node_shared=="false"', {
91+
'msvs_settings': {
92+
'VCCLCompilerTool': {
93+
'RuntimeLibrary': 1 # MultiThreadedDebug (/MTd)
94+
}
95+
}
8296
}]
8397
],
8498
'msvs_settings': {
@@ -116,11 +130,24 @@
116130
['OS == "android"', {
117131
'cflags': [ '-fPIE' ],
118132
'ldflags': [ '-fPIE', '-pie' ]
133+
}],
134+
['node_shared=="true"', {
135+
'msvs_settings': {
136+
'VCCLCompilerTool': {
137+
'RuntimeLibrary': 2 # MultiThreadedDLL (/MD)
138+
}
139+
}
140+
}],
141+
['node_shared=="false"', {
142+
'msvs_settings': {
143+
'VCCLCompilerTool': {
144+
'RuntimeLibrary': 0 # MultiThreaded (/MT)
145+
}
146+
}
119147
}]
120148
],
121149
'msvs_settings': {
122150
'VCCLCompilerTool': {
123-
'RuntimeLibrary': 0, # static release
124151
'Optimization': 3, # /Ox, full optimization
125152
'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
126153
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible

node.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
'NODE_SHARED_MODE',
243243
],
244244
'conditions': [
245-
[ 'node_module_version!=""', {
245+
[ 'node_module_version!="" and OS!="win"', {
246246
'product_extension': 'so.<(node_module_version)',
247247
}]
248248
],

vcbuild.bat

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ set build_release=
3737
set configure_flags=
3838
set build_addons=
3939
set enable_vtune_profiling=
40+
set dll=
4041

4142
:next-arg
4243
if "%1"=="" goto args-done
@@ -76,6 +77,7 @@ if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok
7677
if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok
7778
if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok
7879
if /i "%1"=="enable-vtune" set enable_vtune_profiling="--enable-vtune-profiling"&goto arg-ok
80+
if /i "%1"=="dll" set dll=1&goto arg-ok
7981

8082
echo Error: invalid command line option `%1`.
8183
exit /b 1
@@ -105,6 +107,7 @@ if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_
105107
if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
106108
if defined release_urlbase set configure_flags=%configure_flags% --release-urlbase=%release_urlbase%
107109
if defined download_arg set configure_flags=%configure_flags% %download_arg%
110+
if defined dll set configure_flags=%configure_flags% --shared
108111

109112
if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu
110113
if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu

0 commit comments

Comments
 (0)