Open nrusch opened 1 year ago
You are right, opentime should't link against opentimelineio. I haven't seen that reported before, I wonder what's up.
The transitive dependence should be specifically that the include path to Imath is public ~ does cmake have a way to do that?
If you have answers to these feel free to create a PR.
You are right, opentime should't link against opentimelineio. I haven't seen that reported before, I wonder what's up.
Yeah, this one is a bit of a mystery, and may be due to the revision I'm building from. I'll keep poking around and open a separate issue if I can prove it. :)
The transitive dependence should be specifically that the include path to Imath is public ~ does cmake have a way to do that?
In an Imath 3.x-only world, you could use Imath::ImathConfig
instead of Imath::Imath
as the public link target, and then Imath::Imath
as a private target, though the redundancy is unfortunate.
Supporting both IlmBase and Imath 3.x will take a bit more footwork. I would point to OpenImageIO as a good example of how to support them in tandem and distill things down to a common set of CMake variables: https://github.com/OpenImageIO/oiio/blob/master/src/cmake/modules/FindOpenEXR.cmake
Currently, the ${IMATH_INCLUDES}
variable is not set when using Imath 3.x, otherwise I think you could do something like this:
target_include_directories(opentimelineio
PUBLIC "${IMATH_INCLUDES}"
PRIVATE "${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/src/deps"
"${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include"
"${PROJECT_SOURCE_DIR}/src/deps/rapidjson/include")
target_link_libraries(opentimelineio
PUBLIC opentime
PRIVATE ${OTIO_IMATH_TARGETS})
I'm building OTIO against an external
Imath
distribution (i.e.OTIO_FIND_IMATH=ON
), and it looks like the_otio
Python extension module is being linked directly against theImath
lib, leading to the following runtime error:Here is the
patchelf
output for the_otio
library:If I manually remove the direct dependency on
libImath-3_1.so.29
, the error is resolved:Looking at the CMake build configuration, I'm fairly certain this is because
Imath
is included in the public link interface for theopentimelineio
target (https://github.com/AcademySoftwareFoundation/OpenTimelineIO/blob/main/src/opentimelineio/CMakeLists.txt#L88-L89), and thus becomes a transitive dependency when theopentimelineio-bindings
target is linked against it.To Reproduce
Versions
devtoolset-9
RPM)CMake Arguments
Imath is being located via the
CMAKE_PREFIX_PATH
environment variable, which includes the directory containing theImath/ImathConfig.cmake
file.Additional Note: It looks like the
opentime
Python extension module may (unnecessarily?) link againstlibopentimelineio
. This may warrant a separate issue.