Skip to main content

Generic Conan recipes for CMake and Python projects.

Project description

Generic Conan recipes for C/C++ and Python projects.

Latest Bintray version Build status: Linux and OSX Build status: Windows

C/C++

If your project

  • uses CMake,

  • and installs a package configuration file

  • that defines the variable <PACKAGE_NAME>_COMPONENTS

  • with a list of components,

  • and for each of them defines a target <package_name>::<component>,

then you should be able to copy this recipe to package it for Conan:

from conans import python_requires

CMakeConanFile = python_requires('autorecipes/[*]@jfreeman/testing').cmake()

class Recipe(CMakeConanFile):
    name = CMakeConanFile.__dict__['name']
    version = CMakeConanFile.__dict__['version']

Python

If your project

  • uses Poetry,

  • with a pyproject.toml package metadata file as defined in PEP 518,

then you should be able to copy this recipe to package it for Conan:

from conans import python_requires

PythonConanFile = python_requires('autorecipes/[*]@jfreeman/testing').python()

class Recipe(PythonConanFile):
    name = PythonConanFile.__dict__['name']
    version = PythonConanFile.__dict__['version']

FAQ

  • Why do I need to copy the name and version attributes from the base class?

    Conan parses the recipe looking for the name and version attributes, instead of just executing it. Thus, we must copy the attributes to move past that check.

    Further, these attributes are descriptors. Accessing them with dot notation, like CMakeConanFile.name, evaluates them against the class CMakeConanFile instead of your recipe, but they need the most derived type to work correctly.

  • Can I override some attributes?

    Yes. These base classes just provide default values.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autorecipes-0.2.0.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

autorecipes-0.2.0-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page