Code Monkey home page Code Monkey logo

Comments (5)

oysstu avatar oysstu commented on August 30, 2024 1

Ah great, I was looking for a way to compile shared libraries instead of the static libs, but I looked in the hunter documentation and the CMakeList.txt's and not the cmake docs. I have no problem with the usage of hunter, but trying to integrate it directly into another build system was a bit of a handful.

Thanks for the help!

from depthai-core.

themarpe avatar themarpe commented on August 30, 2024 1

I haven't done any find_package usage from install depthai-core
It seems like the INTERFACE_INCLUDE_DIRECTORIES contains the correct directories, but nevertheless my install doesn't fill out the config correctly.

I'll refactor this to install the actual targets nlohmann_json and XLink alongside depthai-core with their respective *Config.cmake files, as well as give a try with static library by installing all (private as well) targets.

Thanks for giving this a try.

Again a right now solution is: specify include directories manually instead of relaying on find_package and *Config.cmake

from depthai-core.

themarpe avatar themarpe commented on August 30, 2024 1

@oysstu latest release of Gen2 (now on main and develop) include a complete set of dependencies needed to link to either static or shared depthai::core. (If opencv is found, there is also depthai::opencv target - includes opencv support on some API)

Example:

  • Build and install depthai-core to default installation ([build_dir]/install)
  • Your project: find_package(depthai) while providing -D depthai_DIR=[build_dir]/install/lib/cmake/depthai

The above will correctly search for and find the needed dependencies. In case shared libs are used, only public dependencies are installed, otherwise private are as well (so final linking finds all needed static libraries)

from depthai-core.

themarpe avatar themarpe commented on August 30, 2024

Hi @oysstu
The goal of using package manager (Hunter in our case) is to remove the submodules from the repository.
I do agree that Hunter has its own set of details (quirks) to deal with, as it works best as a top/root project package manager.

The option you've specified, by installing the libraries will have to be fixed for static builds. You've reminded me about a way to describe this dependencies, so I'll try to integrate that in the upcoming days.

For getting it to work now, compile as a shared library: -D BUILD_SHARED_LIBS=ON and install. This will give you all the needed files to link and include:

  • include/
  • include/depthai/3rdparty
  • include/depthai-shared/3rdparty

from depthai-core.

oysstu avatar oysstu commented on August 30, 2024

Reopening this, as it did not work out of the box. The shared libraries were successfully built. However, the cmake configuration installed still causes cmake to try to link with nlohmann_json and XLInk. I can successfully link with depthai-core if I remove the interface link libraries below in depthai-coreConfig.cmake.

set_target_properties(depthai-core PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/depthai/3rdparty;${_IMPORT_PREFIX}/include/depthai-shared/3rdparty"
  INTERFACE_LINK_LIBRARIES "nlohmann_json::nlohmann_json;XLink"
)

from depthai-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.