0

I'm trying to use Conan to package some files and executables together for version control, however after looking at the Conan documentation it's still unclear to me how to do this, or if Conan is even the right tool for the job.

Basically I want to package 3 .dll files, a configuration file, and 2 executables (OpenSSL and the .exe I wrote that requires all of the aforementioned dependencies). Everything I want to package lives locally on the desktop. If anyone out there experienced in Conan can point me in the right direction it would be much appreciated. Thanks!!

Stefan
  • 211
  • 3
  • 14

2 Answers2

1

You typically don't want to check binaries, libraries and executables in version control, but host them elsewhere, like a file server. If you are using conan, you might use the existing conan.io free service for public packages, the OSS conan_server for on-premises hosting of your private packages or Artifactory.

If your artifacts lives just on your desktop, on a known folder, all you have to do is implement something like the following build() method in the package recipe:

def build(self):
     shutil.copytree("C:/Path/to/folder/with/files", ".")

def package(self):
     # make sure files are now copied into the package
     self.copy("*.lib", dst="lib", src="files")
     self.copy("*.dll", dst="bin", src="files")
     self.copy("*.conf", dst="", src="files")

If you are providing a package just for one given configuration, I would add a check in configure() to clearly output potential consumers incompatibilities of this package:

class MyRecipe(ConanFile):
     settings = "os", "compiler", "arch", "build_type"

     def configure(self):
        if self.settings.os != "Windows" or self.settings.arch != "x86_64" or \
           self.settings.build_type != "Release" or ... :
            raise Exception("This package does not support this configuration")
drodri
  • 5,157
  • 15
  • 21
0

Quick overview of the conan way of packaging follows:

  1. Creating conan recipe. (i.e. Conanfile.py) (conan new)
  2. Customizing as per the source-build needs.
  3. Executing the conan recipe, to get the package (as o/p). (conan create)

Reference example here.

Some basics:

  • Conan typically builds in "cache-path", typically found at ~/.conan/data path.

  • Try enabling these debug options - shall give you insights to the whole process + debugging your case.

     # conan config list               (preview the configs)
    
     # conan config set log.level=10
     # conan config set log.print_run_commands=True
    
  • Note that the conanfile is a python script (be mindful of indents and spaces).

  • For more insights, here.

parasrish
  • 3,864
  • 26
  • 32