2
0
Эх сурвалжийг харах

Updates the mac version of ASTC Encoder to actually use release build (#72)

Signed-off-by: lawsonamzn <[email protected]>
Nicholas Lawson 3 жил өмнө
parent
commit
bb6eeedbae

+ 15 - 6
package-system/astc-encoder/astc-encoder-3.2-rev1.patch → package-system/astc-encoder/astcencoder-o3de.patch

@@ -1,17 +1,26 @@
 diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
-index a90fa27..e5ecf8e 100644
+index a90fa27..4e22383 100644
 --- a/Source/CMakeLists.txt
 +++ b/Source/CMakeLists.txt
-@@ -15,10 +15,11 @@
+@@ -15,10 +15,18 @@
  #  under the License.
  #  ----------------------------------------------------------------------------
  
-+# O3DE change: use "-flto -ffat-lto-objects" instead of "-flto -fno-fat-lto-objects" for linux since it may remove some functions for static library which leads to undefined symbols
- # Overwrite the LTO flags to force fat LTO; worth 3-4% performance
+-# Overwrite the LTO flags to force fat LTO; worth 3-4% performance
++# O3DE change: use "-ffat-lto-objects" instead of the default (-fno-fat-lto-objects)
++# for linux since it may remove some functions for static library which leads to undefined symbols
  # See https://gitlab.kitware.com/cmake/cmake/-/issues/16808
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND ${CLI})
+-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND ${CLI})
 -    set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto")
-+    set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-ffat-lto-objects")
++# Note that 
++# 1. XCode does not support --ffat-lto-objects
++# 2. Its not necessary to specify -flto in cmake >= 3.9 because it auto enables it for you if
++#    the target has set INTERPROCEDURAL_OPTIMIZATION target property.  
++# 3. If you use LTO, the bitcode emitted will only be usable on compiler versions equal to or higher
++#    than the version you made the lto-enabled static lib with, so you will have to get the minimum supported
++#    version of xcode and use xcode-select to compile with.
++if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND ${CLI} AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
++   set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-ffat-lto-objects")
  endif()
  
  if(${DECOMPRESSOR})

+ 2 - 1
package-system/astc-encoder/build_config.json

@@ -8,7 +8,7 @@
     "package_license_file": "LICENSE.txt",
     "cmake_find_template": "Findastc-encoder.cmake.template",
     "cmake_find_target": "Findastc-encoder.cmake",
-    "patch_file": "astc-encoder-3.2-rev1.patch",
+    "patch_file": "astcencoder-o3de.patch",
     "Platforms": {
         "Windows": {
             "Windows": {
@@ -22,6 +22,7 @@
         },
         "Darwin": {
             "Mac": {
+                "package_version": "3.2-rev5",
                 "custom_build_cmd": [
                     "./build_mac.sh"
                 ],

+ 5 - 1
package-system/astc-encoder/build_linux.sh

@@ -6,5 +6,9 @@
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 
 # Note: on x86/x64 platforms, O3DE requires a minimum of SSE 4.1, so we do request this.
-cmake -S temp/src -B temp/build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DISA_SSE41=ON || exit $?
+cmake -S temp/src -B temp/build -G "Unix Makefiles" \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DISA_SSE41=ON \
+    || exit $?
+
 cmake --build temp/build -j 8 || exit $?

+ 4 - 2
package-system/astc-encoder/build_mac.sh

@@ -13,8 +13,10 @@ export CXX=clang++
 # Note: on x86/x64 platforms, O3DE requires a minimum of SSE 4.1, so we do request this.
 
 cmake -S temp/src -B temp/build -G "Unix Makefiles" \
+    -DCMAKE_BUILD_TYPE=Release \
     -DISA_SSE41=ON \
-    -DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake || exit $?
+    -DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake \
+    || exit $?
 
-cmake --build temp/build --config Release --parallel || exit $?
+cmake --build temp/build --parallel || exit $?
 

+ 2 - 2
package_build_list_host_darwin.json

@@ -32,7 +32,7 @@
         "v-hacd-2.3-1a49edf-rev1-mac": "package-system/v-hacd/build_package_image.py --platform-name mac",
         "SPIRVCross-2021.04.29-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Mac --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Mac --package-root ../../package-system --clean",
-        "astc-encoder-3.2-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
+        "astc-encoder-3.2-rev5-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
         "azslc-1.7.34-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Mac --package-root ../../package-system --clean",
         "python-3.7.10-rev1-darwin": "package-system/python/build_package_image.py",
@@ -83,7 +83,7 @@
         "mcpp-2.7.2_az.2-rev1-mac": "package-system/mcpp-mac",
         "SPIRVCross-2021.04.29-rev1-mac": "package-system/SPIRVCross-mac",
         "squish-ccr-deb557d-rev1-mac": "package-system/squish-ccr-mac",
-        "astc-encoder-3.2-rev2-mac": "package-system/astc-encoder-mac",
+        "astc-encoder-3.2-rev5-mac": "package-system/astc-encoder-mac",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "package-system/DirectXShaderCompilerDxc-mac",
         "azslc-1.7.34-rev1-mac": "package-system/azslc-mac",
         "SQLite-3.32.2-rev3-multiplatform": "package-system/SQLite-multiplatform",