Conan can automate the package creation with any compiler that you have installed. In Windows, it is very common to have two or more Visual Studio versions, tools like CMake will just use the Visual Studio specified by the user.
In Linux having several versions of gcc installed could be tricky, of course it’s possible, but it’s not as easy as Visual Studio versions in Windows. In addition to this, our development machine usually has a lot of installed libraries that other developers may not have and may hide our real requirements.
So Docker will help us to create clean build environments with different compilers.
If you read the Automatically creating and testing packages you saw that you can test your conan package with the conan test command and a simple script like this:
I thought that it would be great if I could execute the builds above for each gcc version that I want.
I prepared some Dockerfiles for the different gcc version. I used official Ubuntu distributions.
Then I uploaded the images to my Dockerhub account.
Remember from the Automatically creating and testing packages docs that your conan’s package layout could be:
This script will run a docker container for each gcc version and run the build.py script inside the container
In each container conan will detect the right compiler and compiler version. Your host computer conan local storage directory ~/.conan/data is shared, so the containers will write the result in the same place.
When it finishes I can upload the generated packages to conan.io and make them available to the community:
This docker integration can also handle other compilers (such as clang) and other versions easily.
Currently this script is managed by a new tool, conan package tools that provides CI (travis & appveyor) easy integration for remote and automated package generation (even with docker in travis ci), pagination, Visual Studio environment configuration and other features.
This tool could be very useful to library authors that wants to distribute the library binaries automatically. Authors can “push to master” to trigger the CI system and the upload the packages to “stable” channel automatically.
I will write new posts about this new tool ASAP.