Skip to content

Commit

Permalink
build,win: enable clang-cl compilation
Browse files Browse the repository at this point in the history
This uses the backported ICU fix needed for compiling with ClangCL.

Refs: #54502
Fixes: #34201
  • Loading branch information
StefanStojanovic committed Aug 30, 2024
1 parent 8966787 commit 7fa8f54
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 64 deletions.
166 changes: 117 additions & 49 deletions tools/icu/icu-generic.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,43 @@
# full data - just build the full data file, then we are done.
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
'dependencies': [ 'genccode#host' ],
'actions': [
{
'action_name': 'icudata',
'msvs_quote_cmd': 0,
'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<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)', # -o
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'-n', 'icudata',
'-e', 'icudt<(icu_ver_major)',
'<@(_inputs)' ],
},
'conditions': [
[ 'clang==1', {
'actions': [
{
'action_name': 'icudata',
'msvs_quote_cmd': 0,
'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.
# for Clang use "-c <(target_arch)" option
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)', # -o
'-c', '<(target_arch)',
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'-n', 'icudata',
'-e', 'icudt<(icu_ver_major)',
'<@(_inputs)' ],
},
],
}, {
'actions': [
{
'action_name': 'icudata',
'msvs_quote_cmd': 0,
'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.
# for MSVC do not use "-c <(target_arch)" option
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)', # -o
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'-n', 'icudata',
'-e', 'icudt<(icu_ver_major)',
'<@(_inputs)' ],
},
],
}]
],
}, { # icu_small == TRUE and OS == win
# link against stub data primarily
Expand Down Expand Up @@ -244,42 +267,87 @@
'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host',
'icu_implementation', 'icu_uconfig' ],
'export_dependent_settings': [ 'icustubdata' ],
'actions': [
{
# Trim down ICU.
# Note that icupkg is invoked automatically, swapping endianness if needed.
'action_name': 'icutrim',
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'action': [ '<(python)',
'icutrim.py',
'-P', '<(PRODUCT_DIR)',
'-D', '<(icu_data_in)',
'--delete-tmp',
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
'-F', 'icu_small.json',
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
'-v',
'-L', '<(icu_locales)'],
'conditions': [
[ 'clang==1', {
'actions': [
{
# Trim down ICU.
# Note that icupkg is invoked automatically, swapping endianness if needed.
'action_name': 'icutrim',
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'action': [ '<(python)',
'icutrim.py',
'-P', '<(PRODUCT_DIR)',
'-D', '<(icu_data_in)',
'--delete-tmp',
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
'-F', 'icu_small.json',
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
'-v',
'-L', '<(icu_locales)'],
}, {
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
'action_name': 'rename',
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
'action': [ 'cp',
'<@(_inputs)',
'<@(_outputs)',
],
}, {
# For icu-small, always use .c, don't try to use .S, etc.
'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)' ],
# for Clang use "-c <(target_arch)" option
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)',
'-c', '<(target_arch)',
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'<@(_inputs)' ],
},
],
}, {
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
'action_name': 'rename',
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
'action': [ 'cp',
'<@(_inputs)',
'<@(_outputs)',
],
}, {
# For icu-small, always use .c, don't try to use .S, etc.
'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<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)',
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'<@(_inputs)' ],
},
'actions': [
{
# Trim down ICU.
# Note that icupkg is invoked automatically, swapping endianness if needed.
'action_name': 'icutrim',
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'action': [ '<(python)',
'icutrim.py',
'-P', '<(PRODUCT_DIR)',
'-D', '<(icu_data_in)',
'--delete-tmp',
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
'-F', 'icu_small.json',
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
'-v',
'-L', '<(icu_locales)'],
}, {
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
'action_name': 'rename',
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
'action': [ 'cp',
'<@(_inputs)',
'<@(_outputs)',
],
}, {
# For icu-small, always use .c, don't try to use .S, etc.
'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)' ],
# for MSVC do not use "-c <(target_arch)" option
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
'<@(icu_asm_opts)',
'-d', '<(SHARED_INTERMEDIATE_DIR)',
'<@(_inputs)' ],
},
],
}]
],
# This file contains the small ICU data
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
Expand Down
41 changes: 26 additions & 15 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,32 @@
['enable_lto=="true"', {
'cflags_cc': [ '-fno-lto' ],
}],
['clang==1 or OS!="win"', {
# Chnges in push_registers_asm.cc in V8 v12.8 requires using
# push_registers_masm on Windows even with ClangCL on x64
['OS=="win"', {
'conditions': [
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.asm',
],
}],
['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
'conditions': [
['clang==1', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_asm.cc',
],
}],
['clang==0', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
],
}],
],
}],
],
}],
['clang==1 and OS!="win"', {
'conditions': [
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
'sources': [
Expand Down Expand Up @@ -1939,20 +1964,6 @@
}],
]
}],
['OS=="win" and clang==0', {
'conditions': [
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.asm',
],
}],
['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
],
}],
],
}],
],
},
}, # v8_heap_base
Expand Down

0 comments on commit 7fa8f54

Please sign in to comment.