Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
It depends on what you are distributing. There are two types of distributions: Binary (application is already compiled) Source (users download raw source code and compile themselves) Becaus...
Answer
#2: Post edited
- It depends on _what_ you are distributing.
- There are two types of distributions:
- - Binary (application is already compiled)
- - Source (users download raw source code and compile themselves)
Because you are using a header only library, anyone downloading a __binary distribution__ does not need to download the header file(s) because the code they contain is statically compile into your executable! If you did not using a header-only library and instead linked against a shared library, then your problem would be more complex...As for the __source distribution__, yes, you will need to provide a method for developers to install the header file. Some languages (such as Go, Rust, Python, etc.) have package managers built into the core language utilies. Sadly, C/C++ does not. Instead, you must rely upon a smattering of unofficial C/C++ package management tools that the C/C++ community has widely adopted.- Popular solutions to managing C/C++ dependencies:
- 1. [Conan](https://docs.conan.io/2/)
- 2. [vcpkg](https://github.com/microsoft/vcpkg)
- 3. [CMake's FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) module
- 4. [pkg-config](https://en.wikipedia.org/wiki/Pkg-config)
- 5. Git Submodules; I personally recommend you avoid them.
- 6. Vendor your dependency (ie. copy + paste it into your app's repo)
- This is by no means an exhaustive list, however this [blog post](https://moderncppdevops.com/pkg-mngr-roundup/) seems to have some good information too.
- If you already have a build system, such as CMake, Meson, Spack, etc., then I suggest that you go with whatever is conventional for that build system. If you don't have a build system, then I recommend you use one! I personally use CMake.
In the end, I think option #6 is the best option. The [stb-libraries are MIT licensed](https://github.com/nothings/stb/blob/49cbedfab6623f38a8fa65b32d10ab4b2fefd872/LICENSE), so as long as you abide by the terms of the license, you can redistribute the header files in your own source code. By including the header file in your app's repo, you avoid all the extra work of setting up a dependency management solution.
- It depends on _what_ you are distributing.
- There are two types of distributions:
- - Binary (application is already compiled)
- - Source (users download raw source code and compile themselves)
- Because you are using a header only library, anyone downloading a __binary distribution__ does not need to download the header file(s) because the code they contain is statically compiled into your executable! If you did not using a header-only library and instead linked against a shared library, then your problem would be more complex...
- As for the __source distribution__, yes, you will need to provide a method for developers to install the header file. Some languages (such as Go, Rust, Python, etc.) have package managers built into the core language utilities. Sadly, C/C++ does not. Instead, you must rely upon a smattering of unofficial C/C++ package management tools that the C/C++ community has widely adopted.
- Popular solutions to managing C/C++ dependencies:
- 1. [Conan](https://docs.conan.io/2/)
- 2. [vcpkg](https://github.com/microsoft/vcpkg)
- 3. [CMake's FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) module
- 4. [pkg-config](https://en.wikipedia.org/wiki/Pkg-config)
- 5. Git Submodules; I personally recommend you avoid them.
- 6. Vendor your dependency (ie. copy + paste it into your app's repo)
- This is by no means an exhaustive list, however this [blog post](https://moderncppdevops.com/pkg-mngr-roundup/) seems to have some good information too.
- If you already have a build system, such as CMake, Meson, Spack, etc., then I suggest that you go with whatever is conventional for that build system. If you don't have a build system, then I recommend you use one! I personally use CMake.
- In the end, I think option #6 (vendoring the header file) is the best option. The [stb-libraries are MIT licensed](https://github.com/nothings/stb/blob/49cbedfab6623f38a8fa65b32d10ab4b2fefd872/LICENSE), so as long as you abide by the terms of the license, you can redistribute the header files in your own source code. By including the header file in your app's repo, you avoid all the extra work of setting up a dependency management solution.
#1: Initial revision
It depends on _what_ you are distributing. There are two types of distributions: - Binary (application is already compiled) - Source (users download raw source code and compile themselves) Because you are using a header only library, anyone downloading a __binary distribution__ does not need to download the header file(s) because the code they contain is statically compile into your executable! If you did not using a header-only library and instead linked against a shared library, then your problem would be more complex... As for the __source distribution__, yes, you will need to provide a method for developers to install the header file. Some languages (such as Go, Rust, Python, etc.) have package managers built into the core language utilies. Sadly, C/C++ does not. Instead, you must rely upon a smattering of unofficial C/C++ package management tools that the C/C++ community has widely adopted. Popular solutions to managing C/C++ dependencies: 1. [Conan](https://docs.conan.io/2/) 2. [vcpkg](https://github.com/microsoft/vcpkg) 3. [CMake's FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) module 4. [pkg-config](https://en.wikipedia.org/wiki/Pkg-config) 5. Git Submodules; I personally recommend you avoid them. 6. Vendor your dependency (ie. copy + paste it into your app's repo) This is by no means an exhaustive list, however this [blog post](https://moderncppdevops.com/pkg-mngr-roundup/) seems to have some good information too. If you already have a build system, such as CMake, Meson, Spack, etc., then I suggest that you go with whatever is conventional for that build system. If you don't have a build system, then I recommend you use one! I personally use CMake. In the end, I think option #6 is the best option. The [stb-libraries are MIT licensed](https://github.com/nothings/stb/blob/49cbedfab6623f38a8fa65b32d10ab4b2fefd872/LICENSE), so as long as you abide by the terms of the license, you can redistribute the header files in your own source code. By including the header file in your app's repo, you avoid all the extra work of setting up a dependency management solution.