Open marklomas opened 5 months ago
That makes sense, would you like to submit a PR?
I think I stumbled upon something quite interesting...
I try to integrate OTIO in a C++ project together with Qt and wrote myself a small build system wrapper (that invokes Cmake). OTIO just builds and installs fine. When trying to include the library / includepath into my project via
LIBS += -L/usr/local/lib -lopentimelineio
INCLUDEPATH += /usr/local/include
I get the same error telling me that ImathBox.h
is missing and could not be found:
/usr/local/include/opentimelineio/serializableObject.h:15:10: fatal error: 'ImathBox.h' file not found
#include "ImathBox.h"
^~~~~~~~~~~~
1 warning and 1 error generated.
When explicitly setting the includepath in my .pro
file, everything works as expected..
LIBS += -L/usr/local/lib -lopentimelineio
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include/Imath
Oh, that's a very helpful observation. The proper fix is that OTIO itself should be including <Imath/ImathBox.h>
, not the local path "ImathBox.h"
. I'm wondering if you might be able to test that and let us know if changing the include path also fixes the problem in your set up?
Hey @meshula, I try this tonight and probably submit a small PR if that works.
It seems like neither the cmake additions of @marklomas nor the fix to include <Imath/ImathBox.h>
directly works out for me. When using <Imath/ImathBox.h>
OTIO won't build, exiting with:
/Users/jan/_Projekte/_tests/HelloQt6/build/outdir/opentimelineio/src/opentimelineio/serializableObject.h:15:10: fatal error: 'Imath/ImathBox.h' file not found
#include <Imath/ImathBox.h>
btw: Whats quite interesting about this even in the log above:
composable.h uses it as <ImathBox.h>
and this straight up just works atleast due to the build order of these files, it is used before serializableObject.h
. Thats atleast what I understand. If I change this inside serializableObject.h
to <ImathBox.h>
, it gives me the same build error requiring me to add the Imath include directory specifically.
Bug Report
Build Problem
OTIO_IMATH_TARGETS is added to the cmake module so that applications using opentimelineio can inherit the correct library paths and libraries to link against, however IMATH_INCLUDES is not added to the cmake module. It specifies the include path for IMath header files included by files such as
opentimelineio/serializableObject.h
.As a result, applications don't compile out of the box without discovering the correct IMath include path for themselves and manually adding it to the compiler's command line. The correct include path is needed to ensure the same version of IMath that opentimelineio was compiled against is referenced by the application.
For OTIO_IMATH_TARGETS, the
src/opentimelineio/CMakeLists.txt
file already does this:The same could be done for IMATH_INCLUDES by adding it to the public interface (it's only added to the private interface at the moment and hence not exported to the cmake module):
I've tested this change locally and it resolves the build error in the attached log.
Expected Behavior
The cmake module provides application developers with the include path to the version of IMath that was discovered and used to build opentimelineio.
Logs