mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 07:12:05 +08:00

* Fix cross compiling for GMP on Mac * Fix Apple silicon cross-compile for libcurl * Fix OpenEXR cross compile for apple silicon * Patch to cross compile libpng for Apple Silicon * Fix comment supermerill: * Test new BuildMacOS.sh script * limits macos-arm new command to macos. * add debug to BuildMacos script (like for linux)
66 lines
2.7 KiB
Diff
66 lines
2.7 KiB
Diff
Based on https://github.com/vespakoen/libpng to work around until
|
|
https://github.com/glennrp/libpng/pull/354 is resolved.
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 4db9bb87d..9099d1edf 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -82,10 +82,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;
|
|
@@ -114,8 +126,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
|
endif()
|
|
|
|
# set definitions and sources for powerpc
|
|
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
|
- CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" )
|
|
+if(TARGET_ARCH MATCHES "^powerpc*" OR
|
|
+ TARGET_ARCH MATCHES "^ppc64*" )
|
|
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
|
|
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
|
|
off: disable the optimizations.")
|
|
@@ -138,8 +150,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")
|
|
@@ -162,8 +174,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
|
endif()
|
|
|
|
# set definitions and sources for MIPS
|
|
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
|
- CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" )
|
|
+if(TARGET_ARCH MATCHES "mipsel*" OR
|
|
+ TARGET_ARCH MATCHES "mips64el*" )
|
|
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
|
|
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
|
|
off: disable the optimizations")
|