Просмотр исходного кода

Expat - use release mode on linux and android (#101)

expat update - ensure that release configs are used

Linux and android version of expat were building in "NoConfig" since they were not specifying the configuration for it despite using a single-configuration generator (ie, not a multi-config generator)

This switches them to build with explicit release mode. It also eliminates some cruft out of the packages.

Note that CMAke calls it EXPAT but other 3p libraries that we use (opencolorio for example) call it expat, so for compat, we export both, but use the opencolorIO version...

Signed-off-by: lawsonamzn <[email protected]>
Nicholas Lawson 3 лет назад
Родитель
Сommit
7e067bf1cc

+ 13 - 3
package-system/expat/Findexpat.cmake

@@ -13,10 +13,13 @@ endif()
 
 # Even though expat itself exports it as lowercase expat, older cmake (and cmake's built-in targets)
 # expect uppercase.  So we define both, for backwards compat:
+# See https://cmake.org/cmake/help/latest/module/FindEXPAT.html for how CMake exports it.
+# in order to support old and new packages, we'll export it as CMake exports it but also
+# alias that to older legacy ones.
 
 if (WIN32)
     # on windows, expat adds the nonstandard 'lib' prefix and MD, dMD suffixes for 
-    # Multighreaded Dynamic CRT and debug Multithreaded Dynamic CRT
+    # Multithreaded Dynamic CRT and debug Multithreaded Dynamic CRT
     # We don't use the debug version since its a pure C library with no C++ and thus will
     # not have an ITERATOR_DEBUG_LEVEL conflict
     set(PREFIX_TO_USE "lib")
@@ -27,13 +30,19 @@ else()
     set(SUFFIX_TO_USE ${CMAKE_STATIC_LIBRARY_SUFFIX})
 endif()
 
+set(EXPAT_VERSION_STRING "2.4.2")
+set(EXPAT_VERSION "2.4.2") # backward compat
+set(expat_VERSION "2.4.2") # backward compat
+
 set(EXPAT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/expat/lib/${PREFIX_TO_USE}expat${SUFFIX_TO_USE})
 set(expat_LIBRARY ${EXPAT_LIBRARY})
+set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) # compatibility with CMake's FindEXPAT.cmake
 
 set(EXPAT_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/expat/include)
 set(expat_INCLUDE_DIR ${EXPAT_INCLUDE_DIR})
+set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})  #compatibility with CMake's FindEXPAT file.
 
-set(EXPAT_FOUND TRUE)
+set(EXPAT_FOUND TRUE) #compatibility with CMake's FindEXPAT file.
 set(expat_FOUND TRUE)
 
 add_library(expat::expat STATIC IMPORTED GLOBAL)
@@ -53,12 +62,13 @@ endif()
 add_library(3rdParty::expat ALIAS expat::expat)
 
 # upppercase for compat:
-add_library(EXPAT::EXPAT ALIAS expat::expat)
+add_library(EXPAT::EXPAT ALIAS expat::expat) #compatibility with CMake's FindEXPAT file.
 
 # if we're not in O3DE, it's also extremely helpful to show a message to logs that indicate that this
 # library was successfully picked up, as opposed to the system one.
 # A good way to know if you're in O3DE or not is that O3DE sets various cache variables before 
 # calling find_package, specifically, LY_VERSION_ENGINE_NAME is always set very early:
+
 if (NOT LY_VERSION_ENGINE_NAME)
     message(STATUS "Using O3DE expat ${expat_VERSION} from ${CMAKE_CURRENT_LIST_DIR}")
 endif()

+ 13 - 10
package-system/expat/build_config.json

@@ -2,13 +2,19 @@
     "git_url":"https://github.com/libexpat/libexpat",
     "git_tag":"R_2_4_2",
     "package_name":"expat",
-    "package_version":"2.4.2-rev1",
+    "package_version":"2.4.2-rev2",
     "package_url":"https://libexpat.github.io/",
     "package_license":"MIT",
     "package_license_file":"expat/COPYING",
     "cmake_find_source":"Findexpat.cmake",
     "cmake_find_target":"Findexpat.cmake",
     "cmake_src_subfolder": "expat",
