aboutsummaryrefslogtreecommitdiff
path: root/vcpkg-ports/libpng/macos-arch-fix.patch
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /vcpkg-ports/libpng/macos-arch-fix.patch
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'vcpkg-ports/libpng/macos-arch-fix.patch')
-rw-r--r--vcpkg-ports/libpng/macos-arch-fix.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/vcpkg-ports/libpng/macos-arch-fix.patch b/vcpkg-ports/libpng/macos-arch-fix.patch
new file mode 100644
index 00000000..5dd63769
--- /dev/null
+++ b/vcpkg-ports/libpng/macos-arch-fix.patch
@@ -0,0 +1,62 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6451fcf1b..dbd5016ca 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -63,11 +63,22 @@ option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
+ set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
+ set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
+
++# CMake currently sets CMAKE_SYSTEM_PROCESSOR to one of x86_64 or arm64 on macOS,
++# based upon the OS architecture, not the target architecture. As such, we need
++# to check CMAKE_OSX_ARCHITECTURES to identify which hardware-specific flags to
++# enable. Note that this will fail if you attempt to build a universal binary in
++# a single cmake invokation.
++if (APPLE AND CMAKE_OSX_ARCHITECTURES)
++ set(TARGET_ARCH ${CMAKE_OSX_ARCHITECTURES})
++else()
++ set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
++endif()
++
+ if(PNG_HARDWARE_OPTIMIZATIONS)
+
+ # set definitions and sources for arm
+-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
+- CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
++if(TARGET_ARCH MATCHES "^arm" OR
++ TARGET_ARCH MATCHES "^aarch64")
+ set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
+ set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
+ check: (default) use internal checking code;
+@@ -121,8 +132,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
+ endif()
+
+ # set definitions and sources for intel
+-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
+- CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
++if(TARGET_ARCH MATCHES "^i?86" OR
++ TARGET_ARCH MATCHES "^x86_64*")
+ set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
+ set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
+ off: disable the optimizations")
+@@ -171,8 +182,8 @@ endif()
+ else(PNG_HARDWARE_OPTIMIZATIONS)
+
+ # set definitions and sources for arm
+-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
+- CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
++if(TARGET_ARCH MATCHES "^arm" OR
++ TARGET_ARCH MATCHES "^aarch64")
+ add_definitions(-DPNG_ARM_NEON_OPT=0)
+ endif()
+
+@@ -183,8 +194,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
+ endif()
+
+ # set definitions and sources for intel
+-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
+- CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
++if(TARGET_ARCH MATCHES "^i?86" OR
++ TARGET_ARCH MATCHES "^x86_64")
+ add_definitions(-DPNG_INTEL_SSE_OPT=0)
+ endif()
+