Skip to content

Commit f62b332

Browse files
authored
Drop Imath2 support and modernize Imath includes (#1852)
* Drop support for Imath 2 * Port Imath includes to Imath/*.h As suggested by Imath devs, see AcademySoftwareFoundation/Imath#136 (comment) This is possible now that Imath 2 support was dropped * Add find_dependency call for Imath to *Config.cmake This will make it easier for downstream users * Use global include_directories for internal Imath --------- Signed-off-by: Julius Künzel <[email protected]>
1 parent 9deff1d commit f62b332

File tree

11 files changed

+19
-38
lines changed

11 files changed

+19
-38
lines changed

CMakeLists.txt

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -228,36 +228,21 @@ elseif(OTIO_FIND_IMATH)
228228
message(STATUS "Found Imath 3 at ${Imath_CONFIG}")
229229
set(USE_DEPS_IMATH OFF)
230230
else()
231-
find_package(IlmBase QUIET)
232-
if (IlmBase_FOUND)
233-
message(STATUS "Imath 3 not found, found Imath 2 at ${IlmBase_CONFIG}")
234-
message(STATUS "You may need to point to the Imath headers by setting IMATH_INCLUDES")
235-
set(USE_DEPS_IMATH_OFF)
236-
set(OTIO_RESOLVED_IMATH_LIBRARIES "${IlmBase_LIBRARIES")
237-
else()
238-
message(STATUS "Imath 3 and 2 were not found, using src/deps/Imath")
239-
set(USE_DEPS_IMATH ON)
240-
endif()
231+
message(STATUS "Imath 3 was not found, using src/deps/Imath")
232+
set(USE_DEPS_IMATH ON)
241233
endif()
242234
else()
243235
message(STATUS "Using src/deps/Imath by default")
244236
set(USE_DEPS_IMATH ON)
245237
endif()
246238

239+
if(USE_DEPS_IMATH)
240+
include_directories("${PROJECT_SOURCE_DIR}/src/deps/Imath/src")
241+
endif()
242+
247243
# set up the internally hosted dependencies
248244
add_subdirectory(src/deps)
249245

250-
set (OTIO_IMATH_TARGETS
251-
# For OpenEXR/Imath 3.x:
252-
$<TARGET_NAME_IF_EXISTS:Imath::Imath>
253-
$<TARGET_NAME_IF_EXISTS:Imath::Half>
254-
# For OpenEXR >= 2.4/2.5 with reliable exported targets
255-
$<TARGET_NAME_IF_EXISTS:IlmBase::Imath>
256-
$<TARGET_NAME_IF_EXISTS:IlmBase::Half>
257-
$<TARGET_NAME_IF_EXISTS:IlmBase::Iex>
258-
# For OpenEXR <= 2.3:
259-
${ILMBASE_LIBRARIES})
260-
261246
add_subdirectory(src/opentime)
262247
add_subdirectory(src/opentimelineio)
263248

@@ -272,4 +257,3 @@ endif()
272257
if(OTIO_CXX_EXAMPLES)
273258
add_subdirectory(examples)
274259
endif()
275-

src/opentimelineio/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,13 @@ add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB}
7878
add_library(OTIO::opentimelineio ALIAS opentimelineio)
7979

8080
target_include_directories(opentimelineio
81-
PRIVATE "${IMATH_INCLUDES}"
82-
"${PROJECT_SOURCE_DIR}/src"
81+
PRIVATE "${PROJECT_SOURCE_DIR}/src"
8382
"${PROJECT_SOURCE_DIR}/src/deps"
84-
"${PROJECT_SOURCE_DIR}/src/deps/rapidjson/include"
85-
"${IMATH_INCLUDES}")
83+
"${PROJECT_SOURCE_DIR}/src/deps/rapidjson/include")
84+
8685

8786
target_link_libraries(opentimelineio
88-
PUBLIC opentime ${OTIO_IMATH_TARGETS})
87+
PUBLIC opentime Imath::Imath)
8988

9089
set_target_properties(opentimelineio PROPERTIES
9190
DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}"

src/opentimelineio/OpenTimelineIOConfig.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
include(CMakeFindDependencyMacro)
44
find_dependency(OpenTime)
5+
find_dependency(Imath)
56

67
include("${CMAKE_CURRENT_LIST_DIR}/OpenTimelineIOTargets.cmake")

src/opentimelineio/composable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "opentimelineio/serializableObjectWithMetadata.h"
77
#include "opentimelineio/version.h"
88

9-
#include <ImathBox.h>
9+
#include <Imath/ImathBox.h>
1010

1111
namespace opentimelineio { namespace OPENTIMELINEIO_VERSION {
1212

src/opentimelineio/mediaReference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "opentimelineio/serializableObjectWithMetadata.h"
77
#include "opentimelineio/version.h"
88

9-
#include <ImathBox.h>
9+
#include <Imath/ImathBox.h>
1010

1111
namespace opentimelineio { namespace OPENTIMELINEIO_VERSION {
1212

src/opentimelineio/serializableObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "opentimelineio/typeRegistry.h"
1313
#include "opentimelineio/version.h"
1414

15-
#include "ImathBox.h"
15+
#include "Imath/ImathBox.h"
1616
#include "serialization.h"
1717

1818
#include <list>

src/py-opentimelineio/opentimelineio-bindings/otio_bindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "opentimelineio/typeRegistry.h"
1515
#include "opentimelineio/stackAlgorithm.h"
1616

17-
#include <ImathBox.h>
17+
#include <Imath/ImathBox.h>
1818

1919
namespace py = pybind11;
2020
using namespace pybind11::literals;

src/py-opentimelineio/opentimelineio-bindings/otio_imath.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include "otio_utils.h"
88

9-
#include "ImathBox.h"
10-
#include "ImathVec.h"
9+
#include "Imath/ImathBox.h"
10+
#include "Imath/ImathVec.h"
1111

1212
namespace py = pybind11;
1313

src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "otio_utils.h"
3333
#include "otio_anyDictionary.h"
3434

35-
#include "ImathBox.h"
35+
#include "Imath/ImathBox.h"
3636

3737
namespace py = pybind11;
3838
using namespace pybind11::literals;

src/py-opentimelineio/opentimelineio-bindings/otio_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "opentimelineio/safely_typed_any.h"
1212
#include "opentimelineio/stringUtils.h"
1313

14-
#include <ImathBox.h>
14+
#include <Imath/ImathBox.h>
1515

1616
#include <map>
1717
#include <cstring>

0 commit comments

Comments
 (0)