by quacker · 9y ago · 0 comments
I've been writing a simple video game in C++ recently, using CMake to build. I wrote a little bit of code that fetches the few libraries I need in order to have a complete/deterministic build process that works on linux/windows/mac. It lets me change versions (by specifying a new url to a source tarball). Versioned dependency management is so typical and convenient in many other languages and is such a pain in the butt with C++ because CMake is this thing that's sort of good enough. But my CMake experience doesn't compare well at all with maven, pip, gem, cargo, or even npm.
Too many C++ tools couple package management and build which increases their adoption cost and makes it more work to package third part packages. Conan takes the approach of managing dependencies and then giving your build system of choice the information it needs to access those dependencies via conan plugins. I think I had read that the author of Conan was involved in biicode and that the third party packaging problem is what inspired him to create Conan.
Some other cool things about conan
- Can be used for more than C++
- SCM independent
- Artifact caching
- Options allow clients to customize your package (creates distinct artifact)
- Scopes allow developers to modify your build (like conditional build steps so doesn't create a distinct artifact)
Some things I think can be improved
- Needs to separate out dependency lock file like Cargo or Poet
- Build tools need to be packaged in Conan for tracability / reproducibility
- Plugins are in Python which is heavy for deployment and has a large compatibility surface
- Easy to hit limits of declarative dependency files, being forced into implementing them in Python (see above)
- Project templates are hard coded.
Conan does this too. If I follow the instructions to integrate cmake with conan, I would write something like this:
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_executable(timer timer.cpp)
target_link_libraries(timer CONAN_PKG::Poco)
Which now couples my build with conan. If the user would like to pull down the dependencies without conan(ie using apt-get or manually installing them), the cmake build script will not work.Package managers like cget[1] or conda[2] does not couple the build with the package manager. Cget is also serverless which is nice as it can install dependencies from anywhere(even directly from github with `cget install jgm/cmark`), however, you need to setup your own server hosting if you want to install binaries.
http://docs.conan.io/en/latest/integrations/cmake/find_packa...
No need to force me to install Python just to run a build tool.
e: does anyone know if this has any relation to Boost's b2? I know that was originally based off of jam which is not related but the name is so similar I can't help but think I'm missing something :(
I like Ruby more than Python as a language, but I will say that I've never had pip fail to install a dependency on me.
I'm surprised there isn't any part of the gem process that calls `pkg-config`, to verify if a gem will be able to install, given its native dependencies. Having `bundle install` bail out after just a second with "please install libfoo first" would be great, especially for CI.
> I've never had pip fail to install a dependency on me
`pip install` has never failed me, but `pip install --upgrade` fails for me quite a bit. Especially when I try to use it like `gem upgrade`, with a stanza like
pip list --outdated --format=legacy | cut -d' ' -f1 | xargs pip install --upgradehttps://www.cvedetails.com/vulnerability-list/vendor_id-1749...