apps/tools: Enable Rust sim builds on Intel Macs

Select the Mach-O Rust target (x86_64-unknown-nuttx-macho.json) when
building Rust apps for the simulator on x86_64 macOS.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
This commit is contained in:
Shoji Tokunaga 2026-06-01 15:30:14 +09:00 committed by Lup Yuen Lee
parent 8b4d20e411
commit 33d96e92e5
2 changed files with 15 additions and 5 deletions

View file

@ -34,7 +34,8 @@ include(nuttx_parse_function_args)
# - riscv32: riscv32imc/imac/imafc-unknown-nuttx-elf
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx-macho for sim on macOS,
# x86_64-unknown-nuttx otherwise
# - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
# aarch64-unknown-nuttx otherwise
#
@ -50,7 +51,12 @@ include(nuttx_parse_function_args)
function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
if(ARCHTYPE STREQUAL "x86_64")
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx.json")
if(CONFIG_ARCH_SIM AND CONFIG_HOST_MACOS)
set(TARGET_TRIPLE
"${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx-macho.json")
else()
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx.json")
endif()
elseif(ARCHTYPE STREQUAL "x86")
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/i486-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "aarch64")

View file

@ -27,7 +27,8 @@
#
# Supported architectures and their target triples:
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx-macho for sim on macOS,
# x86_64-unknown-nuttx otherwise
# - armv7a: armv7a-nuttx-eabi, armv7a-nuttx-eabihf
# - thumbv6m: thumbv6m-nuttx-eabi
# - thumbv7a: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf
@ -49,13 +50,16 @@
define RUST_TARGET_TRIPLE
$(or \
$(and $(filter x86_64,$(LLVM_ARCHTYPE)), \
$(TOPDIR)/tools/x86_64-unknown-nuttx.json \
$(if $(and $(filter y,$(CONFIG_ARCH_SIM)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(TOPDIR)/tools/x86_64-unknown-nuttx-macho.json, \
$(TOPDIR)/tools/x86_64-unknown-nuttx.json \
) \
), \
$(and $(filter x86,$(LLVM_ARCHTYPE)), \
$(TOPDIR)/tools/i486-unknown-nuttx.json \
), \
$(and $(filter aarch64,$(LLVM_ARCHTYPE)), \
$(if $(and $(filter sim,$(CONFIG_ARCH)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(if $(and $(filter y,$(CONFIG_ARCH_SIM)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
$(TOPDIR)/tools/aarch64-unknown-nuttx.json \
) \