From 6fb58efc06437a32c0845ecc3229aaf121245af1 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Fri, 8 Mar 2024 21:50:08 +0000 Subject: [PATCH] Fix ASTC link error on Mac arm64 hardware --- third_party/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 278eaae30..eec6f724d 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -329,6 +329,13 @@ set(ASTC_TARGET ${ASTC_RAW_TARGET} PARENT_SCOPE) # astc add_subdirectory(astc) +# ASTC apparently tries to build for x86_64 even on Mac arm64 architectures, +# but we can force it to build for the correct arch +# Upstream bug: https://github.com/ARM-software/astc-encoder/issues/458 +if (APPLE AND (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")) + set_target_properties(${ASTC_RAW_TARGET} PROPERTIES OSX_ARCHITECTURES "arm64") +endif() + # astc doesn't have separate directories for it's source code and public interface. Additionally, it includes it's # own copy of STB. In order to avoid conflicts, we copy the only header we need to the build directory and alter the # INTERFACE_INCLUDE_DIRECTORIES of the target