From 13f0b2485b2ab1a1ff8942617940c828cfcf623b Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Sun, 27 Dec 2020 04:16:46 +0000 Subject: [PATCH] Update darwin CMakeLists.txt to support Apple Silicon on macOS (#480) Without this change in a corresponding `CMakeLists.txt` it attempts to build `invokeNative` assembly for `X86_64` on Macs with Apple Silicon. Co-authored-by: Wenyong Huang --- product-mini/platforms/darwin/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/product-mini/platforms/darwin/CMakeLists.txt b/product-mini/platforms/darwin/CMakeLists.txt index 352b6fbe..15367caf 100644 --- a/product-mini/platforms/darwin/CMakeLists.txt +++ b/product-mini/platforms/darwin/CMakeLists.txt @@ -14,7 +14,10 @@ set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") # Set WAMR_BUILD_TARGET, currently values supported: # "X86_64", "AMD_64", "X86_32", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA" if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + # Handle Apple Silicon + set (WAMR_BUILD_TARGET "AARCH64") + elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) # Build as X86_64 by default in 64-bit platform set (WAMR_BUILD_TARGET "X86_64") else ()