Skip to content

Commit 5f01973

Browse files
legendecastargos
authored andcommitted
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 2df7bc0 commit 5f01973

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
@@ -1268,6 +1268,9 @@ def host_arch_win():
12681268

12691269
return matchup.get(arch, 'ia32')
12701270

1271+
def set_configuration_variable(configs, name, release=None, debug=None):
1272+
configs['Release'][name] = release
1273+
configs['Debug'][name] = debug
12711274

12721275
def configure_arm(o):
12731276
if options.arm_float_abi:
@@ -1582,7 +1585,9 @@ def configure_library(lib, output, pkgname=None):
15821585
output['libraries'] += pkg_libs.split()
15831586

15841587

1585-
def configure_v8(o):
1588+
def configure_v8(o, configs):
1589+
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
1590+
15861591
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
15871592
o['variables']['v8_enable_javascript_promise_hooks'] = 1
15881593
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
@@ -1600,7 +1605,6 @@ def configure_v8(o):
16001605
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
16011606
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1
16021607
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
1603-
o['variables']['v8_enable_v8_checks'] = 1 if options.debug else 0
16041608
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
16051609
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
16061610
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
@@ -2116,6 +2120,10 @@ def make_bin_override():
21162120
'defines': [],
21172121
'cflags': [],
21182122
}
2123+
configurations = {
2124+
'Release': { 'variables': {} },
2125+
'Debug': { 'variables': {} },
2126+
}
21192127

21202128
# Print a warning when the compiler is too old.
21212129
check_compiler(output)
@@ -2142,7 +2150,7 @@ def make_bin_override():
21422150
configure_library('nghttp3', output, pkgname='libnghttp3')
21432151
configure_library('ngtcp2', output, pkgname='libngtcp2')
21442152
configure_library('uvwasi', output, pkgname='libuvwasi')
2145-
configure_v8(output)
2153+
configure_v8(output, configurations)
21462154
configure_openssl(output)
21472155
configure_intl(output)
21482156
configure_static(output)
@@ -2165,7 +2173,6 @@ def make_bin_override():
21652173
# move everything else to target_defaults
21662174
variables = output['variables']
21672175
del output['variables']
2168-
variables['is_debug'] = B(options.debug)
21692176

21702177
# make_global_settings should be a root level element too
21712178
if 'make_global_settings' in output:
@@ -2174,6 +2181,9 @@ def make_bin_override():
21742181
else:
21752182
make_global_settings = False
21762183

2184+
# Add configurations to target defaults
2185+
output['configurations'] = configurations
2186+
21772187
output = {
21782188
'variables': variables,
21792189
'target_defaults': output,
@@ -2184,7 +2194,7 @@ def make_bin_override():
21842194
print_verbose(output)
21852195

21862196
write('config.gypi', do_not_edit +
2187-
pprint.pformat(output, indent=2, width=1024) + '\n')
2197+
pprint.pformat(output, indent=2, width=128) + '\n')
21882198

21892199
write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' +
21902200
' '.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
@@ -695,13 +695,7 @@
695695
'configurations': {
696696
'Debug': {
697697
'defines': [
698-
'ENABLE_DISASSEMBLER',
699-
'V8_ENABLE_CHECKS',
700-
'OBJECT_PRINT',
701698
'DEBUG',
702-
'V8_TRACE_MAPS',
703-
'V8_ENABLE_ALLOCATION_TIMEOUT',
704-
'V8_ENABLE_FORCE_SLOW_PATH',
705699
],
706700
'conditions': [
707701
['OS=="linux" and v8_enable_backtrace==1', {

0 commit comments

Comments
 (0)