kzampog / cilantro

A lean C++ library for working with point cloud data
MIT License
1.01k stars 206 forks source link

Minimal way to include cilantro in other project? #71

Closed crosswick closed 10 months ago

crosswick commented 10 months ago

Hi - I've been trying for many days now to add point cloud downsampling to an existing app, not written by me. First I attempted to do this with Open3D, because I have some other code that works with it, but gave up because of some conflict with Openscenegraph that I was unable to solve.

So now I'm trying to integrate cilantro - however, again I get a wealth of errors seemingly having to with some Qt conflict; perhaps having to do with the libqhull component, which if I understand correctly uses Qt somewhere deep down.

In any case: I would be interested to learn how I could include a bare-bones form of cilantro that really only has to offer point cloud data types and do some downsampling; how would I go about this, in terms of CMake, please? Thanks in advance.

crosswick commented 10 months ago

Did an experiment: deleted the entire 3rdparty directory from both src and include, and ran a fresh cmake, make, make install

add cilantro to the other project by adding to its CMakeLists.txt:

find_package(cilantro)

target_link_libraries(${TARGET_NAME} 
    PRIVATE
    ${OSG_LIBRARY}
    Qt5::Widgets
    Qt5::OpenGL
    PUBLIC
    cilantro
    )

Still get a lot of errors like

/usr/local/opt/qt@5/lib/QtGui.framework/Headers/qimage.h:68:7: error: definition of type 'QStringList' conflicts with type alias of the same name
class QStringList;

which disappear when I remove cilantro from the list of target_link_libraries

kzampog commented 10 months ago

I don't know if/how the Qt errors are related with cilantro.

The following steps should work:

crosswick commented 10 months ago

Thanks - I've tried again with a fresh build of that existing app and the Qt-related errors have gone now.

crosswick commented 10 months ago

I've poked around some more; it seems that these errors only occur when I include Cilantro that was built with Pangolin included; see also https://github.com/stevenlovegrove/Pangolin/issues/887