Giter Site home page Giter Site logo

Comments (3)

okawo80085 avatar okawo80085 commented on June 21, 2024

Almost done with this one actually, it was easier than i expected.

from issue_tracker.

okawo80085 avatar okawo80085 commented on June 21, 2024

So the solution i found, that is more or less painless, is: all dependencies must use CMake and be setup for tool chains, while also having a repo tree like this:

# lets say the name of the dep is "example"
# so the repo structure will look like this
example/
├── CMakeLists.txt
├── LICENSE
├── README.md
├── src
│   ├── example.h
│   └── # and other src files
└── test
    ├── CMakeLists.txt
    └── # test src files

The main dep build recipe should not set up any global variables or declarations, only target specific commands.
It needs to have tests, but they need to be off by default (i'm not building dep tests in production, just no, our driver takes ages to compile as is).
The main include header for the dep needs to be located (and named) in <dep_repo_root>/src/<dep_name>.h and the dep needs to declare only a single target named <dep_name>.

All of that to achieve this behavior when using the dep.

CMakeLists.txt in the main project:

...

# setup toolchain
add_subdirectory("<dep_name>")
set(<dep_name>_INCLUDE_DIR "<dep_repo_root>/src/")

...

# add dep to include path
target_include_directories(main_target
    ...
    ${<dep_name>_INCLUDE_DIR}
    ...
)

...

# link dep target
target_link_libraries(main_target
    <dep_name>
    ...
    ${CMAKE_DL_LIBS}
)

...

from issue_tracker.

okawo80085 avatar okawo80085 commented on June 21, 2024

It'll take some time to move all of our deps to this mental model (cough cough openvr cough cough), but it's worth it and most of our deps are already pretty much setup for this, requiring only a few tweaks (like disabling test builds or changing some compile options).

from issue_tracker.

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.