فهرست منبع

Fixed libpng library in iOS (#169)

Libpng relies on `CMAKE_SYSTEM_PROCESSOR` variable being set to the target architecture to setup the NEON variables and include the .c neon files.

Since the iOS toolchain didn't set it, the C++ code for iOS was in a weird state that by checking the ARM macros it sets `PNG_ARM_NEON_IMPLEMENTATION` to 1 by default, so the code tries use the neon implementation but the cmake didn't include the .c neon files, leading to the linking errors seeing in the periodic builds:

````
Undefined symbols for architecture arm64:
  "_png_do_expand_palette_rgba8_neon", referenced from:
      _png_do_read_transformations in libpng16.a(pngrtran.o)
  "_png_do_expand_palette_rgb8_neon", referenced from:
      _png_do_read_transformations in libpng16.a(pngrtran.o)
  "_png_riffle_palette_neon", referenced from:
      _png_do_read_transformations in libpng16.a(pngrtran.o)
  "_png_init_filter_functions_neon", referenced from:
      _png_read_filter_row in libpng16.a(pngrutil.o)
ld: symbol(s) not found for architecture arm64
````

Setting `CMAKE_SYSTEM_PROCESSOR` to the iOS architecture in the iOS toolchain and rebuilding libpng fixes the issue.

Signed-off-by: moraaar <[email protected]>
moraaar 2 سال پیش
والد
کامیت
430658a4f7

+ 2 - 0
Scripts/cmake/Platform/iOS/Toolchain_ios.cmake

@@ -11,6 +11,8 @@ set(CMAKE_SYSTEM_NAME iOS)
 set(CMAKE_SYSTEM_VERSION 1)
 set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "OSX Architectures to support" FORCE)
 
+set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_OSX_ARCHITECTURES})
+
 include(${CMAKE_CURRENT_LIST_DIR}/SDK_ios.cmake)
 
 set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")

+ 2 - 1
package-system/libpng/build_config.json

@@ -93,7 +93,8 @@
                 ],
                 "custom_test_cmd": [
                     "./test_png_ios.sh"
-                ]
+                ],
+                "package_version": "1.6.37-rev3"
             }
         },
         "Linux": {

+ 2 - 2
package_build_list_host_darwin.json

@@ -18,7 +18,7 @@
         "googletest-1.8.1-rev4-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Mac --package-root ../../package-system --clean",
         "ISPCTexComp-36b80aa-rev1-mac": "package-system/ISPCTexComp/build_package_image.py",
         "png-1.6.37-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Mac --package-root ../../package-system/libpng/temp --clean",
-        "png-1.6.37-rev2-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name iOS --package-root ../../package-system/libpng/temp --clean",
+        "png-1.6.37-rev3-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name iOS --package-root ../../package-system/libpng/temp --clean",
         "libsamplerate-0.2.1-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Mac --package-root ../../package-system --clean",
         "libsamplerate-0.2.1-rev2-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name iOS --package-root ../../package-system --clean",
         "OpenMesh-8.1-rev3-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenMesh --platform-name Mac --package-root ../../package-system --clean",
@@ -69,7 +69,7 @@
         "googletest-1.8.1-rev4-mac": "package-system/googletest-mac",
         "ISPCTexComp-36b80aa-rev1-mac": "package-system/ISPCTexComp-mac",
         "png-1.6.37-rev2-mac": "package-system/libpng/temp/png-mac",
-        "png-1.6.37-rev2-ios": "package-system/libpng/temp/png-ios",
+        "png-1.6.37-rev3-ios": "package-system/libpng/temp/png-ios",
         "libsamplerate-0.2.1-rev2-mac": "package-system/libsamplerate-mac",
         "libsamplerate-0.2.1-rev2-ios": "package-system/libsamplerate-ios",
         "OpenMesh-8.1-rev3-mac": "package-system/OpenMesh-mac",