Skip to content

Commit 7fa8f54

Browse files
build,win: enable clang-cl compilation
This uses the backported ICU fix needed for compiling with ClangCL. Refs: nodejs#54502 Fixes: nodejs#34201
1 parent 8966787 commit 7fa8f54

File tree

2 files changed

+143
-64
lines changed

2 files changed

+143
-64
lines changed

tools/icu/icu-generic.gyp

Lines changed: 117 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,43 @@
139139
# full data - just build the full data file, then we are done.
140140
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
141141
'dependencies': [ 'genccode#host' ],
142-
'actions': [
143-
{
144-
'action_name': 'icudata',
145-
'msvs_quote_cmd': 0,
146-
'inputs': [ '<(icu_data_in)' ],
147-
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
148-
# on Windows, we can go directly to .obj file (-o) option.
149-
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
150-
'<@(icu_asm_opts)', # -o
151-
'-d', '<(SHARED_INTERMEDIATE_DIR)',
152-
'-n', 'icudata',
153-
'-e', 'icudt<(icu_ver_major)',
154-
'<@(_inputs)' ],
155-
},
142+
'conditions': [
143+
[ 'clang==1', {
144+
'actions': [
145+
{
146+
'action_name': 'icudata',
147+
'msvs_quote_cmd': 0,
148+
'inputs': [ '<(icu_data_in)' ],
149+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
150+
# on Windows, we can go directly to .obj file (-o) option.
151+
# for Clang use "-c <(target_arch)" option
152+
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
153+
'<@(icu_asm_opts)', # -o
154+
'-c', '<(target_arch)',
155+
'-d', '<(SHARED_INTERMEDIATE_DIR)',
156+
'-n', 'icudata',
157+
'-e', 'icudt<(icu_ver_major)',
158+
'<@(_inputs)' ],
159+
},
160+
],
161+
}, {
162+
'actions': [
163+
{
164+
'action_name': 'icudata',
165+
'msvs_quote_cmd': 0,
166+
'inputs': [ '<(icu_data_in)' ],
167+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
168+
# on Windows, we can go directly to .obj file (-o) option.
169+
# for MSVC do not use "-c <(target_arch)" option
170+
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
171+
'<@(icu_asm_opts)', # -o
172+
'-d', '<(SHARED_INTERMEDIATE_DIR)',
173+
'-n', 'icudata',
174+
'-e', 'icudt<(icu_ver_major)',
175+
'<@(_inputs)' ],
176+
},
177+
],
178+
}]
156179
],
157180
}, { # icu_small == TRUE and OS == win
158181
# link against stub data primarily
@@ -244,42 +267,87 @@
244267
'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host',
245268
'icu_implementation', 'icu_uconfig' ],
246269
'export_dependent_settings': [ 'icustubdata' ],
247-
'actions': [
248-
{
249-
# Trim down ICU.
250-
# Note that icupkg is invoked automatically, swapping endianness if needed.
251-
'action_name': 'icutrim',
252-
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
253-
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
254-
'action': [ '<(python)',
255-
'icutrim.py',
256-
'-P', '<(PRODUCT_DIR)',
257-
'-D', '<(icu_data_in)',
258-
'--delete-tmp',
259-
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
260-
'-F', 'icu_small.json',
261-
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
262-
'-v',
263-
'-L', '<(icu_locales)'],
270+
'conditions': [
271+
[ 'clang==1', {
272+
'actions': [
273+
{
274+
# Trim down ICU.
275+
# Note that icupkg is invoked automatically, swapping endianness if needed.
276+
'action_name': 'icutrim',
277+
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
278+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
279+
'action': [ '<(python)',
280+
'icutrim.py',
281+
'-P', '<(PRODUCT_DIR)',
282+
'-D', '<(icu_data_in)',
283+
'--delete-tmp',
284+
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
285+
'-F', 'icu_small.json',
286+
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
287+
'-v',
288+
'-L', '<(icu_locales)'],
289+
}, {
290+
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
291+
'action_name': 'rename',
292+
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
293+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
294+
'action': [ 'cp',
295+
'<@(_inputs)',
296+
'<@(_outputs)',
297+
],
298+
}, {
299+
# For icu-small, always use .c, don't try to use .S, etc.
300+
'action_name': 'genccode',
301+
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
302+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
303+
# for Clang use "-c <(target_arch)" option
304+
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
305+
'<@(icu_asm_opts)',
306+
'-c', '<(target_arch)',
307+
'-d', '<(SHARED_INTERMEDIATE_DIR)',
308+
'<@(_inputs)' ],
309+
},
310+
],
264311
}, {
265-
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
266-
'action_name': 'rename',
267-
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
268-
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
269-
'action': [ 'cp',
270-
'<@(_inputs)',
271-
'<@(_outputs)',
272-
],
273-
}, {
274-
# For icu-small, always use .c, don't try to use .S, etc.
275-
'action_name': 'genccode',
276-
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
277-
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
278-
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
279-
'<@(icu_asm_opts)',
280-
'-d', '<(SHARED_INTERMEDIATE_DIR)',
281-
'<@(_inputs)' ],
282-
},
312+
'actions': [
313+
{
314+
# Trim down ICU.
315+
# Note that icupkg is invoked automatically, swapping endianness if needed.
316+
'action_name': 'icutrim',
317+
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
318+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
319+
'action': [ '<(python)',
320+
'icutrim.py',
321+
'-P', '<(PRODUCT_DIR)',
322+
'-D', '<(icu_data_in)',
323+
'--delete-tmp',
324+
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
325+
'-F', 'icu_small.json',
326+
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
327+
'-v',
328+
'-L', '<(icu_locales)'],
329+
}, {
330+
# rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
331+
'action_name': 'rename',
332+
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
333+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
334+
'action': [ 'cp',
335+
'<@(_inputs)',
336+
'<@(_outputs)',
337+
],
338+
}, {
339+
# For icu-small, always use .c, don't try to use .S, etc.
340+
'action_name': 'genccode',
341+
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
342+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
343+
# for MSVC do not use "-c <(target_arch)" option
344+
'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
345+
'<@(icu_asm_opts)',
346+
'-d', '<(SHARED_INTERMEDIATE_DIR)',
347+
'<@(_inputs)' ],
348+
},
349+
],
350+
}]
283351
],
284352
# This file contains the small ICU data
285353
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],

