Bläddra i källkod

Upgrade ilmbase to OpenEXR.

Signed-off-by: hershey5045 <[email protected]>
hershey5045 3 år sedan
förälder
incheckning
f1866fac93

+ 16 - 0
Scripts/extras/pull_and_build_from_git.py

@@ -779,6 +779,19 @@ class BuildInfo(object):
 
         return False
 
+    def copy_extra_files(self):
+        """
+        Copies any extra files specified in the build config into the destination folder for packaging.
+        """
+        extra_files_to_copy = self.platform_config.get('extra_files_to_copy', [])
+
+        for (source, dest) in extra_files_to_copy:
+            print(f"Source file: {self.base_folder / source}, Destination file: {self.package_install_root / dest}")
+            shutil.copy2(
+                self.base_folder / source,
+                self.package_install_root / dest
+            )
+
     def build_for_platform(self):
         """
         Build for the current platform (host+target)
@@ -919,6 +932,9 @@ class BuildInfo(object):
             # Build the package
             self.build_for_platform()
 
+            # Copy extra files specified in the build config
+            self.copy_extra_files()
+
         # Generate the Find*.cmake file
         self.generate_cmake()
 

+ 64 - 0
package-system/OpenEXR/FindImath.cmake

@@ -0,0 +1,64 @@
+#
+# 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
+#
+#
+
+if (TARGET 3rdParty::Imath)
+    return()
+endif()
+
+set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR/lib/cmake)
+
+find_package(Imath CONFIG)
+
+set(Imath_COMPONENTS
+    Imath::Imath
+    Imath::ImathConfig
+)
+
+foreach(component ${Imath_COMPONENTS})
+    if(TARGET ${component})
+        # convert the includes to system includes
+        get_target_property(system_includes ${component} INTERFACE_INCLUDE_DIRECTORIES)
+        set_target_properties(${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") # Clear it in case someone refers to it
+        
+        if (COMMAND ly_target_include_system_directories)
+            ly_target_include_system_directories(TARGET ${component} INTERFACE ${system_includes})
+        else()
+            target_include_directories(${component} SYSTEM INTERFACE ${system_includes})
+        endif()
+
+        # Alias the target with 3rdParty prefix
+        add_library(3rdParty::${component} ALIAS ${component})
+
+		# inside the loop where it sets the system includes for each component
+		foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
+			string(TOUPPER ${conf} UCONF)
+			if (${UCONF} STREQUAL "DEBUG" AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
+				set_target_properties(${component} PROPERTIES 
+										MAP_IMPORTED_CONFIG_${UCONF} DEBUG)
+			else()
+				set_target_properties(${component} PROPERTIES 
+										MAP_IMPORTED_CONFIG_${UCONF} RELEASE)
+			endif()
+		endforeach()
+    else()
+        message(WARNING "Target not found in Imath: ${component}")
+    endif()
+endforeach()
+
+# create main library alias that O3DE can use to get default dependencies.
+# users can also bind to any of the other components above, but this one gives you most of the functionality
+# you probably want:
+add_library(3rdParty::Imath ALIAS Imath::Imath)
+
+# 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 the O3DE version of the Imath library (v${Imath_VERSION}) from ${CMAKE_CURRENT_LIST_DIR}")
+endif()

+ 74 - 0
package-system/OpenEXR/FindOpenEXR.cmake

@@ -0,0 +1,74 @@
+#
+# 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
+#
+#
+
+if (TARGET 3rdParty::OpenEXR)
+    return()
+endif()
+
+set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR/lib/cmake)
+
+find_package(Imath MODULE REQUIRED) # will bring in the FindImath.cmake in the same folder
+find_package(OpenEXR CONFIG REQUIRED)
+
+set(OpenEXR_COMPONENTS
+    OpenEXR::OpenEXRConfig
+    OpenEXR::IexConfig
+    OpenEXR::IlmThreadConfig
+    OpenEXR::Iex
+    OpenEXR::IlmThread
+    OpenEXR::OpenEXRCore
+    OpenEXR::OpenEXRUtil
+    OpenEXR::OpenEXR
+)
+
+foreach(component ${OpenEXR_COMPONENTS})
+    if(TARGET ${component})
+        # convert the includes to system includes
+        get_target_property(system_includes ${component} INTERFACE_INCLUDE_DIRECTORIES)
+        set_target_properties(${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") # Clear it in case someone refers to it
+        
+        if (COMMAND ly_target_include_system_directories)
+            ly_target_include_system_directories(TARGET ${component} INTERFACE ${system_includes})
+        else()
+            target_include_directories(${component} SYSTEM INTERFACE ${system_includes})
+        endif()
+
+        # Alias the target with 3rdParty prefix
+        add_library(3rdParty::${component} ALIAS ${component})
+		
+		# inside the loop where it sets the system includes for each component
+		foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
+			string(TOUPPER ${conf} UCONF)
+			if (${UCONF} STREQUAL "DEBUG" AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
+				set_target_properties(${component} PROPERTIES 
+										MAP_IMPORTED_CONFIG_${UCONF} DEBUG)
+			else()
+				set_target_properties(${component} PROPERTIES 
+										MAP_IMPORTED_CONFIG_${UCONF} RELEASE)
+			endif()
+		endforeach()
+    else()
+        message(WARNING "Target not found in OpenEXR: ${component}")
+    endif()
+endforeach()
+
+# create main library alias that O3DE can use to get default dependencies.
+# users can also bind to any of the other components above, but this one gives you most of the functionality
+# you probably want:
+add_library(3rdParty::OpenEXR ALIAS OpenEXR::OpenEXR)
+
+# 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 the O3DE version of the OpenEXR library (v${OpenEXR_VERSION}) from ${CMAKE_CURRENT_LIST_DIR}")
+endif()
+
+# compat - some libraries check for OPENEXR_VERSION even though the correct check is OpenEXR_VERSION
+set(OPENEXR_VERSION ${OpenEXR_VERSION})

+ 0 - 40
package-system/OpenEXR/Findilmbase.cmake.Linux

@@ -1,40 +0,0 @@
-#
-# 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::ilmbase")
-if (TARGET $${TARGET_WITH_NAMESPACE})
-    return()
-endif()
-
-set(MY_NAME "ilmbase")
-
-set($${MY_NAME}_INCLUDE_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include 
-                           $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include/OpenEXR)
-
-set(_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/lib)
-set($${MY_NAME}_LIBRARY_DEBUG   $${_LIBS_DIR}/libIlmImfUtil-2_3_s.a
-                                $${_LIBS_DIR}/libIlmImf-2_3_s.a # Order is important. IlmImf libs depend on ilmbase libs
-                                $${_LIBS_DIR}/libHalf-2_3_s.a
-                                $${_LIBS_DIR}/libIex-2_3_s.a
-                                $${_LIBS_DIR}/libIexMath-2_3_s.a
-                                $${_LIBS_DIR}/libIlmThread-2_3_s.a
-                                $${_LIBS_DIR}/libImath-2_3_s.a)
-set($${MY_NAME}_LIBRARY_RELEASE $${$${MY_NAME}_LIBRARY_DEBUG})
-endif()
-
-# we set it to a generator expression for multi-config situations:
-set($${MY_NAME}_LIBRARY  
-    "$$<$$<CONFIG:profile>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Release>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Debug>:$${$${MY_NAME}_LIBRARY_DEBUG}>")
-
-add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
-ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR})
-target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_LIBRARY})
-
-set($${MY_NAME}_FOUND True)

+ 0 - 40
package-system/OpenEXR/Findilmbase.cmake.Mac

@@ -1,40 +0,0 @@
-#
-# 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::ilmbase")
-if (TARGET $${TARGET_WITH_NAMESPACE})
-    return()
-endif()
-
-set(MY_NAME "ilmbase")
-
-set($${MY_NAME}_INCLUDE_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include 
-                           $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include/OpenEXR)
-
-set(_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/lib)
-set($${MY_NAME}_LIBRARY_DEBUG   $${_LIBS_DIR}/libIlmImfUtil-2_3_s.a
-                                $${_LIBS_DIR}/libIlmImf-2_3_s.a # Order is important. IlmImf libs depend on ilmbase libs
-                                $${_LIBS_DIR}/libHalf-2_3_s.a
-                                $${_LIBS_DIR}/libIex-2_3_s.a
-                                $${_LIBS_DIR}/libIexMath-2_3_s.a
-                                $${_LIBS_DIR}/libIlmThread-2_3_s.a
-                                $${_LIBS_DIR}/libImath-2_3_s.a)
-set($${MY_NAME}_LIBRARY_RELEASE $${$${MY_NAME}_LIBRARY_DEBUG})
-endif()
-
-# we set it to a generator expression for multi-config situations:
-set($${MY_NAME}_LIBRARY  
-    "$$<$$<CONFIG:profile>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Release>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Debug>:$${$${MY_NAME}_LIBRARY_DEBUG}>")
-
-add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
-ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR})
-target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_LIBRARY})
-
-set($${MY_NAME}_FOUND True)

+ 0 - 46
package-system/OpenEXR/Findilmbase.cmake.Windows

@@ -1,46 +0,0 @@
-#
-# 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::ilmbase")
-if (TARGET $${TARGET_WITH_NAMESPACE})
-    return()
-endif()
-
-set(MY_NAME "ilmbase")
-
-set($${MY_NAME}_INCLUDE_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include 
-                           $${CMAKE_CURRENT_LIST_DIR}/ilmbase/include/OpenEXR)
-
-set(_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/ilmbase/lib)
-set($${MY_NAME}_LIBRARY_DEBUG   $${_LIBS_DIR}/IlmImfUtil-2_3_s_d.lib
-                                $${_LIBS_DIR}/IlmImf-2_3_s_d.lib
-                                $${_LIBS_DIR}/Half-2_3_s_d.lib
-                                $${_LIBS_DIR}/Iex-2_3_s_d.lib
-                                $${_LIBS_DIR}/IexMath-2_3_s_d.lib
-                                $${_LIBS_DIR}/IlmThread-2_3_s_d.lib
-                                $${_LIBS_DIR}/Imath-2_3_s_d.lib)
-set($${MY_NAME}_LIBRARY_RELEASE $${_LIBS_DIR}/IlmImfUtil-2_3_s.lib
-                                $${_LIBS_DIR}/IlmImf-2_3_s.lib
-                                $${_LIBS_DIR}/Half-2_3_s.lib
-                                $${_LIBS_DIR}/Iex-2_3_s.lib
-                                $${_LIBS_DIR}/IexMath-2_3_s.lib
-                                $${_LIBS_DIR}/IlmThread-2_3_s.lib
-                                $${_LIBS_DIR}/Imath-2_3_s.lib)
-endif()
-
-# we set it to a generator expression for multi-config situations:
-set($${MY_NAME}_LIBRARY  
-    "$$<$$<CONFIG:profile>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Release>:$${$${MY_NAME}_LIBRARY_RELEASE}>"
-    "$$<$$<CONFIG:Debug>:$${$${MY_NAME}_LIBRARY_DEBUG}>")
-
-add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
-ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR})
-target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_LIBRARY})
-
-set($${MY_NAME}_FOUND True)

+ 18 - 19
package-system/OpenEXR/README.md

@@ -2,22 +2,21 @@
 ## Prerequisites ##
 * 3p-package-scripts (https://github.com/o3de/3p-package-scripts)
 
-## Instructions ##
-1. Print packages available. Look for zlib and ilmbase versions to build from source
-    ```
-    cd 3p-package-source
-    python ..\3p-package-scripts\o3de_package_scripts\list_packages.py --search_path .
-    ```
-2. Build zlib
-    ```
-    cd 3p-package-source
-    python ..\3p-package-scripts\o3de_package_scripts\build_package.py --search_path . <zlib_version>
-    # e.g. zlib_version=zlib-1.2.11-rev1-windows
-    ```
-3. Build ilmbase
-    ```
-    cd 3p-package-source
-    python ..\3p-package-scripts\o3de_package_scripts\build_package.py --search_path . <ilmbase_version>
-    # e.g. ilmbase_version=ilmbase-2.3.0-rev4-windows
-    ```
-4. Build artifacts will be located in the packages folder.
+## To build
+
+set the working directory the the root of the 3p-package-source repository (where the package_build_list* json files are located.)
+
+# mac
+    python3 ../3p-package-scripts/o3de_package_scripts/build_package.py --search_path . OpenEXR-3.1.3-rev1-mac
+# windows
+    python ..\3p-package-scripts\o3de_package_scripts\build_package.py --search_path . OpenEXR-3.1.3-rev1-windows
+# linux
+    python3 ../3p-package-scripts/o3de_package_scripts/build_package.py --search_path . OpenEXR-3.1.3-rev1-linux
+
+# on all platforms:
+
+Build artifacts will be located in the packages folder.
+
+## note about iMath library
+The iMath library is built as part of OpenEXR but lives in a separate repository.  The build script for OpenEXR will fetch imath and pass the same build parameters that were fed in for OpenEXR when building it.  This means the command line for OpenEXR should contain both OpenEXR-specific parameters like ``OPENEXR_BUILD_TESTS`` but also more generic parameters that iMath will recognise like ``BUILD_TESTING=OFF`` to be passed through.
+

+ 58 - 75
package-system/OpenEXR/build_config.json

@@ -1,100 +1,83 @@
 {
    "git_url":"https://github.com/AcademySoftwareFoundation/openexr.git",
-   "git_tag":"RB-2.3",
-   "package_name":"ilmbase",
-   "package_version":"2.3.0-rev4",
-   "package_url":"https://github.com/03de/OpenEXR",
-   "package_license":"Apache-2.0",
-   "package_license_file":"LICENSE",
-   "cmake_find_target":"Findilmbase.cmake",
+   "git_tag":"v3.1.3",
+   "package_name":"OpenEXR",
+   "package_version":"3.1.3-rev2",
+   "package_url":"https://www.openexr.com/",
+   "package_license":"BSD-3-Clause",
+   "package_license_file":"LICENSE.md",
+   "cmake_find_source":"FindOpenEXR.cmake",
+   "cmake_find_target":"FindOpenEXR.cmake",
    "Platforms":{
       "Windows":{
          "Windows":{
-            "cmake_find_template":"Findilmbase.cmake.Windows",
-            "cmake_generate_args_debug":[
-               "-G",
-               "\"Visual Studio 16 2019\"",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-windows/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Debug",
-               "-DZLIB_ROOT=../../../zlib-windows/zlib"
+            "build_configs" : ["debug", "release"],
+            "depends_on_packages" :[ 
+               ["zlib-1.2.11-rev5-windows", "8847112429744eb11d92c44026fc5fc53caa4a06709382b5f13978f3c26c4cbd", ""]
             ],
-            "cmake_generate_args_release":[
+            "cmake_generate_args":[
                "-G",
                "\"Visual Studio 16 2019\"",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-windows/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Release",
-               "-DZLIB_ROOT=../../../zlib-windows/zlib"
-            ]
+               "-DBUILD_TESTING=OFF",
+               "-DOPENEXR_INSTALL_EXAMPLES=OFF",
+               "-DOPENEXR_BUILD_TOOLS=OFF",
+               "-DBUILD_SHARED_LIBS=OFF",
+               "-DCMAKE_INSTALL_PREFIX=\"../../openexr-windows/OpenEXR\""
+            ],
+            "custom_test_cmd" : [
+               "test_openexr_windows.cmd"
+            ],
+			"extra_files_to_copy": [
+				["FindImath.cmake", "FindImath.cmake"]
+			]
          }
       },
       "Darwin":{
          "Mac":{
-            "cmake_find_template":"Findilmbase.cmake.Mac",
-            "cmake_generate_args_debug":[
-               "-G",
-               "Xcode",
-               "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-mac/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Debug",
-               "-DZLIB_ROOT=../../../zlib-mac/zlib"
+            "build_configs" : ["Release"],
+            "depends_on_packages" :[ 
+               ["zlib-1.2.11-rev5-mac", "b6fea9c79b8bf106d4703b67fecaa133f832ad28696c2ceef45fb5f20013c096", ""]
             ],
-            "cmake_generate_args_release":[
+            "custom_toolchain_file" : "../cmake/Platform/Mac/Toolchain_mac.cmake",
+            "cmake_generate_args_release": [
                "-G",
                "Xcode",
-               "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-mac/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Release",
-               "-DZLIB_ROOT=../../../zlib-mac/zlib"
-            ]
+               "-DBUILD_TESTING=OFF",
+               "-DBUILD_SHARED_LIBS=OFF",
+               "-DOPENEXR_INSTALL_EXAMPLES=OFF",
+               "-DOPENEXR_INSTALL_TOOLS=OFF",
+               "-DDOCS=OFF",
+               "-DPYTHON=OFF",
+               "-DCMAKE_INSTALL_PREFIX=\"../../OpenEXR-mac/OpenEXR\"",
+               "-DCMAKE_BUILD_TYPE=Release"
+            ],
+            "custom_test_cmd" : [
+               "./test_openexr_mac.sh"
+			],
+			"extra_files_to_copy": [
+				["FindImath.cmake", "FindImath.cmake"]
+			]
          }
       },
       "Linux":{
          "Linux":{
-            "cmake_find_template":"Findilmbase.cmake.Linux",
-            "cmake_generate_args_debug":[
-               "-G",
-               "Ninja",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-linux/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Debug",
-               "-DZLIB_ROOT=../../../zlib-linux/zlib"
-            ],
+            "build_configs" : ["Release"],
+            "depends_on_packages" :[ 
+                ["zlib-1.2.11-rev5-linux", "9be5ea85722fc27a8645a9c8a812669d107c68e6baa2ca0740872eaeb6a8b0fc", ""]
+           ],
             "cmake_generate_args_release":[
                "-G",
                "Ninja",
-               "-DOPENEXR_BUILD_PYTHON_LIBS=OFF",
-               "-DOPENEXR_BUILD_TESTS=OFF",
-               "-DOPENEXR_BUILD_UTILS=OFF",
-               "-DOPENEXR_BUILD_SHARED=OFF",
-               "-DOPENEXR_BUILD_STATIC=ON",
-               "-DCMAKE_INSTALL_PREFIX=\"../../ilmbase-linux/ilmbase\"",
-               "-DCMAKE_BUILD_TYPE=Release",
-               "-DZLIB_ROOT=../../../zlib-linux/zlib"
-            ]
+               "-DBUILD_TESTING=OFF",
+               "-DOPENEXR_RUN_FUZZ_TESTS=OFF",
+               "-DOPENEXR_INSTALL_EXAMPLES=OFF",
+               "-DOPENEXR_BUILD_TOOLS=OFF",
+               "-DBUILD_SHARED_LIBS=OFF",
+               "-DCMAKE_INSTALL_PREFIX=\"../../openexr-linux/OpenEXR\""
+            ],
+			"extra_files_to_copy": [
+				["FindImath.cmake", "FindImath.cmake"]
+			]
          }
       }
    }

+ 26 - 0
package-system/OpenEXR/test/CMakeLists.txt

@@ -0,0 +1,26 @@
+#
+# 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
+#
+#
+
+cmake_minimum_required(VERSION 3.20)
+
+PROJECT(test_openexr VERSION 1.0 LANGUAGES C CXX)
+
+find_package(OpenEXR)
+find_package(Imath)
+
+add_executable(test_openexr test_openexr.cpp)
+
+# note that we use 3rdParty::OpenEXR here.  This will ONLY work 
+# if the O3DE version of OpenEXR is used, which is what we are testing for.
+target_link_libraries(test_openexr PRIVATE 3rdParty::OpenEXR)
+
+set_target_properties(test_openexr PROPERTIES
+                 XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED OFF
+                 MACOSX_BUNDLE TRUE
+                 XCODE_ATTRIBUTE_EXECUTABLE_NAME "test_OpenEXR")
+

BIN
package-system/OpenEXR/test/atom_brdf.exr


BIN
package-system/OpenEXR/test/base_Log2-48nits_16_LUT.exr


+ 63 - 0
package-system/OpenEXR/test/test_openexr.cpp

@@ -0,0 +1,63 @@
+/*
+ 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
+*/
+
+#include <ImfRgbaFile.h>
+#include <ImfHeader.h>
+#include <ImfChannelList.h>
+
+using namespace Imf_3_1;
+using namespace Imath_3_1;
+
+int
+readHeader(const char fileName[],
+     int &width, int &height, RgbaChannels& channels)
+{
+    RgbaInputFile inputFile(fileName);
+    
+    int num_channels = 0;
+    const Header& header = inputFile.header();
+   
+    Box2i dw = header.dataWindow();
+    width  = dw.max.x - dw.min.x + 1;
+    height = dw.max.y - dw.min.y + 1;
+    channels = inputFile.channels();
+
+    return 0;
+}
+
+int CheckFile(const char fileName[], int expectedWidth, int expectedHeight, RgbaChannels expectedChannels)
+{
+    int w = 0;
+    int h = 0;
+    RgbaChannels channels = {};
+    printf("verifying '%s' ...\n", fileName);
+    readHeader (fileName, w, h, channels);
+    if ( (w != expectedWidth) || (h != expectedHeight) || (channels != expectedChannels) )
+    {
+        printf("ERROR!\nEXPECTED: w = %i, h = %i, channels=0x%02x", expectedWidth, expectedHeight, expectedChannels);
+        printf("ACTUAL  : w = %i, h = %i, channels=0x%02x\n", w, h, channels);
+        return 1;
+    }
+    return 0;
+}
+
+int main()
+{
+    if (int resultCode = CheckFile("test/base_Log2-48nits_16_LUT.exr", 256, 16, WRITE_RGB) != 0)
+    {
+        return resultCode;
+    }
+    
+    if (int resultCode = CheckFile("test/atom_brdf.exr", 256, 256,  WRITE_RGB) != 0)
+    {
+        return resultCode;
+    }
+
+    printf("All is ok\n");
+    
+    return 0;
+}

+ 22 - 0
package-system/OpenEXR/test_openexr_mac.sh

@@ -0,0 +1,22 @@
+#
+# 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
+#
+#
+
+rm -rf temp/build_test
+mkdir temp/build_test
+
+cmake -S test -B temp/build_test -G Xcode \
+    -DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake \
+    -DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" || exit 1
+
+cmake --build temp/build_test --parallel --config Release || exit 1
+temp/build_test/Release/test_openexr.app/Contents/MacOS/test_openexr || exit 1
+
+cmake --build temp/build_test --parallel --config Debug || exit 1
+temp/build_test/Debug/test_openexr.app/Contents/MacOS/test_openexr || exit 1
+
+exit 0

+ 25 - 0
package-system/OpenEXR/test_openexr_windows.cmd

@@ -0,0 +1,25 @@
+@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 #
+
+rmdir /S /Q  temp\build_test
+mkdir temp\build_test
+
+@rem CMAKE demands forward slashes but PACKAGE_ROOT is in native path:
+set "PACKAGE_ROOT=%PACKAGE_ROOT:\=/%"
+set "DOWNLOADED_PACKAGE_FOLDERS=%DOWNLOADED_PACKAGE_FOLDERS:\=/%"
+
+cmake -S test -B temp/build_test ^
+    -DCMAKE_MODULE_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" || exit /b 1
+
+cmake --build temp/build_test --parallel --config Release || exit /b 1
+temp\build_test\Release\test_openexr.exe || exit /b 1
+
+cmake --build temp/build_test --parallel --config Debug || exit /b 1
+temp\build_test\Debug\test_openexr.exe || exit /b 1
+
+exit /b 0

+ 2 - 2
package_build_list_host_windows.json

@@ -27,7 +27,7 @@
         "OpenMesh-8.1-rev3-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenMesh --platform-name Windows --package-root ../../package-system --clean",
         "OpenSSL-1.1.1b-rev2-windows": "package-system/OpenSSL/build_package_image.py",
         "OpenSSL-1.1.1b-rev1-android": "package-system/OpenSSL/build_package_image.py --platform-name android",
-        "ilmbase-2.3.0-rev4-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Windows --package-root ../../package-system --clean",
+        "OpenEXR-3.1.3-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Windows --package-root ../../package-system --clean",
         "SPIRVCross-2021.04.29-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Windows --package-root ../../package-system --clean",
         "SQLite-3.37.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Windows --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Windows --package-root ../../package-system --clean",
@@ -84,7 +84,7 @@
     "pybind11-2.4.3-rev3-multiplatform": "package-system/pybind11-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",
+    "OpenEXR-3.1.3-rev2-windows": "package-system/OpenEXR-windows",
     "squish-ccr-20150601-rev3-multiplatform": "package-system/squish-ccr-multiplatform",
     "md5-2.0-multiplatform": "package-system/md5-multiplatform",
     "RapidJSON-1.1.0-multiplatform": "package-system/RapidJSON-multiplatform",