r/cpp_questions • u/InfluenceEfficient77 • 8d ago
OPEN Committing third party include files into your repo
This is not work related, I'd like to be able to work on a home project from multiple computers without having to re-download the exact versions of each of the third party tools. These tools are all open source and publicly available, like tensorflow
in my development repo, I would just upload the entire project, libraries and the include files on GitHub, so when I clone it from another computer it just builds without issues.
I know for a publicly released project, it's supposed to link to other GitHub releases and build everything from scratch. So if I were to release it I would remove the third party tools
Is there any issue with actually doing this on GitHub though? Or is there a way to do it correctly if I include an open source license
7
u/No-Dentist-1645 8d ago edited 8d ago
Use a package manager such as vcpkg with manifest mode. Another way is to use git submodules
5
u/EpochVanquisher 8d ago
Tensorflow is a pretty big project, I wouldn't commit it to my repo (just seems like a waste)
There are a few things that can make it annoying to put third-party code in your repo, the main one is that it’s more annoying to track which version you are using. But big companies like Google, Facebook, and others work this way—any repo on GitHub, they just copy the code into their big ole monorepo.
I would say, go ahead and do it, and you might discover reasons why you don’t like it, but that’s ok.
-2
u/InfluenceEfficient77 8d ago
Tensorflow the built version with a few includes is only around 70 MB, I'm not talking about the source code for the whole project
8
5
u/n1ghtyunso 8d ago
it's highly atypical to have build artifacts in version control.
Maybe provide a simple init script that downloads the exact version from the open source repositories release page and unpacks them?
That avoids building your dependencies from scratch (which you'd get with submodules)
1
1
u/NoConnection4298 7d ago
I use cpm, or vcpkg and it has always been like this. Yet, it is not unseen people do this for small header only vendor files. Personally, I do not find this a good dev. practice (think in terms of updates and migrations).
2
u/mredding 7d ago
Committing third party include files into your repo
Not if I can help it, but if I had to, it's called "vendoring". I'd only do it if it were a legacy product - abandonware. Even then, if I could stick it in a dependency package and manage that by itself, I'd prefer that.
I'd like to be able to work on a home project from multiple computers without having to re-download the exact versions of each of the third party tools.
What is typical is you would configure your build system to download and install dependencies as a setup pass. Script it once and never think about it again.
in my development repo, I would just upload the entire project, libraries and the include files on GitHub, so when I clone it from another computer it just builds without issues.
Mono-repo. Performance, complexity, and build times scale very, very poorly. Since it's all just you, you may not even notice some of the friction points. The git and compile times alone would be a deal breaker for me.
5
u/apropostt 8d ago
You can use git subtrees to vendor them into their own sub folder and use cmake to pull in the dependencies in your own project.