diff options
author | Jon Creighton <jcreighton@apple.com> | 2023-01-09 13:17:31 +0000 |
---|---|---|
committer | Cosmin Truta <ctruta@gmail.com> | 2023-01-09 19:55:04 +0200 |
commit | cd0ea2a7f53b603d3d9b5b891c779c430047b39a (patch) | |
tree | ada5a79c8ff818f87a3c15d03a862080c0fa523a | |
parent | 9923515ff441b4c07ce3f8c9985a547fe582c4da (diff) | |
download | libpng-cd0ea2a7f53b603d3d9b5b891c779c430047b39a.tar.gz |
Fix for universal binaries on macOS
Fix the issue of a
clang: error: no such file or directory: 'x86_64'
error on building universal binaries on macOS.
It is also necessary to specify:
-DCMAKE_C_FLAGS="-DPNG_ARM_NEON_OPT=0"
Example CMake command:
cmake -S libpng \
-B build_libpng \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_C_FLAGS="-DPNG_ARM_NEON_OPT=0"
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | scripts/genout.cmake.in | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 24739fe1a..f7ceb640c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt -# Copyright (c) 2018-2022 Cosmin Truta +# Copyright (c) 2018-2023 Cosmin Truta # Copyright (c) 2007,2009-2018 Glenn Randers-Pehrson # Written by Christian Ehrlicher, 2007 # Revised by Roger Lowman, 2009-2010 @@ -20,6 +20,7 @@ # Revised by Gleb Mazovetskiy, 2021 # Revised by Christopher Sean Morrison, 2022 # Revised by Martin Storsjo, 2022 +# Revised by Jon Creighton, 2023 # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff --git a/scripts/genout.cmake.in b/scripts/genout.cmake.in index 91d3bd48a..ec685d900 100644 --- a/scripts/genout.cmake.in +++ b/scripts/genout.cmake.in @@ -24,10 +24,10 @@ set(ZLIBINCDIR "@ZLIB_INCLUDE_DIRS@") set(PLATFORM_C_FLAGS) if(APPLE) - set(CMAKE_OSX_ARCHITECTURES "@CMAKE_OSX_ARCHITECTURES@") + set(CMAKE_OSX_INTERNAL_ARCHITECTURES "@CMAKE_OSX_INTERNAL_ARCHITECTURES@") set(CMAKE_OSX_SYSROOT "@CMAKE_OSX_SYSROOT@") - if(CMAKE_OSX_ARCHITECTURES) - set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}) + if(CMAKE_OSX_INTERNAL_ARCHITECTURES) + set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -arch ${CMAKE_OSX_INTERNAL_ARCHITECTURES}) endif() if(CMAKE_OSX_SYSROOT) set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}) |