From 18772770f15cc0e64ba023535955fe323d444588 Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Wed, 29 Jun 2016 16:03:18 -0400 Subject: [PATCH 1/5] WIP: Windows Shared Lib --- common.gypi | 30 ++++++++++++++++++++++++++++-- deps/v8/build/toolchain.gypi | 6 +++--- node.gyp | 2 +- vcbuild.bat | 2 ++ 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/common.gypi b/common.gypi index 646db0d7bbb339..816e48230ddd5f 100644 --- a/common.gypi +++ b/common.gypi @@ -78,11 +78,24 @@ ['OS == "android"', { 'cflags': [ '-fPIE' ], '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': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug 'Optimization': 0, # /Od, no optimization 'MinimalRebuild': 'false', 'OmitFramePointers': 'false', @@ -115,11 +128,24 @@ ['OS == "android"', { 'cflags': [ '-fPIE' ], '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': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release 'Optimization': 3, # /Ox, full optimization 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index 6090898073082d..b0a56896880203 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -1104,7 +1104,7 @@ 'VCCLCompilerTool': { 'Optimization': '0', 'conditions': [ - ['component=="shared_library"', { + ['component=="shared_library" or node_shared=="true"', { 'RuntimeLibrary': '3', # /MDd }, { 'RuntimeLibrary': '1', # /MTd @@ -1156,7 +1156,7 @@ 'StringPooling': 'true', 'BasicRuntimeChecks': '0', 'conditions': [ - ['component=="shared_library"', { + ['component=="shared_library" or node_shared=="true"', { 'RuntimeLibrary': '3', #/MDd }, { 'RuntimeLibrary': '1', #/MTd @@ -1347,7 +1347,7 @@ 'FavorSizeOrSpeed': '0', 'StringPooling': 'true', 'conditions': [ - ['component=="shared_library"', { + ['component=="shared_library" or node_shared=="true"', { 'RuntimeLibrary': '2', #/MD }, { 'RuntimeLibrary': '0', #/MT diff --git a/node.gyp b/node.gyp index d6fb9b2449c9fb..14f18f5a6e82a6 100644 --- a/node.gyp +++ b/node.gyp @@ -243,7 +243,7 @@ 'NODE_SHARED_MODE', ], 'conditions': [ - [ 'node_module_version!=""', { + [ 'node_module_version!="" and OS!="win"', { 'product_extension': 'so.<(node_module_version)', }] ], diff --git a/vcbuild.bat b/vcbuild.bat index f95cfca8b390a9..50799d26190b34 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -79,6 +79,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"=="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"=="dll" set dll=1&goto arg-ok echo Warning: ignoring invalid command line option `%1`. @@ -108,6 +109,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 download_arg set configure_flags=%configure_flags% %download_arg% 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%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu From db00e244bfdb7ebf4d65eab54b63d27324b0faad Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Wed, 6 Jul 2016 17:41:40 -0400 Subject: [PATCH 2/5] WIP: Review Fix --- vcbuild.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vcbuild.bat b/vcbuild.bat index 50799d26190b34..fd0fa3c78e04c1 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -38,6 +38,7 @@ set build_release= set enable_vtune_arg= set configure_flags= set build_addons= +set dll= :next-arg if "%1"=="" goto args-done From 406d774a755ab3912ef92da25bc3b92b51bbf25d Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Tue, 19 Jul 2016 07:45:39 -0400 Subject: [PATCH 3/5] WIP: Use force_dynamic_crt v8 flag --- common.gypi | 1 + configure | 1 + deps/v8/build/toolchain.gypi | 7 ++++--- node.gyp | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index 816e48230ddd5f..a74abee1cbdb60 100644 --- a/common.gypi +++ b/common.gypi @@ -12,6 +12,7 @@ 'python%': 'python', 'node_shared%': 'false', + 'force_dynamic_crt%': 0, 'node_use_v8_platform%': 'true', 'node_use_bundled_v8%': 'true', 'node_module_version%': '', diff --git a/configure b/configure index b23bfc36a282d0..d8d3bb78e08b5b 100755 --- a/configure +++ b/configure @@ -889,6 +889,7 @@ def configure_v8(o): 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_bundled_v8'] = b(not options.without_bundled_v8) + o['variables']['force_dynamic_crt'] = int(options.shared) o['variables']['node_enable_d8'] = b(options.enable_d8) if options.enable_d8: o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp. diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index b0a56896880203..519779edb4f503 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -39,6 +39,7 @@ 'ubsan_vptr%': 0, 'v8_target_arch%': '<(target_arch)', 'v8_host_byteorder%': ' Date: Tue, 19 Jul 2016 11:11:42 -0400 Subject: [PATCH 4/5] WIP: Fix option value --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index d8d3bb78e08b5b..c117486f99bcc8 100755 --- a/configure +++ b/configure @@ -889,7 +889,7 @@ def configure_v8(o): 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_bundled_v8'] = b(not options.without_bundled_v8) - o['variables']['force_dynamic_crt'] = int(options.shared) + o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 o['variables']['node_enable_d8'] = b(options.enable_d8) if options.enable_d8: o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp. From c191e895ba0800b189b1c4e303e25655ac95d1a1 Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Tue, 19 Jul 2016 20:50:02 -0400 Subject: [PATCH 5/5] WIP: Remove V8 changes --- deps/v8/build/toolchain.gypi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index 519779edb4f503..6090898073082d 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -39,7 +39,6 @@ 'ubsan_vptr%': 0, 'v8_target_arch%': '<(target_arch)', 'v8_host_byteorder%': '