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

build(deps): Raise OpenEXR min to 2.4 #1734

Merged
merged 1 commit into from
Oct 3, 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
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,26 @@ jobs:
fail-fast: false
matrix:
include:
- desc: gcc6/C++14 llvm9 py2.7 boost1.66 exr2.3 oiio2.3 sse2
nametag: linux-vfx2019
- desc: gcc6/C++14 llvm9 py2.7 boost1.66 exr2.4 oiio2.3 sse2
nametag: linux-vfx2020
os: ubuntu-latest
container: aswftesting/ci-osl:2019-clang9
vfxyear: 2019
cxx_std: 14
openexr_ver: v2.4.3
openimageio_ver: v2.4.13.0
python_ver: 2.7
pybind11_ver: v2.4.2
setenvs: export CMAKE_VERSION=3.15.5
- desc: clang9/C++14 llvm9 oiio-release boost1.66 avx2 exr2.3 py2.7
- desc: clang9/C++14 llvm9 oiio-release boost1.66 avx2 exr2.4 py2.7
nametag: linux-clang9-llvm9
os: ubuntu-20.04
container: aswftesting/ci-osl:2019-clang9
vfxyear: 2019
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 14
openexr_ver: v2.4.3
openimageio_ver: release
python_ver: 2.7
# pybind11_ver: v2.9.0
Expand Down Expand Up @@ -147,7 +149,7 @@ jobs:
pybind11_ver: v2.9.0
simd: avx2,f16c
batched: b8_AVX2
- desc: GPU Cuda11 gcc11/C++17 llvm15 py3.10 boost-1.80 exr-3.1 OIIO-master avx2
- desc: GPU Cuda11 gcc11/C++17 llvm15 py3.10 boost1.80 exr3.1 OIIO-master avx2
nametag: linux-optix7-2023
os: ubuntu-latest
container: aswftesting/ci-osl:2023-clang15
Expand All @@ -160,12 +162,13 @@ jobs:
skip_tests: 1
setenvs: export OSL_CMAKE_FLAGS="-DOSL_USE_OPTIX=1" OPTIX_VERSION=7.0
OPENIMAGEIO_CMAKE_FLAGS=-DBUILD_FMT_VERSION=9.1.0
- desc: oldest everything gcc6/C++14 llvm9 py2.7 boost1.66 oiio2.3 no-simd exr2.3
- desc: oldest everything gcc6/C++14 llvm9 py2.7 boost1.66 oiio2.3 no-simd exr2.4
nametag: linux-oldest
os: ubuntu-latest
container: aswftesting/ci-osl:2019-clang9
vfxyear: 2019
cxx_std: 14
openexr_ver: v2.4.3
openimageio_ver: v2.4.13.0
python_ver: 2.7
pybind11_ver: v2.6.2
Expand Down Expand Up @@ -331,13 +334,13 @@ jobs:
setenvs: export LLVM_VERSION=10.0.0
OPENIMAGEIO_CMAKE_FLAGS="-DBUILD_FMT_VERSION=7.0.1"
PUGIXML_VERSION=v1.10
- desc: latest releases gcc11/C++17 llvm13 boost1.71 exr3.1 py3.9 avx2 batch-b16avx512
- desc: latest releases gcc11/C++17 llvm13 boost1.71 exr3.2 py3.9 avx2 batch-b16avx512
nametag: linux-latest-releases
os: ubuntu-22.04
cxx_compiler: g++-11
cxx_std: 17
fmt_ver: 10.1.0
openexr_ver: v3.1.7
openexr_ver: v3.2.1
openimageio_ver: master
pybind11_ver: v2.10.0
python_ver: "3.10"
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
* The minimum version OpenImageIO has been raised from 2.2 to 2.4. [#1591](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1591) [#1722](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1722)
(to 2.3 in 1.13.0.3, to 2.4 in 1.13.4.0)
* Raise minimum CMake dependency from 3.12 to 3.15 [#1724](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1724) (1.13.5.0)
* Raise minimum Imath/OpenEXR from 2.3 to 2.4.

### OSL Language and oslc compiler:
* There have been no substantive changes to the OSL language in this release.
Expand Down
10 changes: 7 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ NEW or CHANGED dependencies since the last major release are **bold**.
* [Cuda](https://developer.nvidia.com/cuda-downloads) 9.0 or higher. It is
recommended that you use 11.0 or higher.

* [Boost](https://www.boost.org) 1.55 or newer (tested through boost 1.81)
* [Ilmbase or Imath](https://github.com/AcademySoftwareFoundation/openexr) 2.3
or newer (recommended: 2.4 or higher; tested through 3.1)
* [Boost](https://www.boost.org) 1.55 or newer (tested through boost 1.82)
* [Ilmbase or Imath](https://github.com/AcademySoftwareFoundation/Imath) 2.4
or newer (recommended: 3.1 or higher; tested through 3.2)
NOTE: It is likely that 1.13 is the last release that will support
Imath/OpenEXR 2.x.
* [Flex](https://github.com/westes/flex) 2.5.35 or newer and
[GNU Bison](https://www.gnu.org/software/bison/) 2.7 or newer.
Note that on some MacOS/xcode releases, the system-installed Bison is too
Expand All @@ -64,6 +66,8 @@ NEW or CHANGED dependencies since the last major release are **bold**.
* (optional) Python: If you are building the Python bindings or running the
testsuite:
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9, 3.10)
NOTE: It is likely that 1.13 is the last release that will support
Python 2.7.
* pybind11 >= 2.4.2 (Tested through 2.10)
* NumPy
* (optional) Qt5 >= 5.6 or Qt6 (tested Qt5 through 5.15 and Qt6 through 6.4).
Expand Down
49 changes: 16 additions & 33 deletions src/build-scripts/build_openexr.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -ex

# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.1.1}
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.1.11}

# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
Expand All @@ -37,42 +37,25 @@ if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}
fi
mkdir -p ${OPENEXR_INSTALL_DIR} && true
mkdir -p ${OPENEXR_BUILD_DIR} && true

pushd ${OPENEXR_SOURCE_DIR}
git checkout ${OPENEXR_VERSION} --force

if [[ ${OPENEXR_VERSION} == "v2.3.0" ]] ; then
# Simplified setup for 2.3+
cmake -S . -B ${OPENEXR_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DOPENEXR_BUILD_TESTS=0 \
-DOPENEXR_BUILD_PYTHON_LIBS=0 \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build ${OPENEXR_BUILD_DIR} --target install --config ${OPENEXR_BUILD_TYPE}
else
# Simplified setup for 2.4+
cmake -S . -B ${OPENEXR_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DINSTALL_OPENEXR_EXAMPLES=0 \
-DOPENEXR_INSTALL_EXAMPLES=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build ${OPENEXR_BUILD_DIR} --target install --config ${OPENEXR_BUILD_TYPE}
fi
cmake -S . -B ${OPENEXR_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DINSTALL_OPENEXR_EXAMPLES=0 \
-DOPENEXR_INSTALL_EXAMPLES=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS}
time cmake --build ${OPENEXR_BUILD_DIR} --target install --config ${OPENEXR_BUILD_TYPE}

popd

Expand Down
6 changes: 3 additions & 3 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ checked_find_package (ZLIB REQUIRED) # Needed by several packages

# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
VERSION_MIN 2.3
RECOMMEND_MIN 2.4
VERSION_MIN 2.4
RECOMMEND_MIN 2.5
RECOMMEND_MIN_REASON
"Even extremely critical patches are no longer supplied to < 2.4"
"Even extremely critical patches are no longer supplied to < 2.5"
PRINT IMATH_INCLUDES
)
# Force Imath includes to be before everything else to ensure that we have
Expand Down
165 changes: 5 additions & 160 deletions src/cmake/modules/FindOpenEXR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# I'm afraid this is a mess, due to needing to support a wide range of
# OpenEXR versions.
#
# For OpenEXR & Imath 3.0, this will establish the following imported
# For OpenEXR & Imath 3.x, this will establish the following imported
# targets:
#
# Imath::Imath
Expand All @@ -24,14 +24,12 @@
# IlmBase::IlmThread
# OpenEXR::IlmImf
#
# For all versions -- but for OpenEXR < 2.4 the only thing this sets --
# are the following CMake variables:
# For all version, the following CMake variables:
#
# OPENEXR_FOUND true, if found
# OPENEXR_INCLUDES directory where OpenEXR headers are found
# OPENEXR_LIBRARIES libraries for OpenEXR + IlmBase
# OPENEXR_VERSION OpenEXR version (accurate for >= 2.0.0,
# otherwise will just guess 1.6.1)
# OPENEXR_VERSION OpenEXR version
# IMATH_INCLUDES directory where Imath headers are found
# ILMBASE_INCLUDES directory where IlmBase headers are found
# ILMBASE_LIBRARIES libraries just IlmBase
Expand All @@ -50,7 +48,7 @@ if (TARGET OpenEXR::OpenEXR AND TARGET Imath::Imath)
# OpenEXR 3.x if both of these targets are found
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 3 (OPENEXR_VERSION=${OpenEXR_VERSION})")
message (STATUS "Found CONFIG for OpenEXR 3 (OpenEXR_VERSION=${OpenEXR_VERSION})")
endif ()

# Mimic old style variables
Expand Down Expand Up @@ -80,7 +78,7 @@ elseif (TARGET OpenEXR::IlmImf AND TARGET IlmBase::Imath AND
# OpenEXR 2.4 or 2.5 with exported config
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 2 (OPENEXR_VERSION=${OpenEXR_VERSION})")
message (STATUS "Found CONFIG for OpenEXR 2 (OpenEXR_VERSION=${OpenEXR_VERSION})")
endif ()

# Mimic old style variables
Expand Down Expand Up @@ -111,157 +109,4 @@ elseif (TARGET OpenEXR::IlmImf AND TARGET IlmBase::Imath AND
string(REGEX REPLACE "include/OpenEXR$" "include" IMATH_INCLUDES "${IMATH_INCLUDES}")
string(REGEX REPLACE "include/OpenEXR$" "include" OPENEXR_INCLUDES "${OPENEXR_INCLUDES}")

else ()
# OpenEXR 2.x older versions without a config or whose configs we don't
# trust.

set (FOUND_OPENEXR_WITH_CONFIG 0)

# Other standard issue macros
include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)

find_package (ZLIB REQUIRED)

# Link with pthreads if required
find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT)
set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
endif ()

# Attempt to find OpenEXR with pkgconfig
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
if (NOT Ilmbase_ROOT AND NOT ILMBASE_ROOT
AND NOT DEFINED ENV{Ilmbase_ROOT} AND NOT DEFINED ENV{ILMBASE_ROOT})
pkg_check_modules(_ILMBASE QUIET IlmBase>=2.0.0)
endif ()
if (NOT OpenEXR_ROOT AND NOT OPENEXR_ROOT
AND NOT DEFINED ENV{OpenEXR_ROOT} AND NOT DEFINED ENV{OPENEXR_ROOT})
pkg_check_modules(_OPENEXR QUIET OpenEXR>=2.0.0)
endif ()
endif (PKG_CONFIG_FOUND)

# List of likely places to find the headers -- note priority override of
# ${OPENEXR_ROOT}/include.
# ILMBASE is needed in case ilmbase an openexr are installed in separate
# directories, like NixOS does
set (GENERIC_INCLUDE_PATHS
${OPENEXR_ROOT}/include
$ENV{OPENEXR_ROOT}/include
${ILMBASE_ROOT}/include
$ENV{ILMBASE_ROOT}/include
${_ILMBASE_INCLUDEDIR}
${_OPENEXR_INCLUDEDIR}
/usr/local/include
/usr/include
/usr/include/${CMAKE_LIBRARY_ARCHITECTURE}
/sw/include
/opt/local/include )

# Find the include file locations.
find_path (ILMBASE_INCLUDE_PATH OpenEXR/IlmBaseConfig.h
HINTS ${ILMBASE_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} )
find_path (OPENEXR_INCLUDE_PATH OpenEXR/OpenEXRConfig.h
HINTS ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} )

# Try to figure out version number
if (DEFINED _OPENEXR_VERSION AND NOT "${_OPENEXR_VERSION}" STREQUAL "")
set (OPENEXR_VERSION "${_OPENEXR_VERSION}")
string (REGEX REPLACE "([0-9]+)\\.[0-9\\.]+" "\\1" OPENEXR_VERSION_MAJOR "${_OPENEXR_VERSION}")
string (REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" OPENEXR_VERSION_MINOR "${_OPENEXR_VERSION}")
elseif (EXISTS "${OPENEXR_INCLUDE_PATH}/OpenEXR/ImfMultiPartInputFile.h")
# Must be at least 2.0
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_STRING .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENEXR_VERSION ${TMP})
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MAJOR ${TMP})
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MINOR ${TMP})
else ()
# Assume an old one, predates 2.x that had versions
set (OPENEXR_VERSION 1.6.1)
set (OPENEXR_MAJOR 1)
set (OPENEXR_MINOR 6)
endif ()


# List of likely places to find the libraries -- note priority override of
# ${OPENEXR_ROOT}/lib.
set (GENERIC_LIBRARY_PATHS
${OPENEXR_ROOT}/lib
${ILMBASE_ROOT}/lib
${OPENEXR_INCLUDE_PATH}/../lib
${ILMBASE_INCLUDE_PATH}/../lib
${_ILMBASE_LIBDIR}
${_OPENEXR_LIBDIR}
/usr/local/lib
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/sw/lib
/opt/local/lib
$ENV{PROGRAM_FILES}/OpenEXR/lib/static )

# message (STATUS "Generic lib paths: ${GENERIC_LIBRARY_PATHS}")

# Handle request for static libs by altering CMAKE_FIND_LIBRARY_SUFFIXES.
# We will restore it at the end of this file.
set (_openexr_orig_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
if (OpenEXR_USE_STATIC_LIBS)
if (WIN32)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else ()
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif ()
endif ()

# Look for the libraries themselves, for all the components.
# This is complicated because the OpenEXR libraries may or may not be
# built with version numbers embedded.
set (_openexr_components IlmThread IlmImf Imath Iex Half)
foreach (COMPONENT ${_openexr_components})
string (TOUPPER ${COMPONENT} UPPERCOMPONENT)
# First try with the version embedded
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY
NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}
${COMPONENT}
${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d
${COMPONENT}_d
HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} )
endforeach ()

find_package_handle_standard_args (OpenEXR
REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH
OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY
OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY
)

if (OPENEXR_FOUND)
set (OpenEXR_VERSION ${OPENEXR_VERSION})
set (ILMBASE_FOUND TRUE)
set (ILMBASE_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (IMATH_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDES ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (IMATH_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
set (FINDOPENEXR_FALLBACK TRUE)
endif ()

mark_as_advanced(
OPENEXR_ILMIMF_LIBRARY
OPENEXR_IMATH_LIBRARY
OPENEXR_IEX_LIBRARY
OPENEXR_HALF_LIBRARY
OPENEXR_VERSION)

# Restore the original CMAKE_FIND_LIBRARY_SUFFIXES
set (CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_orig_suffixes})

endif ()
Loading