Skip to content

Commit e192a32

Browse files
authored
build: fix conflict gyp configs
Gyp generated build files can be built in either Release/Debug mode. - make: single directory, two configurations by cli: `make -C out BUILDTYPE=Release` and `make -C out BUILDTYPE=Debug`. - msbuild: single directory, two configurations by cli: `msbuild node.sln /p:Configuration=Release` and `msbuild node.sln /p:Configuration=Debug`. - ninja: two directories in `out/`, build with `ninja -C out/Release` or `ninja -C out/Debug`. Variables that changes with either Release or Debug configuration should be defined in a configuration level, instead of the root level. This fixes generating invalid build files. Additionally, `v8_gypfiles/toolchain.gypi` duplicates defines in `v8_gypfiles/features.gypi`. Remove the duplications in `toolchains.gypi` PR-URL: #53605 Fixes: #53446 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b19a950 commit e192a32

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

configure.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@ def host_arch_win():
13051305

13061306
return matchup.get(arch, 'x64')
13071307

1308+
def set_configuration_variable(configs, name, release=None, debug=None):
1309+
configs['Release'][name] = release
1310+
configs['Debug'][name] = debug
13081311

13091312
def configure_arm(o):
13101313
if options.arm_float_abi:
@@ -1619,7 +1622,9 @@ def configure_library(lib, output, pkgname=None):
16191622
output['libraries'] += pkg_libs.split()
16201623

16211624

1622-
def configure_v8(o):
1625+
def configure_v8(o, configs):
1626+
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
1627+
16231628
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
16241629
o['variables']['v8_enable_javascript_promise_hooks'] = 1
16251630
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
@@ -1637,7 +1642,6 @@ def configure_v8(o):
16371642
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
16381643
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1
16391644
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
1640-
o['variables']['v8_enable_v8_checks'] = 1 if options.debug else 0
16411645
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
16421646
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
16431647
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
@@ -2153,6 +2157,10 @@ def make_bin_override():
21532157
'defines': [],
21542158
'cflags': [],
21552159
}
2160+
configurations = {
2161+
'Release': { 'variables': {} },
2162+
'Debug': { 'variables': {} },
2163+
}
21562164

21572165
# Print a warning when the compiler is too old.
21582166
check_compiler(output)
@@ -2180,7 +2188,7 @@ def make_bin_override():
21802188
configure_library('ngtcp2', output, pkgname='libngtcp2')
21812189
configure_library('sqlite', output, pkgname='sqlite3')
21822190
configure_library('uvwasi', output, pkgname='libuvwasi')
2183-
configure_v8(output)
2191+
configure_v8(output, configurations)
21842192
configure_openssl(output)
21852193
configure_intl(output)
21862194
configure_static(output)
@@ -2203,7 +2211,6 @@ def make_bin_override():
22032211
# move everything else to target_defaults
22042212
variables = output['variables']
22052213
del output['variables']
2206-
variables['is_debug'] = B(options.debug)
22072214

22082215
# make_global_settings should be a root level element too
22092216
if 'make_global_settings' in output:
@@ -2212,6 +2219,9 @@ def make_bin_override():
22122219
else:
22132220
make_global_settings = False
22142221

2222+
# Add configurations to target defaults
2223+
output['configurations'] = configurations
2224+
22152225
output = {
22162226
'variables': variables,
22172227
'target_defaults': output,
@@ -2222,7 +2232,7 @@ def make_bin_override():
22222232
print_verbose(output)
22232233

22242234
write('config.gypi', do_not_edit +
2225-
pprint.pformat(output, indent=2, width=1024) + '\n')
2235+
pprint.pformat(output, indent=2, width=128) + '\n')
22262236

22272237
write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' +
22282238
' '.join([shlex.quote(arg) for arg in original_argv]) + '\n')

tools/v8_gypfiles/features.gypi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
'v8_enable_private_mapping_fork_optimization': 0,
8989
}],
9090
],
91-
'is_debug%': 0,
9291

9392
# Variables from BUILD.gn
9493

tools/v8_gypfiles/toolchain.gypi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,7 @@
703703
'configurations': {
704704
'Debug': {
705705
'defines': [
706-
'ENABLE_DISASSEMBLER',
707-
'V8_ENABLE_CHECKS',
708-
'OBJECT_PRINT',
709706
'DEBUG',
710-
'V8_TRACE_MAPS',
711-
'V8_ENABLE_ALLOCATION_TIMEOUT',
712-
'V8_ENABLE_FORCE_SLOW_PATH',
713707
],
714708
'conditions': [
715709
['OS=="linux" and v8_enable_backtrace==1', {

0 commit comments

Comments
 (0)