Browse Source

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: https://github.com/nodejs/node/pull/7802

  PR-URL: https://github.com/nodejs/node/pull/7487
  Reviewed-By: Alexis Campailla <alexis@janeasystems.com>
  Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>

PR-URL: https://github.com/nodejs/node/pull/8084
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Stefan Budeanu 9 years ago
committed by James M Snell
parent
commit
4e4c091542
  1. 31
      common.gypi
  2. 1
      configure
  3. 3
      node.gyp
  4. 3
      vcbuild.bat

31
common.gypi

@ -12,6 +12,7 @@
'python%': 'python', 'python%': 'python',
'node_shared%': 'false', 'node_shared%': 'false',
'force_dynamic_crt%': 0,
'node_use_v8_platform%': 'true', 'node_use_v8_platform%': 'true',
'node_use_bundled_v8%': 'true', 'node_use_bundled_v8%': 'true',
'node_module_version%': '', 'node_module_version%': '',
@ -78,11 +79,24 @@
['OS == "android"', { ['OS == "android"', {
'cflags': [ '-fPIE' ], 'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ] 'ldflags': [ '-fPIE', '-pie' ]
}],
['node_shared=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3, # MultiThreadedDebugDLL (/MDd)
}
}
}],
['node_shared=="false"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1 # MultiThreadedDebug (/MTd)
}
}
}] }]
], ],
'msvs_settings': { 'msvs_settings': {
'VCCLCompilerTool': { 'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
'Optimization': 0, # /Od, no optimization 'Optimization': 0, # /Od, no optimization
'MinimalRebuild': 'false', 'MinimalRebuild': 'false',
'OmitFramePointers': 'false', 'OmitFramePointers': 'false',
@ -115,11 +129,24 @@
['OS == "android"', { ['OS == "android"', {
'cflags': [ '-fPIE' ], 'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ] 'ldflags': [ '-fPIE', '-pie' ]
}],
['node_shared=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2 # MultiThreadedDLL (/MD)
}
}
}],
['node_shared=="false"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0 # MultiThreaded (/MT)
}
}
}] }]
], ],
'msvs_settings': { 'msvs_settings': {
'VCCLCompilerTool': { 'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
'Optimization': 3, # /Ox, full optimization 'Optimization': 3, # /Ox, full optimization
'FavorSizeOrSpeed': 1, # /Ot, favour speed over size 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible

1
configure

@ -893,6 +893,7 @@ def configure_v8(o):
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
o['variables']['force_dynamic_crt'] = 1 if options.shared else 0
o['variables']['node_enable_d8'] = b(options.enable_d8) o['variables']['node_enable_d8'] = b(options.enable_d8)
if options.enable_d8: if options.enable_d8:
o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp. o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp.

3
node.gyp

@ -9,6 +9,7 @@
'node_use_v8_platform%': 'true', 'node_use_v8_platform%': 'true',
'node_use_bundled_v8%': 'true', 'node_use_bundled_v8%': 'true',
'node_shared%': 'false', 'node_shared%': 'false',
'force_dynamic_crt%': 0,
'node_module_version%': '', 'node_module_version%': '',
'node_shared_zlib%': 'false', 'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false', 'node_shared_http_parser%': 'false',
@ -247,7 +248,7 @@
'NODE_SHARED_MODE', 'NODE_SHARED_MODE',
], ],
'conditions': [ 'conditions': [
[ 'node_module_version!=""', { [ 'node_module_version!="" and OS!="win"', {
'product_extension': '<(shlib_suffix)', 'product_extension': '<(shlib_suffix)',
}] }]
], ],

3
vcbuild.bat

@ -38,6 +38,7 @@ set build_release=
set enable_vtune_arg= set enable_vtune_arg=
set configure_flags= set configure_flags=
set build_addons= set build_addons=
set dll=
:next-arg :next-arg
if "%1"=="" goto args-done if "%1"=="" goto args-done
@ -79,6 +80,7 @@ if /i "%1"=="without-intl" set i18n_arg=%1&goto arg-ok
if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok
if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok
if /i "%1"=="enable-vtune" set enable_vtune_arg=1&goto arg-ok if /i "%1"=="enable-vtune" set enable_vtune_arg=1&goto arg-ok
if /i "%1"=="dll" set dll=1&goto arg-ok
echo Warning: ignoring invalid command line option `%1`. echo Warning: ignoring invalid command line option `%1`.
@ -108,6 +110,7 @@ if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& se
if defined release_urlbase set release_urlbase_arg=--release-urlbase=%release_urlbase% if defined release_urlbase set release_urlbase_arg=--release-urlbase=%release_urlbase%
if defined download_arg set configure_flags=%configure_flags% %download_arg% if defined download_arg set configure_flags=%configure_flags% %download_arg%
if defined enable_vtune_arg set configure_flags=%configure_flags% --enable-vtune-profiling if defined enable_vtune_arg set configure_flags=%configure_flags% --enable-vtune-profiling
if defined dll set configure_flags=%configure_flags% --shared
if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu
if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu

Loading…
Cancel
Save