From ac7946eb08b2d23411a994d093fd3e68ae205533 Mon Sep 17 00:00:00 2001 From: Richard Townsend Date: Tue, 24 Mar 2020 18:57:08 +0000 Subject: [PATCH] build,win: add support for MSVC cross-compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixes cases in icutools where commands were issued without .exe * Changes to build scripts * Add /fp:strict flag so that MSVC's floating point behaves correctly * Enables marmasm PR-URL: https://github.com/nodejs/node/pull/32867 Reviewed-By: Christian Clauss Reviewed-By: João Reis --- common.gypi | 5 +++++ configure.py | 2 ++ tools/icu/icu-generic.gyp | 14 +++++++------- tools/v8_gypfiles/v8.gyp | 13 +++++++++++++ vcbuild.bat | 1 + 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/common.gypi b/common.gypi index 5e4f9b6dba1dce..59dc70e4dd39c4 100644 --- a/common.gypi +++ b/common.gypi @@ -193,6 +193,11 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { + 'conditions': [ + ['target_arch=="arm64"', { + 'FloatingPointModel': 1 # /fp:strict + }] + ], 'EnableFunctionLevelLinking': 'true', 'EnableIntrinsicFunctions': 'true', 'FavorSizeOrSpeed': 1, # /Ot, favor speed over size diff --git a/configure.py b/configure.py index ac26f62916cd06..a8cdce4d225427 100755 --- a/configure.py +++ b/configure.py @@ -1041,6 +1041,8 @@ def configure_node(o): cross_compiling = (options.cross_compiling if options.cross_compiling is not None else target_arch != host_arch) + if cross_compiling: + os.environ['GYP_CROSSCOMPILE'] = "1" if options.unused_without_snapshot: warn('building --without-snapshot is no longer possible') diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp index d2d0e5a3180213..680f8528df1384 100644 --- a/tools/icu/icu-generic.gyp +++ b/tools/icu/icu-generic.gyp @@ -197,7 +197,7 @@ }], ['_toolset=="host"', { 'type': 'none', - 'dependencies': [ 'icutools' ], + 'dependencies': [ 'icutools#host' ], 'export_dependent_settings': [ 'icutools' ], }], ], @@ -221,7 +221,7 @@ 'inputs': [ '<(icu_data_in)' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ], # on Windows, we can go directly to .obj file (-o) option. - 'action': [ '<(PRODUCT_DIR)/genccode', + 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)', '<@(icu_asm_opts)', # -o '-d', '<(SHARED_INTERMEDIATE_DIR)', '-n', 'icudata', @@ -258,7 +258,7 @@ 'msvs_quote_cmd': 0, 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ], - 'action': [ '<(PRODUCT_DIR)/genccode', + 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)', '<@(icu_asm_opts)', # -o '-d', '<(SHARED_INTERMEDIATE_DIR)/', '-n', 'icudata', @@ -284,7 +284,7 @@ 'action_name': 'icupkg', 'inputs': [ '<(icu_data_in)' ], 'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness).dat' ], - 'action': [ '<(PRODUCT_DIR)/icupkg', + 'action': [ '<(PRODUCT_DIR)/icupkg<(EXECUTABLE_SUFFIX)', '-t<(icu_endianness)', '<@(_inputs)', '<@(_outputs)', @@ -305,7 +305,7 @@ 'action_name': 'icudata', 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major).dat' ], 'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)_dat.<(icu_asm_ext)' ], - 'action': [ '<(PRODUCT_DIR)/genccode', + 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)', '-e', 'icudt<(icu_ver_major)', '-d', '<(SHARED_INTERMEDIATE_DIR)', '<@(icu_asm_opts)', @@ -350,7 +350,7 @@ 'action_name': 'genccode', 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ], - 'action': [ '<(PRODUCT_DIR)/genccode', + 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)', '<@(icu_asm_opts)', '-d', '<(SHARED_INTERMEDIATE_DIR)', '<@(_inputs)' ], @@ -388,7 +388,7 @@ 'toolsets': [ 'target', 'host' ], 'conditions' : [ ['_toolset=="host"', { - 'dependencies': [ 'icutools' ], + 'dependencies': [ 'icutools#host' ], 'export_dependent_settings': [ 'icutools' ], }], ['_toolset=="target"', { diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 615e25b007ff69..9a2378a880118c 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -461,6 +461,11 @@ 'toolsets': ['target'], 'conditions': [ ['want_separate_host_toolset', { + 'conditions': [ + ['v8_target_arch=="arm64"', { + 'msvs_enable_marmasm': 1, + }] + ], 'dependencies': [ 'generate_bytecode_builtins_list', 'run_torque', @@ -766,6 +771,14 @@ 'sources': [ ### gcmole(arch:arm64) ### '