tools/v8_gypfiles/v8.gyp

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,32 @@
18901890
['enable_lto=="true"', {
18911891
'cflags_cc': [ '-fno-lto' ],
18921892
}],
1893-
['clang==1 or OS!="win"', {
1893+
# Chnges in push_registers_asm.cc in V8 v12.8 requires using
1894+
# push_registers_masm on Windows even with ClangCL on x64
1895+
['OS=="win"', {
1896+
'conditions': [
1897+
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1898+
'sources': [
1899+
'<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.asm',
1900+
],
1901+
}],
1902+
['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1903+
'conditions': [
1904+
['clang==1', {
1905+
'sources': [
1906+
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_asm.cc',
1907+
],
1908+
}],
1909+
['clang==0', {
1910+
'sources': [
1911+
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
1912+
],
1913+
}],
1914+
],
1915+
}],
1916+
],
1917+
}],
1918+
['clang==1 and OS!="win"', {
18941919
'conditions': [
18951920
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
18961921
'sources': [
@@ -1939,20 +1964,6 @@
19391964
}],
19401965
]
19411966
}],
1942-
['OS=="win" and clang==0', {
1943-
'conditions': [
1944-
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1945-
'sources': [
1946-
'<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.asm',
1947-
],
1948-
}],
1949-
['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1950-
'sources': [
1951-
'<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
1952-
],
1953-
}],
1954-
],
1955-
}],
19561967
],
19571968
},
19581969
}, # v8_heap_base

0 commit comments

Comments
 (0)