apps:cmake: Add APPLE to a build target for sim's configuration using CMake.

* Add Rust target conversion support for `aarch64` on acOS/Linux (and Linux `arm`).
* When a Rust target is unsupported and results in an empty configuration, trigger a CMake `FATAL_ERROR`.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
This commit is contained in:
Shoji Tokunaga 2026-05-16 14:55:38 +09:00 committed by Lup Yuen Lee
parent c10ce6aa4f
commit bb7c83b01c

View file

@ -35,6 +35,7 @@ include(nuttx_parse_function_args)
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - aarch64: aarch64-apple-darwin
#
# Inputs:
# ARCHTYPE - Architecture type (e.g. thumbv7m, riscv32)
@ -53,6 +54,10 @@ function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
set(TARGET_TRIPLE "${APPDIR}/tools/x86_64-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "x86")
set(TARGET_TRIPLE "${APPDIR}/tools/i486-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "aarch64")
if(APPLE)
set(TARGET_TRIPLE "aarch64-apple-darwin")
endif()
elseif(ARCHTYPE MATCHES "thumb")
if(ARCHTYPE MATCHES "thumbv8m")
# Extract just the base architecture type (thumbv8m.main or thumbv8m.base)
@ -92,6 +97,13 @@ function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
set(TARGET_TRIPLE "riscv64imac-unknown-nuttx-elf")
endif()
endif()
if(NOT TARGET_TRIPLE)
message(
FATAL_ERROR
"Unsupported Rust target: LLVM_ARCHTYPE=${ARCHTYPE}, LLVM_ABITYPE=${ABITYPE}, LLVM_CPUTYPE=${CPUTYPE}"
)
endif()
set(${OUTPUT}
${TARGET_TRIPLE}
PARENT_SCOPE)