Skip to content

Commit

Permalink
exr: Re-enable openexr core default when recent enough
Browse files Browse the repository at this point in the history
We had disabled the use of the "openexr core" library by default,
even for OpenEXR versions that nominally support it, when it was
discovered that it stil didn't support the DWA compression types.

That has finally been added to the OpenEXR trunk as well as the
OpenEXR 3.1.10 release. When we are building against a sufficiently new
OpenEXR to fully support all the compression types for exr core, then
re-enable it by default.

Bump the "latest" CI tests to OpenEXR 3.1.10.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Aug 13, 2023
1 parent e3f6665 commit 845ddbf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
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.10
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.10
pybind11_ver: v2.9.2
python_ver: 3.8
simd: avx2,f16c
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

0 comments on commit 845ddbf

Please sign in to comment.