Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: support setting an emulator from configure script #53899

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'enable_pgo_generate%': '0',
'enable_pgo_use%': '0',
'python%': 'python',
'emulator%': [],

'node_shared%': 'false',
'force_dynamic_crt%': 0,
Expand Down
14 changes: 14 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
choices=valid_arch,
help=f"CPU architecture to build for ({', '.join(valid_arch)})")

parser.add_argument('--emulator',
action='store',
dest='emulator',
default=None,
help='emulator command that can run executables built for the target system')

parser.add_argument('--cross-compiling',
action='store_true',
dest='cross_compiling',
Expand Down Expand Up @@ -2276,6 +2282,14 @@ def make_bin_override():
# will fail to run python scripts.
gyp_args += ['-Dpython=' + python]

if options.emulator is not None:
if not options.cross_compiling:
# Note that emulator is a list so we have to quote the variable.
gyp_args += ['-Demulator=' + shlex.quote(options.emulator)]
else:
# TODO: perhaps use emulator for tests?
warn('The `--emulator` option has no effect when cross-compiling.')

if options.use_ninja:
gyp_args += ['-f', 'ninja-' + flavor]
elif flavor == 'win' and sys.platform != 'msys':
Expand Down
4 changes: 4 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@
'<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
],
'action': [
'<@(emulator)',
'<(node_mksnapshot_exec)',
'--build-snapshot',
'<(node_snapshot_main)',
Expand All @@ -722,6 +723,7 @@
'<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
],
'action': [
'<@(emulator)',
'<@(_inputs)',
'<@(_outputs)',
],
Expand Down Expand Up @@ -1010,6 +1012,7 @@
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
],
'action': [
'<@(emulator)',
'<(node_js2c_exec)',
'<@(_outputs)',
'lib',
Expand Down Expand Up @@ -1477,6 +1480,7 @@
'<(PRODUCT_DIR)/<(node_core_target_name).def',
],
'action': [
'<@(emulator)',
'<(PRODUCT_DIR)/gen_node_def.exe',
'<@(_inputs)',
'<@(_outputs)',
Expand Down
4 changes: 4 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
'<@(torque_outputs_inc)',
],
'action': [
'<@(emulator)',
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated',
'-v8-root', '<(V8_ROOT)',
Expand Down Expand Up @@ -232,6 +233,7 @@
'action': [
'<(python)',
'<(V8_ROOT)/tools/run.py',
'<@(emulator)',
'<@(_inputs)',
'<@(_outputs)',
],
Expand Down Expand Up @@ -453,6 +455,7 @@
}],
],
'action': [
'<@(emulator)',
'>@(_inputs)',
'>@(mksnapshot_flags)',
],
Expand Down Expand Up @@ -1842,6 +1845,7 @@
'action': [
'<(python)',
'<(V8_ROOT)/tools/run.py',
'<@(emulator)',
'<@(_inputs)',
'<@(_outputs)',
],
Expand Down
Loading