Skip to content
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

exr: Re-enable openexr core default when recent enough #3942

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:
cxx_compiler: g++-11
cxx_std: 17
fmt_ver: 9.1.0
openexr_ver: v3.1.7
openexr_ver: v3.1.11
pybind11_ver: v2.11.1
python_ver: "3.10"
simd: avx2,f16c
Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
cc_compiler: clang
cxx_std: 20
fmt_ver: 9.0.0
openexr_ver: v3.1.5
openexr_ver: v3.1.11
pybind11_ver: v2.9.2
python_ver: 3.8
simd: avx2,f16c
Expand Down
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* C++14 or higher (also builds with C++17, and C++20)
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* ADVISORY: We expect that OIIO 2.6 in 2024 will require C++17 or higher.
* Compilers: gcc 6.1 - 12.1, clang 3.4 - 16, MSVS 2017 - 2019,
Intel icc 17+, Intel OneAPI C++ compiler 2022+.
* **CMake >= 3.15** (tested through 3.27)
Expand Down
8 changes: 6 additions & 2 deletions src/cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,19 @@ macro (oiio_add_all_tests)
set (all_openexr_tests
openexr-suite openexr-multires openexr-chroma
openexr-v2 openexr-window perchannel oiiotool-deep)
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
# OpenEXR 3.1.10 is the first release where the exr core library
# properly supported all compression types (DWA in particular).
list (APPEND all_openexr_tests openexr-compression)
endif ()
# Run all OpenEXR tests without core library
oiio_add_tests (${all_openexr_tests} openexr-compression
oiio_add_tests (${all_openexr_tests}
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=0
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
# For OpenEXR >= 3.1, be sure to test with the core option on
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1)
oiio_add_tests (${all_openexr_tests}
# N.B. doesn't work yet: openexr-compression
SUFFIX ".core"
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=1
IMAGEDIR openexr-images
Expand Down
12 changes: 12 additions & 0 deletions src/libOpenImageIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ if (EMBEDPLUGINS)
endforeach ()
endif ()

# Enable default use of OpenEXR core library for versions of the library
# new enough to support DWA compression in exrcore.
if (OPENEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
target_compile_definitions(OpenImageIO
PRIVATE OIIO_OPENEXR_CORE_DEFAULT=1)
message (STATUS "OpenEXR core library will be used by default")
else ()
target_compile_definitions(OpenImageIO
PRIVATE OIIO_OPENEXR_CORE_DEFAULT=0)
message (STATUS "OpenEXR core library will not be used by default")
endif ()

# Source groups for libutil and libtexture
source_group ("libutil" REGULAR_EXPRESSION ".+/libutil/.+")
source_group ("libtexture" REGULAR_EXPRESSION ".+/libtexture/.+")
Expand Down
6 changes: 5 additions & 1 deletion src/libOpenImageIO/imageio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ atomic_int oiio_threads(threads_default());
atomic_int oiio_exr_threads(threads_default());
atomic_int oiio_read_chunk(256);
atomic_int oiio_try_all_readers(1);
int openexr_core(0); // Should we use "Exr core C library"?
#ifndef OIIO_OPENEXR_CORE_DEFAULT
# define OIIO_OPENEXR_CORE_DEFAULT 0
#endif
// Should we use "Exr core C library"?
int openexr_core(OIIO_OPENEXR_CORE_DEFAULT);
int tiff_half(0);
int tiff_multithread(1);
int dds_bc5normal(0);
Expand Down
10 changes: 10 additions & 0 deletions src/openexr.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ if (OIIO_USE_EXR_C_API AND TARGET OpenEXR::OpenEXRCore)
list (APPEND openexr_src exrinput_c.cpp)
endif()

# Enable default use of OpenEXR core library for versions of the library
# new enough to support DWA compression in exrcore.
if (OPENEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
list (APPEND openexr_defs OIIO_OPENEXR_CORE_DEFAULT=1)
message (STATUS "OpenEXR core library will be used by default")
else ()
list (APPEND openexr_defs OIIO_OPENEXR_CORE_DEFAULT=0)
message (STATUS "OpenEXR core library will not be used by default")
endif ()

add_oiio_plugin (${openexr_src}
INCLUDE_DIRS ${OPENEXR_INCLUDES} ${IMATH_INCLUDE_DIR}/OpenEXR
LINK_LIBRARIES
Expand Down
Loading