S
S
SerJook2019-03-04 20:39:52
C++ / C#
SerJook, 2019-03-04 20:39:52

How to automate the assembly of program dependencies?

I am developing a program in C++. To build the program, I use Visual Studio 2013 (2017) as well as CMake (I have not completely switched to CMake yet). Some modules of the program are cross-platform.
The program depends on a dozen or so libraries. Now I collect them manually every time. For me, this is a headache.
Moreover, the libraries are assembled in different ways, some using CMake, others (like boost) using their build system, others use the Makefile, the fourth ones are generally supplied as bare sources. Some require generally msys2 for assembly.
I think how to simplify this process and automate. I want a person to be able to download my project, run the command, and the dependencies are assembled and copied to the correct folder. What do you advise? How is it solved in other projects?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly, 2019-03-04
@vt4a2h

Look towards any dependency manager like Conan or vcpkg. Conan definitely has CMake integration. Just keep in mind that you still have to write a lot of things by hand. Dependency management is a pain in the ass in C++. the language is very old. Usually all companies have their own bikes for this.
With the help of the CMake + Conan bundle, it's really possible to get what you want.
The next step is to create an installer for the already compiled program, which will install the program on the user's computer. It's actually even worse here :) But that's another question.

J
jcmvbkbc, 2019-03-04
@jcmvbkbc

How is it solved in other projects?

In other projects (commonly referred to as "OS distributions") libraries and header files are packaged and installed by a standard OS command from the repository. There is a good chance that some of your libraries are already packaged.
Other projects (sometimes called "distribution builders") may for the most part consist of recipes for building all sorts of libraries. See for example buildroot or yocto.

R
rPman, 2019-03-04
@rPman

Take the same make, we are all used to the fact that makefiles contain some kind of autogenerated epic code, which no one has fully understood for a long time, but in general this is a good system for automatic file version control and dependency-based assembly.
When you write

целевой_файл:используемые файлы
  командная строка для сборки целевого файла
you're actually describing a process where make checks the versions of the used files along the dependency chains automatically and runs the appropriate commands.
For each of your dependencies, you can write a bat file that goes to the desired directory and rebuilds it, then copies the result to your project directory. You can write a couple of lines in your makefile for each, specifying all the files of each project as used files, or better any one (for example, an index file from their git directory) and that's it, with any update you will run the build. Then you can add this makefile to your project (or call it manually) as far as I remember visual studio has a lot of options for this.
Yes, there are more complicated problems, when to build the next version you need to perform some actions described in a regular text file for a person, unfortunately you will not find a universal solution, .. this is the work that the maintainers of any application do - follow this economy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question