Sfoglia il codice sorgente

Zlib for all platforms

contains the build script to make a new zlib package for all supported platforms.
Nicholas Lawson 4 anni fa
parent
commit
17a61fc64d

+ 1 - 0
package-system/.gitignore

@@ -16,3 +16,4 @@ DirectXShaderCompilerDxc-*
 v-hacd-*
 mikkelsen-*
 azslc-*
+zlib-*

+ 44 - 0
package-system/zlib/Findzlib.cmake.template

@@ -0,0 +1,44 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+# this file actually ingests the library and defines targets.
+set(TARGET_WITH_NAMESPACE "3rdParty::zlib")
+if (TARGET $${TARGET_WITH_NAMESPACE})
+    return()
+endif()
+
+set(zlib_INCLUDE_DIR $${CMAKE_CURRENT_LIST_DIR}/zlib/include)
+set(zlib_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/zlib/lib)
+
+if ($${PAL_PLATFORM_NAME} STREQUAL "Linux")
+    set(zlib_LIBRARY_DEBUG   $${zlib_LIBS_DIR}/libz.a)
+    set(zlib_LIBRARY_RELEASE $${zlib_LIBS_DIR}/libz.a)
+elseif($${PAL_PLATFORM_NAME} STREQUAL "Android")
+    set(zlib_LIBRARY_DEBUG   $${zlib_LIBS_DIR}/libz.a)
+    set(zlib_LIBRARY_RELEASE $${zlib_LIBS_DIR}/libz.a)
+elseif($${PAL_PLATFORM_NAME} STREQUAL "Windows")
+    set(zlib_LIBRARY_DEBUG   $${zlib_LIBS_DIR}/zlibstaticd.lib)
+    set(zlib_LIBRARY_RELEASE $${zlib_LIBS_DIR}/zlibstatic.lib)
+elseif($${PAL_PLATFORM_NAME} STREQUAL "Mac")
+    set(zlib_LIBRARY_DEBUG   $${zlib_LIBS_DIR}/libz.a)
+    set(zlib_LIBRARY_RELEASE $${zlib_LIBS_DIR}/libz.a)
+elseif($${PAL_PLATFORM_NAME} STREQUAL "iOS")
+    set(zlib_LIBRARY_DEBUG   $${zlib_LIBS_DIR}/libz.a)
+    set(zlib_LIBRARY_RELEASE $${zlib_LIBS_DIR}/libz.a)
+endif()
+
+# we set it to a generator expression for multi-config situations:
+set(zlib_LIBRARY                  "$$<$$<CONFIG:profile>:$${zlib_LIBRARY_RELEASE}>")
+set(zlib_LIBRARY $${zlib_LIBRARY} "$$<$$<CONFIG:Release>:$${zlib_LIBRARY_RELEASE}>")
+set(zlib_LIBRARY $${zlib_LIBRARY} "$$<$$<CONFIG:Debug>:$${zlib_LIBRARY_DEBUG}>")
+
+add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
+ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${zlib_INCLUDE_DIR})
+target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${zlib_LIBRARY})
+
+set(zlib_FOUND True)

+ 31 - 0
package-system/zlib/LICENSE

@@ -0,0 +1,31 @@
+Copyright notice:
+
+ (C) 1995-2017 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  [email protected]          [email protected]
+
+If you use the zlib library in a product, we would appreciate *not* receiving
+lengthy legal documents to sign.  The sources are provided for free but without
+warranty of any kind.  The library has been entirely written by Jean-loup
+Gailly and Mark Adler; it does not include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include in
+the file ChangeLog history information documenting your changes.  Please read
+the FAQ for more information on the distribution of modified source versions.

+ 6 - 0
package-system/zlib/PackageInfo.json

@@ -0,0 +1,6 @@
+{
+    "PackageName" : "zlib-1.2.11-rev2-multiplatform",
+    "URL"         : "https://zlib.net",
+    "License"     : "zlib",
+    "LicenseFile" : "zlib/LICENSE"
+}

+ 87 - 0
package-system/zlib/build_config.json

