-
Notifications
You must be signed in to change notification settings - Fork 39
Update OpenEXR to a newer version for prep of OpenImageIO #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nick-l-o3de
wants to merge
1
commit into
o3de:main
Choose a base branch
from
nick-l-o3de:update_openexr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -635,17 +635,27 @@ def sync_source(self): | |
| if len(call_result.stdout.decode('utf-8', 'ignore')): | ||
| # If anything changed, then restore the entire source tree | ||
| print(f"Path '{self.src_folder}' was modified. Restoring...") | ||
| git_restore_cmd = ['git', 'restore', '--recurse-submodules', ':/'] | ||
| call_result = subprocess.run(subp_args(git_restore_cmd), | ||
| shell=True, | ||
| capture_output=False, | ||
| cwd=str(self.src_folder.resolve())) | ||
| git_clean_command = ['git', 'clean', '-fd'] | ||
| call_result = subprocess.run(subp_args(git_clean_command), | ||
| shell=True, | ||
| capture_output=False, | ||
| cwd=str(self.src_folder.resolve())) | ||
| if call_result.returncode != 0: | ||
|
Comment on lines
+638
to
643
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note, this just adds a |
||
| # If we cannot restore through git, then delete the folder and re-clone | ||
| print(f"Unable to restore {self.src_folder}. Deleting and re-cloning...") | ||
| print(f"Unable to clean {self.src_folder}. Deleting and re-cloning...") | ||
| delete_folder(self.src_folder) | ||
| self.clone_to_local() | ||
|
|
||
| else: | ||
| git_restore_cmd = ['git', 'restore', '--recurse-submodules', ':/'] | ||
| call_result = subprocess.run(subp_args(git_restore_cmd), | ||
| shell=True, | ||
| capture_output=False, | ||
| cwd=str(self.src_folder.resolve())) | ||
| if call_result.returncode != 0: | ||
| # If we cannot restore through git, then delete the folder and re-clone | ||
| print(f"Unable to restore {self.src_folder}. Deleting and re-cloning...") | ||
| delete_folder(self.src_folder) | ||
| self.clone_to_local() | ||
| # Do a re-pull | ||
| git_pull_cmd = ['git', | ||
| 'pull'] | ||
|
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,10 @@ | ||
| # | ||
| # 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. | ||
| # 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() | ||
|
|
||
| include(${CMAKE_CURRENT_LIST_DIR}/o3de_package_utilities.cmake) | ||
|
|
||
| # OpenEXR depends on ZLIB. For maximum compatibility here, we use the | ||
| # official ZLIB library name, ie, ZLIB::ZLIB and not o3de 3rdParty::ZLIB. | ||
| # O3DE's zlib package will define both. If we're in O3DE we can also | ||
| # auto-download ZLIB. | ||
| if (NOT TARGET ZLIB::ZLIB) | ||
| if (COMMAND ly_download_associated_package) | ||
| ly_download_associated_package(ZLIB REQUIRED MODULE) | ||
| endif() | ||
| find_package(ZLIB REQUIRED) | ||
| endif() | ||
|
|
||
| find_package(Imath MODULE REQUIRED) # will bring in the FindImath.cmake in the same folder | ||
|
|
||
| # read the existing config files that OpenEXR made when it compiled: | ||
| o3de_import_existing_config_files(OpenEXR ${CMAKE_CURRENT_LIST_DIR}/OpenEXR/lib/cmake) | ||
|
|
||
| # map from "OpenEXR::xxxxx to 3rdParty::xxxxxx" | ||
| o3de_import_targets(NAMESPACE_FROM | ||
| OpenEXR | ||
| NAMESPACE_TO | ||
| 3rdParty | ||
| COMPONENTS | ||
| OpenEXRConfig | ||
| IexConfig | ||
| IlmThreadConfig | ||
| Iex | ||
| IlmThread | ||
| OpenEXRCore | ||
| OpenEXRUtil | ||
| OpenEXR) | ||
|
|
||
| # fixup OpenEXR::xxxxxx it forces /EHsc when compiled on windows MSVC, when it should be doing so when targetted to it instead: | ||
| set_target_properties(OpenEXR::Iex PROPERTIES INTERFACE_COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") | ||
| set_target_properties(OpenEXR::IlmThread PROPERTIES INTERFACE_COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") | ||
| set_target_properties(OpenEXR::OpenEXRCore PROPERTIES INTERFACE_COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") | ||
| set_target_properties(OpenEXR::OpenEXR PROPERTIES INTERFACE_COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") | ||
| set_target_properties(OpenEXR::OpenEXRUtil PROPERTIES INTERFACE_COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") | ||
|
|
||
| # 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 OpenEXR ${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}) | ||
| # force this into config mode, so that it uses the config files instead of module files. | ||
| set(OpenEXR_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
| find_package(OpenEXR 3.4.13 REQUIRED CONFIG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,5 @@ | ||
| # Ilmbase Build From Source Instructions # | ||
| ## Prerequisites ## | ||
| * 3p-package-scripts (https://github.com/o3de/3p-package-scripts) | ||
|
|
||
| ## 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. | ||
| ## OpenEXR from ASWF | ||
|
|
||
| The PATCH file (o3de-oexr.patch) just renames a single file in the vendored openjph library, | ||
| to make it so that the object file name does not collide, and trigger | ||
| https://github.com/AcademySoftwareFoundation/openexr/issues/2596 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| diff --git a/external/OpenJPH/src/core/others/ojph_mem.c b/external/OpenJPH/src/core/others/ojph_mem_c.c | ||
| similarity index 100% | ||
| rename from external/OpenJPH/src/core/others/ojph_mem.c | ||
| rename to external/OpenJPH/src/core/others/ojph_mem_c.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # | ||
| # 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 | ||
| # | ||
| # | ||
|
|
||
| set(PACKAGE_VERSION 3.4.13) | ||
| set(PACKAGE_VERSION_EXACT False) | ||
| set(PACKAGE_VERSION_COMPATIBLE False) | ||
|
|
||
| if (NOT ${PACKAGE_FIND_NAME} STREQUAL "OpenEXR") | ||
| return() | ||
| endif() | ||
|
|
||
| if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) | ||
| return() | ||
| endif() | ||
|
|
||
| set(PACKAGE_VERSION_COMPATIBLE TRUE) | ||
|
|
||
| if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) | ||
| set(PACKAGE_VERSION_EXACT TRUE) | ||
| endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, this prevents an infinite recursion problem, where this file would find package and its own folder is added to the package prefix paths.