Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package Management for C++

I am working in a company that they build a project separated in components that are developed separately by different developer teams. Everything in C++.

They use a lot of libraries in common and to manage all of them, they created a tool to somehow relates the version of the project and versions of libraries.

The question is about the existence of some tool in the market that already does this:

I mean, If I go to this tool, I can download for example the version 4.0 of our project that has exactly the version 4.5 of the library 1 and 3.4 of library 2. If I click "Download", I will Download the source code (or binary) of this entire (project + libraries) project and the concrete version of each library.

For example if I want to Download another project of another developers in the company, using same libraries in different version or platforms, I only have to choose that and is gonna download the project 2 with library 1 version 5.0 and library 2 2.5, and so on.

Is there in the market any tool that aloud me to create some relations like that, and btw, connects with code repo (gitlab in our case)?

I checked Gradle, Conan, ... but they build, not manage "relations" between components.

Something like that:

enter image description here

like image 934
Marco Zimmerman Avatar asked Jul 29 '16 10:07

Marco Zimmerman


1 Answers

CMake provides enough functionality to create these kinds of relationships within your build system. Unfortunately you have to use CMake to manage the builds for all of your projects for this to work well. CMake does target Visual Studio as well as GCC, Clang, and ICC. If this interests you keep reading.

  1. Use CMake to construct build configurations for your dependent projects.
  2. Use ExternalProject commands to express the dependencies of the parent projects.
    • ExternalProject supports Git as well as Mecurial, CSV, SVN, and direct tarball downloads.
    • You can specify the exact commit, tag, or branch in Git.
    • Supports Git authentication via SSL or Basic HTTP.
  3. Run CMake against the parent project. All dependencies are downloaded and compiled automatically.

Example Dependency

ExternalProject_Add(
    Library1
    GIT_REPOSITORY https://[email protected]/repo/library_1.git
    GIT_TAG tag_S.33.91
    HTTP_USERNAME ciserv
    HTTP_PASSWORD Obfusc@t3M3
    CMAKE_ARGS
        -DBUILD_EXAMPLES:BOOL=OFF
        -DBUILD_TESTS:BOOL=OFF
        -DBUILD_DOCS:BOOL=OFF
)
target_link_libraries(MyTarget PRIVATE Library1)

There are several other commands within the ExternalProject module that can be used to further customize the dependency if required.

like image 90
Norman B. Lancaster Avatar answered Oct 15 '22 03:10

Norman B. Lancaster