Skip to content

Commit

Permalink
build,win: add support for MSVC cross-compilation
Browse files Browse the repository at this point in the history
* 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: #32867
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: João Reis <reis@janeasystems.com>
  • Loading branch information
richard-townsend-arm authored and joaocgreis committed May 19, 2020
1 parent 66807e9 commit 8833551
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
5 changes: 5 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
14 changes: 7 additions & 7 deletions tools/icu/icu-generic.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
}],
['_toolset=="host"', {
'type': 'none',
'dependencies': [ 'icutools' ],
'dependencies': [ 'icutools#host' ],
'export_dependent_settings': [ 'icutools' ],
}],
],
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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)',
Expand All @@ -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)',
Expand Down Expand Up @@ -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)' ],
Expand Down Expand Up @@ -388,7 +388,7 @@
'toolsets': [ 'target', 'host' ],
'conditions' : [
['_toolset=="host"', {
'dependencies': [ 'icutools' ],
'dependencies': [ 'icutools#host' ],
'export_dependent_settings': [ 'icutools' ],
}],
['_toolset=="target"', {
Expand Down
13 changes: 13 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@
'toolsets': ['target'],
'conditions': [
['want_separate_host_toolset', {
'conditions': [
['v8_target_arch=="arm64"', {
'msvs_enable_marmasm': 1,
}]
],
'dependencies': [
'generate_bytecode_builtins_list',
'run_torque',
Expand Down Expand Up @@ -785,6 +790,14 @@
'sources': [ ### gcmole(arch:arm64) ###
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"arm64\\".*?sources \+= ")',
],
'conditions': [
['OS=="win"', {
'sources': [
"<(V8_ROOT)/src/diagnostics/unwinding-info-win64.cc",
"<(V8_ROOT)/src/diagnostics/unwinding-info-win64.h"
],
}],
],
}],
['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
'sources': [ ### gcmole(arch:mipsel) ###
Expand Down
1 change: 1 addition & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ if defined target_arch set configure_flags=%configure_flags% --dest-cpu=%ta
if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
if "%target_arch%"=="x86" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set configure_flags=%configure_flags% --no-cross-compiling
if "%target_arch%"=="arm64" set configure_flags=%configure_flags% --cross-compiling

if not exist "%~dp0deps\icu" goto no-depsicu
if "%target%"=="Clean" echo deleting %~dp0deps\icu
Expand Down

0 comments on commit 8833551

Please sign in to comment.