conan-package-tools
conan-package-tools copied to clipboard
Auto-generate matrix of build configurations with custom compiler
I am cross-building on windows for an embedded device and I want to auto-generate the combinations for my build using my own custom compiler, but I can't figure out how to do this. Despite installing my own config (which has the compiler added to settings.yml) and passing in my own CONAN_BASE_PROFILE
, cpt is still generating for Visual Studio.
Is this even possible?
My build.py looks like this:
from cpt.packager import ConanMultiPackager
os.environ["CONAN_CONFIG_URL"] = "https://my_scm/my_conan_config.git"
os.environ["CONAN_BASE_PROFILE"] = "my_compiler"
os.environ["CONAN_ARCHS"] = "x86_64"
os.environ["CONAN_BUILD_TYPES"] = "Debug, Release"
os.environ["CPT_SUMMARY_FILE"] = "cpt_summary_file.json"
if __name__ == "__main__":
builder = ConanMultiPackager(my_compiler_versions=["1.0"]) # I want to limit builds to a specific compiler version
builder.add_common_builds()
builder.run()
No, CPT uses Visual Studio by default on Windows or gcc.
I recommend you using lockfiles instead: https://docs.conan.io/en/latest/howtos/generic_ci_artifactory.html#generating-build-info-from-lockfiles-information
Hi @uilianries,
Thanks, I understand that it is not possible, but maybe there was still a misunderstanding of what I'm actually looking for (as I don't see how lockfiles are related).
I want to calculate different build configurations based on env vars (CONAN_BUILD_TYPES
, CONAN_ARCHS
, etc.) and have them automatically built for me:
>> Running builds...
+-----+--------------------+--------------+------------------------+
| # | build_type | compiler.version | compiler | arch |
|-----+--------------------+--------------+------------------------+
| 1 | Release | 1.0.0 | my_compiler | x86_64 |
| 2 | Debug | 1.0.0 | my_compiler | x86_64 |
+-----+--------------------+--------------+------------------------+
lockfiles are just what you said, calculate the different builds, so you will have a file which can be re-used by you, your coworker or even the CI, and reproduce the exactly same build.
You can obtain more information here: https://docs.conan.io/en/latest/versioning/lockfiles.html
but basically you can "freeze" your configuration (profiles and custom settings or options) and generate a file, you can pass it to conan create
command (under CI) and generate your packages. It can sound more manual job, but at least you will have a reproducible build.
It's not the reproducability of builds I'm asking about though. It's about simplifying bulk creation of packages with all the combinations of settings and options I need.
Anyway, I think I might be able to achieve this without conan package tools, using jenkins matrices.