@@ -0,0 +1,87 @@
+{
+    "git_url":"https://github.com/madler/zlib",
+    "git_tag":"v1.2.11",
+    "git_commit":"cacf7f1d4e3d44d871b605da3b647f07d718623f",
+    "package_name":"zlib",
+    "package_version":"1.2.11-rev1",
+    "package_url":"https://zlib.net",
+    "package_license":"Zlib",
+    "additional_src_files":[
+      "LICENSE"
+    ],
+    "package_license_file":"LICENSE",
+    "cmake_find_template":"Findzlib.cmake.template",
+    "cmake_find_target":"Findzlib.cmake",
+    "cmake_build_args" : [ "-j", "8"],
+    "Platforms":{
+        "Windows":{
+            "Windows":{
+                "custom_cmake_install":true,
+                "cmake_generate_args_debug":[
+                    "-DCMAKE_CXX_STANDARD=17",
+                    "-DCMAKE_DEBUG_POSTFIX=d",
+                    "-DSKIP_INSTALL_FILES=YES"
+                ],
+                "cmake_generate_args_release":[
+                    "-DCMAKE_CXX_STANDARD=17",
+                    "-DSKIP_INSTALL_FILES=YES"
+                ]
+            },
+            "Android":{
+                "custom_cmake_install":true,
+                "build_configs":[
+                    "Release"
+                ],
+                "cmake_generate_args_release":[
+                   "-G",
+                   "Ninja",
+                   "-DCMAKE_TOOLCHAIN_FILE=%LY_ANDROID_NDK_ROOT%\\build\\cmake\\android.toolchain.cmake",
+                   "-DANDROID_ABI=arm64-v8a",
+                   "-DCMAKE_CXX_FLAGS=\"-fPIC\"",
+                   "-DCMAKE_CXX_STANDARD=17",
+                   "-DCMAKE_BUILD_TYPE=Release"
+                ]
+            }
+        },
+        
+        "Darwin":{
+            "Mac":{
+                "custom_cmake_install":true,
+                "cmake_generate_args_release":[
+                    "-DCMAKE_CXX_STANDARD=17",
+                    "-DCMAKE_BUILD_TYPE=Release",
+                    "-DSKIP_INSTALL_FILES=YES"
+                ],
+                "build_configs":[
+                    "Release"
+                ]
+            },
+            "iOS":{
+                "custom_cmake_install":true,
+                "custom_build_cmd": [
+                    "./build_zlib_ios.sh"
+                 ],
+                 "custom_install_cmd": [
+                    "./install_zlib_ios.sh"
+                 ],
+                "build_configs":[
+                    "Release"
+                ]
+             }
+        },
+        "Linux":{
+            "Linux":{
+                "custom_cmake_install":true,
+                "cmake_generate_args_release":[
+                    "-DCMAKE_CXX_STANDARD=17",
+                    "-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
+                    "-DCMAKE_BUILD_TYPE=Release",
+                    "-DSKIP_INSTALL_FILES=YES"
+                ],
+                "build_configs":[
+                    "Release"
+                ]
+            }
+        }
+    }
+}

+ 13 - 0
package-system/zlib/build_zlib_ios.sh

@@ -0,0 +1,13 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+# The CMakeLists.txt included with zlib unconditionally makes all the dylibs AND also
+# makes "appplication" executables.  This is not great for making a sdk for ios.
+# this custom script just runs it building the static lib only:
+cmake -S temp/src -B temp/build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_CXX_STANDARD=17 -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_CXX_FLAGS="-fPIC" -DSKIP_INSTALL_FILES=YES
+cmake --build temp/build --target zlibstatic --config Release -j 8

+ 23 - 0
package-system/zlib/install_zlib_ios.sh

@@ -0,0 +1,23 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+OUT_PATH=$TARGET_INSTALL_ROOT
+SRC_PATH=temp/src
+BLD_PATH=temp/build
+
+mkdir -p $OUT_PATH
+
+cp -f $SRC_PATH/LICENSE $OUT_PATH/
+mkdir -p $OUT_PATH/lib
+mkdir -p $OUT_PATH/include
+
+cp $BLD_PATH/Release-iphoneos/libz.a $OUT_PATH/lib/libz.a
+cp $BLD_PATH/zconf.h $OUT_PATH/include/zconf.h
+cp $SRC_PATH/zlib.h $OUT_PATH/include/zlib.h
+
+exit 0

+ 6 - 2
package_build_list_host_darwin.json

@@ -34,7 +34,9 @@
         "python-3.7.10-rev1-darwin" : "package-system/python/build_package_image.py",
         "mcpp-2.7.2_az.1-rev1-mac": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.1-rev1",
         "mikkelsen-1.0.0.4-mac": "package-system/mikkelsen/build_package_image.py --platform mac",
-        "mikkelsen-1.0.0.4-ios": "package-system/mikkelsen/build_package_image.py --platform ios"  
+        "mikkelsen-1.0.0.4-ios": "package-system/mikkelsen/build_package_image.py --platform ios",
+        "zlib-1.2.11-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Mac --package-root ../../package-system --clean",
+        "zlib-1.2.11-rev1-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name iOS --package-root ../../package-system --clean"
     },
     "build_from_folder" : { 
         "AWSNativeSDK-1.7.167-rev3-mac" : "package-system/AWSNativeSDK-mac",
@@ -72,6 +74,8 @@
         "azslc-1.7.23-rev2-mac": "package-system/azslc-mac",
         "SQLite-3.32.2-rev3-multiplatform" : "package-system/SQLite-multiplatform",
         "xxhash-0.7.4-rev1-multiplatform":  "package-system/xxhash-multiplatform",
-        "qt-5.15.2-rev5-mac": "package-system/qt-mac"
+        "qt-5.15.2-rev5-mac": "package-system/qt-mac",
+        "zlib-1.2.11-rev1-mac": "package-system/zlib-mac",
+        "zlib-1.2.11-rev1-ios": "package-system/zlib-ios"
     }
 }

