Преглед изворни кода

WIP trying to get the android package to work. Currently I'm getting linker failures in o3de when building libAtom_Feature_Common.so

Signed-off-by: santorac <[email protected]>
santorac пре 3 година
родитељ
комит
51d196b7cf

+ 6 - 7
package-system/libpng/build_config.json

@@ -19,13 +19,12 @@
                     "-DPNG_DEBUG=OFF"
                 ]
             },
-            "Android": {
-                "cmake_generate_args": [
-                    "-DZLIB_ROOT=../../zlib-android/zlib",
-                    "-DCMAKE_POLICY_DEFAULT_CMP0074=NEW",
-                    "-DPNG_SHARED=OFF",
-                    "-DPNG_TESTS=OFF",
-                    "-DPNG_DEBUG=OFF"
+            "Android":{
+                "custom_build_cmd" : [
+                    "build_libpng_android.cmd"
+                ],
+                "custom_install_cmd": [
+                    "install_libpng_android.cmd"
                 ]
             }
         },

+ 21 - 0
package-system/libpng/build_libpng_android.cmd

@@ -0,0 +1,21 @@
+@rem #
+@rem # Copyright (c) Contributors to the Open 3D Engine Project.
+@rem # For complete copyright and license terms please see the LICENSE at the root of this distribution.
+@rem # 
+@rem # SPDX-License-Identifier: Apache-2.0 OR MIT
+@rem #
+
+@IF "%LY_ANDROID_NDK_ROOT%" == "" (
+    @echo Need to set the varible LY_ANDROID_NDK_ROOT to the location of your NDK install!
+    @exit /b 1
+)
+
+@REM The CMAKE_FIND_ROOT_PATH_ settings are necessary to prevent the android toolchain from forcing cmake to link against their version of zlib
+cmake -S temp/src -B temp/build   -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_STANDARD=17 -DCMAKE_TOOLCHAIN_FILE=%LY_ANDROID_NDK_ROOT%\\build\\cmake\\android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DBUILD_SHARED_LIBS=OFF   -DZLIB_ROOT=../zlib-android/zlib  -DPNG_SHARED=OFF -DPNG_TESTS=OFF -DPNG_DEBUG=OFF -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=NEVER -DM_LIBRARY=""
+
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+cmake --build temp/build --target png_static
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+@exit /b 0

+ 36 - 0
package-system/libpng/install_libpng_android.cmd

@@ -0,0 +1,36 @@
+@rem #
+@rem # Copyright (c) Contributors to the Open 3D Engine Project.
+@rem # For complete copyright and license terms please see the LICENSE at the root of this distribution.
+@rem # 
+@rem # SPDX-License-Identifier: Apache-2.0 OR MIT
+@rem #
+@rem #
+@setlocal
+
+set OUT_PATH=%TARGET_INSTALL_ROOT%
+set SRC_PATH=temp\src
+set BLD_PATH=temp\build
+
+mkdir %OUT_PATH%\include
+mkdir %OUT_PATH%\include\libpng16
+mkdir %OUT_PATH%\lib
+
+copy %SRC_PATH%\png.h %OUT_PATH%\include\png.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+copy %SRC_PATH%\png.h %OUT_PATH%\include\libpng16\png.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+copy %SRC_PATH%\pngconf.h %OUT_PATH%\include\pngconf.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+copy %SRC_PATH%\pngconf.h %OUT_PATH%\include\libpng16\pngconf.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+copy %BLD_PATH%\pnglibconf.h %OUT_PATH%\include\pnglibconf.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+copy %BLD_PATH%\pnglibconf.h %OUT_PATH%\include\libpng16\pnglibconf.h
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+copy %BLD_PATH%\libpng16.a %OUT_PATH%\lib\libpng16.a
+@if %errorlevel% NEQ 0 ( exit /b 1 )
+
+exit /b 0

+ 1 - 0
package_build_list_host_windows.json

@@ -21,6 +21,7 @@
         "googletest-1.8.1-rev4-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Android --package-root ../../package-system --clean",
         "ISPCTexComp-36b80aa-rev1-windows": "package-system/ISPCTexComp/build_package_image.py",
         "libpng-1.6.37-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Windows --package-root ../../package-system --clean",
+        "libpng-1.6.37-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Android --package-root ../../package-system --clean",
         "libsamplerate-0.2.1-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Windows --package-root ../../package-system --clean",
         "libsamplerate-0.2.1-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Android --package-root ../../package-system --custom-toolchain-file ../../Scripts/cmake/Platform/Android/Toolchain_android.cmake --clean",
         "mcpp-2.7.2_az.1-rev1-windows": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.1-rev1",