Search code examples
c++conan

how install github repo on C++ project with Conan


In context of first app C++ project, I would like to work with existing C++ library which bring me a concrete challenge for working.

Conan seems to be the more full-features-widely-used package manager for C++.

And I would like to get this package : https://github.com/jcelerier/libremidi

1/ I installed conan with : pip install conan (conan --version = 2.0.17)

2/ created my conan profile like this : conan profile detect

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=193
os=Windows

3/ I created conanfile.txt file in parent of project directory :

[requires]
libremidi/4.2.4@https://github.com/jcelerier/libremidi.git

[generators]
cmake

4/ Added new remote repo in conan like this : conan remote add libre_midi_repo https://github.com/jcelerier/libremidi.git

5/ I try to install the repo like this :

  • conan install .. --remote=libre_midi_repo or
  • conan install ..

Those 2 commands return me this error :

ERROR: Package 'libremidi/4.2.4@https://github.com/jcelerier/libremidi.git' not resolved: Unable to find 'libremidi/4.2.4@https://github.com/jcelerier/libremidi.git' in remotes.


It seems that conan has a particular concepts that more complex to understand than (Composer for PHP or Npm for Node for exemple).

Can you tell me to understand their subtlilities of Conan to get and work with external package that not in the official conan repo ?


Solution

  • Conan for C and C++ is more similar to Maven for Java package manager than to other languages package managers like npm or pip, and for downloading packages it requires having a server for the packages. In the same way PyPI for pip and MavenCentral for Java, there is also ConanCenter for Conan packages, and the way to contribute recipes for open-source packages is to do PRs to the conan-center-index Github repo

    There is some ongoing work in this PR that tries to allow to use folders with recipes, but still a draft and uncertain to be merged, and in any case discovery would be challenging, if the goal is to make it easy to use by the larger community, then contributing to ConanCenter would be the way.

    If the goal is to use that package internally for a team, there are several options, the recommended one is the free ArtifactoryCE that can be downloaded from the Conan downloads page.