Jax Teller
Jax Teller

Reputation: 173

How do I package pre-built files into a conan package and then during install only get certain files?

I am making a conan package which has pre-built windows and linux files. How do I make sure that during conan install, depending on the platform on which the conan install command is called, only gets either the windows or the linux files from the package.

conan install doesn't call package() unless the flag --build is supplied. So do I just add the --build flag and then in the package() function copy relevant files depending on the platform? I am not really building anything, just "serving" a package that has pre-built files and I have no interest in building these via conan.

The lib directory basically has a windows and a linux subdirectory which in turn contain the platform specific files respectively:

I am going to try the option with the --build flag and see what results I can achieve, but I am wondering if there is a different solution, don't have much experience with conan, still experimenting.

Upvotes: 0

Views: 1009

Answers (1)

uilianries
uilianries

Reputation: 3887

I am making a conan package which has pre-built windows and linux files. How do I make sure that during conan install, depending on the platform on which the conan install command is called, only gets either the windows or the linux files from the package

By the package ID. Each package is formulated by its settings, options and dependencies. Thus, if you are doing it for Linux or Window, they will be different packages.

conan install doesn't call package() unless the flag --build is supplied.

The install --build is only used when you want to build from sources, otherwise, Conan will download the pre-built package for you, which is the regular flow.

So do I just add the --build flag and then in the package() function copy relevant files depending on the platform? I am not really building anything, just "serving" a package that has pre-built files and I have no interest in building these via conan.

There is a good section about packaging binaries on Docs, take a look there.

Also, Conan Center has official recipes which only distribute pre-built, like nodejs recipe.

Upvotes: 1

Related Questions