+ 4 - 2
package_build_list_host_linux.json

@@ -23,7 +23,8 @@
         "azslc-1.7.23-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux --package-root ../../package-system --clean",
         "tiff-4.2.0.10-linux" : "package-system/tiff/build_package_image.py --platform linux",
         "python-3.7.10-rev2-linux" : "package-system/python/build_package_image.py",
-        "mikkelsen-1.0.0.4-linux": "package-system/mikkelsen/build_package_image.py"
+        "mikkelsen-1.0.0.4-linux": "package-system/mikkelsen/build_package_image.py",
+        "zlib-1.2.11-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Linux --package-root ../../package-system --clean"
     },
     "build_from_folder" : {
         "AWSGameLiftServerSDK-3.4.1-rev1-linux" : "package-system/AWSGameLiftServerSDK/linux",
@@ -50,6 +51,7 @@
         "unwind-1.2.1-linux": "package-system/unwind-linux",
         "SQLite-3.32.2-rev3-multiplatform" : "package-system/SQLite-multiplatform",
         "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform",
-        "qt-5.15.2-rev5-linux": "package-system/qt-linux"
+        "qt-5.15.2-rev5-linux": "package-system/qt-linux",
+        "zlib-1.2.11-rev1-linux": "package-system/zlib-linux"
     }
 }

+ 9 - 5
package_build_list_host_windows.json

@@ -35,8 +35,10 @@
         "v-hacd-2.3-1a49edf-rev1-windows": "package-system/v-hacd/build_package_image.py --platform-name windows",
         "python-3.7.10-rev1-windows" : "package-system/python/build_package_image.py",
         "mikkelsen-1.0.0.4-windows": "package-system/mikkelsen/build_package_image.py",
-        "mikkelsen-1.0.0.4-android": "package-system/mikkelsen/build_package_image.py --platform android"
-    },
+        "mikkelsen-1.0.0.4-android": "package-system/mikkelsen/build_package_image.py --platform android",
+        "zlib-1.2.11-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Windows --package-root ../../package-system --clean",
+        "zlib-1.2.11-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Android --package-root ../../package-system --clean"
+      },
   "build_from_folder": {
     "AWSGameLiftServerSDK-3.4.1-rev1-windows" : "package-system/AWSGameLiftServerSDK/windows",
     "AWSNativeSDK-1.7.167-rev3-windows": "package-system/AWSNativeSDK-windows",
@@ -65,7 +67,7 @@
     "lux_core-2.2-rev5-multiplatform": "package-system/luxcore-multiplatform",
     "python-3.7.10-rev1-windows": "package-system/python/win_x64/package",
     "pybind11-2.4.3-rev1-multiplatform": "package-system/pybind11-multiplatform",
-    "zlib-1.2.8-rev2-multiplatform": "zlib/zlib-multiplatform",
+    "alembic-1.7.11-rev3-multiplatform": "package-system/alembic-multiplatform",
     "hdf5-1.0.11-rev2-multiplatform": "package-system/hdf5-multiplatform",
     "ilmbase-2.3.0-rev4-multiplatform": "package-system/ilmbase-multiplatform",
     "assimp-5.0.1-rev11-multiplatform": "package-system/assimp-multiplatform",
@@ -79,7 +81,7 @@
     "NvCloth-v1.1.6-4-gd243404-pr58-rev1-android": "package-system/NvCloth-android",
     "mikkelsen-1.0.0.4-windows": "package-system/mikkelsen-windows",
     "mikkelsen-1.0.0.4-android": "package-system/mikkelsen-android",
-    "OpenMesh-8.1-rev1-windows": "package-system/OpenMesh-windows",
+    "OpenMesh-8.1-rsv1-windows": "package-system/OpenMesh-windows",
     "pyside2-qt-5.15.1-rev2-windows": "package-system/pyside2-windows",
     "d3dx12-headers-rev1-windows": "package-system/d3dx12-windows",
     "mcpp-2.7.2_az.1-rev1-windows": "package-system/mcpp-windows",
@@ -100,6 +102,8 @@
     "PVRTexTool-4.24.0-rev4-multiplatform": "package-system/PVRTexTool-multiplatform",
     "ISPCTexComp-2021.3-rev1-windows": "package-system/ISPCTexComp-windows",
     "qt-5.15.2-rev4-windows": "package-system/qt-windows",
-    "Wwise-2021.1.0.7575-rev1-multiplatform": "package-system/Wwise-multiplatform"
+    "Wwise-2021.1.0.7575-rev1-multiplatform": "package-system/Wwise-multiplatform",
+    "zlib-1.2.11-rev1-android": "package-system/zlib-android",
+    "zlib-1.2.11-rev1-windows": "package-system/zlib-windows"
   }
 }