diff --git a/configure.py b/configure.py index c167a0a0b27358..ffdd538bf71834 100755 --- a/configure.py +++ b/configure.py @@ -1855,6 +1855,10 @@ def configure_node(o): if flavor == 'win': o['variables']['cargo_rust_target'] = \ 'aarch64-pc-windows-msvc' if target_arch == 'arm64' else 'x86_64-pc-windows-msvc' + # Always set the Rust target for x64 macOS in case we will be building + # under Rosetta 2. + if flavor == 'mac' and target_arch == 'x64': + o['variables']['cargo_rust_target'] = 'x86_64-apple-darwin' # Allow overriding the compiler - needed by embedders. if options.use_clang: diff --git a/deps/crates/crates.gyp b/deps/crates/crates.gyp index fa2387281839f2..5c1dc9d782cbfe 100644 --- a/deps/crates/crates.gyp +++ b/deps/crates/crates.gyp @@ -11,12 +11,17 @@ }, 'conditions': [ ['cargo_rust_target!=""', { + 'variables': { + 'cargo_build_flags': ['--target', '<(cargo_rust_target)'], + } + }], + ['OS=="win"', { 'variables': { 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/$(Platform)/release/node_crates.lib', }, }, { 'variables': { - 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/release/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', + 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/<(cargo_rust_target)/release/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', }, }], ], @@ -25,13 +30,13 @@ 'cargo_build_flags': [], }, 'conditions': [ - ['cargo_rust_target!=""', { + ['OS=="win"', { 'variables': { 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/$(Platform)/debug/node_crates.lib', }, }, { 'variables': { - 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/debug/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', + 'node_crates_libpath': '<(SHARED_INTERMEDIATE_DIR)/<(cargo_rust_target)/debug/<(STATIC_LIB_PREFIX)node_crates<(STATIC_LIB_SUFFIX)', }, }], ], @@ -62,7 +67,7 @@ ], }, 'conditions': [ - ['cargo_rust_target!=""', { + ['OS=="win"', { 'actions': [ { 'action_name': 'cargo_build',