diff --git a/CMakeLists.txt b/CMakeLists.txt index cff5581..7eeaa16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,20 @@ IF(USE_CONAN) ENDIF() SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) -FIND_PACKAGE ( IlmBase REQUIRED ) -FIND_PACKAGE ( OpenEXR REQUIRED ) +FIND_PACKAGE ( IlmBase QUIET ) +IF(IlmBase_FOUND) + FIND_PACKAGE ( OpenEXR REQUIRED ) +ELSE() + FIND_PACKAGE ( Imath REQUIRED CONFIG ) + FIND_PACKAGE ( OpenEXR REQUIRED CONFIG ) + ADD_COMPILE_DEFINITIONS(OPENEXRID_USE_IMATH3) + IF(TARGET OpenEXR::OpenEXR) + SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR) + ENDIF() + IF(TARGET Imath::Imath) + LIST(APPEND OPENEXR_LIBRARIES Imath::Imath) + ENDIF() +ENDIF() FIND_PACKAGE ( ZLIB REQUIRED ) FIND_PACKAGE ( OpenGL REQUIRED ) diff --git a/nuke/OSL/include/OSL/matrix22.h b/nuke/OSL/include/OSL/matrix22.h index da75c25..4cdfd1d 100644 --- a/nuke/OSL/include/OSL/matrix22.h +++ b/nuke/OSL/include/OSL/matrix22.h @@ -40,7 +40,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #pragma once +#ifdef OPENEXRID_USE_IMATH3 +#include +#else #include +#endif + +#include +#include namespace Imathx { // "extended" Imath @@ -225,7 +232,7 @@ template class Matrix22 //------------------------------------------------------------ // Inverse matrix: If singExc is false, inverting a singular // matrix produces an identity matrix. If singExc is true, - // inverting a singular matrix throws a SingMatrixExc. + // inverting a singular matrix throws an exception. // // inverse() and invert() invert matrices using determinants. // @@ -279,10 +286,10 @@ template class Matrix22 // Limitations of type T (see also class limits) //------------------------------------------------- - static T baseTypeMin() {return Imath::limits::min();} - static T baseTypeMax() {return Imath::limits::max();} - static T baseTypeSmallest() {return Imath::limits::smallest();} - static T baseTypeEpsilon() {return Imath::limits::epsilon();} + static T baseTypeMin() {return std::numeric_limits::min();} + static T baseTypeMax() {return std::numeric_limits::max();} + static T baseTypeSmallest() {return std::numeric_limits::min();} + static T baseTypeEpsilon() {return std::numeric_limits::epsilon();} private: @@ -778,7 +785,7 @@ Matrix22::inverse (bool singExc) const } else { - T mr = Imath::abs (r) / Imath::limits::smallest(); + T mr = Imath::abs (r) / std::numeric_limits::min(); for (int i = 0; i < 2; ++i) { @@ -791,7 +798,7 @@ Matrix22::inverse (bool singExc) const else { if (singExc) - throw Imath::SingMatrixExc ("Cannot invert " + throw std::invalid_argument ("Cannot invert " "singular matrix."); return Matrix22(); } diff --git a/nuke/OSL/include/OSL/oslconfig.h b/nuke/OSL/include/OSL/oslconfig.h index b930923..2d1ca4c 100644 --- a/nuke/OSL/include/OSL/oslconfig.h +++ b/nuke/OSL/include/OSL/oslconfig.h @@ -55,10 +55,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Symbol export defines #include "export.h" -// All the things we need from Imath +// All the things we need from Imath. OpenEXR 3 split Imath into its own include path. +#ifdef OPENEXRID_USE_IMATH3 +#include +#include +#include +#else #include #include #include +#endif // All the things we need from OpenImageIO #include