+    "cmake_install_filter" : [
+      "*.h",
+      "*.a",
+      "*.lib",
+      "COPYING"
+    ],
     "cmake_generate_args_common": [
         "-DBUILD_SHARED_LIBS=0",
         "-DCMAKE_CXX_STANDARD=17",
@@ -28,7 +34,6 @@
     "Platforms":{
         "Windows":{
           "Windows": {
-              "custom_cmake_install": true,
               "cmake_generate_args": [
                   "-G",
                   "\"Visual Studio 16 2019\""
@@ -38,11 +43,11 @@
               ]
           },
           "Android": {
-            "custom_cmake_install": true,
-            "cmake_generate_args": [
+            "cmake_generate_args_release": [
                 "-G",
                 "Ninja",
-                "-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Android/Toolchain_android.cmake"
+                "-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Android/Toolchain_android.cmake",
+                "-DCMAKE_BUILD_TYPE=Release"
             ],
             "custom_test_cmd" : [
                 "test_expat_android.cmd"
@@ -51,7 +56,6 @@
         },
         "Darwin": {
           "Mac": {
-              "custom_cmake_install": true,
               "cmake_generate_args": [
                   "-G",
                   "Xcode",
@@ -62,7 +66,6 @@
             ]
           },
           "iOS" : {
-            "custom_cmake_install": true,
             "cmake_generate_args": [
                 "-G",
                 "Xcode",
@@ -76,11 +79,11 @@
         },
         "Linux":{
            "Linux":{
-              "custom_cmake_install":true,
-              "cmake_generate_args": [
+              "cmake_generate_args_release": [
                   "-G",
                   "Unix\\ Makefiles",
-                  "-DCMAKE_C_FLAGS=-fPIC"
+                  "-DCMAKE_C_FLAGS=-fPIC",
+                  "-DCMAKE_BUILD_TYPE=Release"
               ],
               "custom_test_cmd" : [
                 "./test_expat_linux.sh"

+ 1 - 0
package-system/expat/test_expat_ios.sh

@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # 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.

+ 1 - 0
package-system/expat/test_expat_linux.sh

@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # 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.

+ 1 - 0
package-system/expat/test_expat_mac.sh

@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # 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.

+ 4 - 4
package_build_list_host_darwin.json

@@ -48,8 +48,8 @@
         "lz4-1.9.3-vcpkg-rev4-ios": "package-system/lz4/build_package_image.py --platform-name ios",
         "tiff-4.2.0.15-rev3-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Mac --package-root ../../package-system --clean",
         "tiff-4.2.0.15-rev3-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name iOS --package-root ../../package-system --clean",
-        "expat-2.4.2-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Mac --package-root ../../package-system/expat/temp --clean",
-        "expat-2.4.2-rev1-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name iOS --package-root ../../package-system/expat/temp --clean"
+        "expat-2.4.2-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Mac --package-root ../../package-system/expat/temp --clean",
+        "expat-2.4.2-rev2-ios": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name iOS --package-root ../../package-system/expat/temp --clean"
     },
     "build_from_folder": {
         "assimp-5.1.6-rev2-mac": "package-system/assimp-mac",
@@ -98,7 +98,7 @@
         "zlib-1.2.11-rev5-ios": "package-system/zlib-ios",
         "lz4-1.9.3-vcpkg-rev4-mac": "package-system/lz4-mac",
         "lz4-1.9.3-vcpkg-rev4-ios": "package-system/lz4-ios",
-        "expat-2.4.2-rev1-mac": "package-system/expat/temp/expat-mac",
-        "expat-2.4.2-rev1-ios": "package-system/expat/temp/expat-ios"
+        "expat-2.4.2-rev2-mac": "package-system/expat/temp/expat-mac",
+        "expat-2.4.2-rev2-ios": "package-system/expat/temp/expat-ios"
     }
 }

+ 2 - 2
package_build_list_host_linux.json

@@ -36,7 +36,7 @@
         "qt-5.15.2-rev5-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux --package-root ../../package-system --clean",
         "zlib-1.2.11-rev5-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Linux --package-root ../../package-system --clean",
         "lz4-1.9.3-vcpkg-rev4-linux": "package-system/lz4/build_package_image.py --platform-name linux",
-        "expat-2.4.2-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux --package-root ../../package-system/expat/temp --clean"
+        "expat-2.4.2-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux --package-root ../../package-system/expat/temp --clean"
     },
     "build_from_folder": {
         "assimp-5.1.6-rev1-linux": "package-system/assimp-linux",
@@ -73,6 +73,6 @@
         "qt-5.15.2-rev5-linux": "package-system/qt-linux",
         "zlib-1.2.11-rev5-linux": "package-system/zlib-linux",
         "lz4-1.9.3-vcpkg-rev4-linux": "package-system/lz4-linux",
-        "expat-2.4.2-rev1-linux": "package-system/expat/temp/expat-linux"
+        "expat-2.4.2-rev2-linux": "package-system/expat/temp/expat-linux"
     }
 }

+ 4 - 4
package_build_list_host_windows.json

@@ -14,8 +14,8 @@
         "Blast-v1.1.7_rc2-9-geb169fe-rev2-windows": "package-system/Blast/build_package_image.py --platform-name windows",
         "Crashpad-0.8.0-rev1-windows": "package-system/Crashpad/build_package_image.py",
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean",
-        "expat-2.4.2-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean",
-        "expat-2.4.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean",
+        "expat-2.4.2-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean",
+        "expat-2.4.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean",
         "freetype-2.11.1-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Android --package-root ../../package-system/freetype/temp --clean",
         "freetype-2.11.1-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Windows --package-root ../../package-system/freetype/temp --clean",
         "googlebenchmark-1.5.0-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Android --package-root ../../package-system --clean",
@@ -72,8 +72,8 @@
     "Crashpad-0.8.0-rev1-windows": "package-system/Crashpad-windows",
     "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-windows": "package-system/DirectXShaderCompilerDxc-windows",
     "d3dx12-headers-rev1-windows": "package-system/d3dx12-windows",
-    "expat-2.4.2-rev1-android": "package-system/expat/temp/expat-android",
-    "expat-2.4.2-rev1-windows": "package-system/expat/temp/expat-windows",
+    "expat-2.4.2-rev2-android": "package-system/expat/temp/expat-android",
+    "expat-2.4.2-rev2-windows": "package-system/expat/temp/expat-windows",
     "freetype-2.11.1-rev1-android": "package-system/freetype/temp/freetype-android",
     "freetype-2.11.1-rev1-windows": "package-system/freetype/temp/freetype-windows",
     "glad-2.0.0-beta-rev2-multiplatform": "package-system/glad-multiplatform",