Skip to main content

Helps projects building Python/C++ extensions for Bob

Project description

This package provides a pkg-config bridge for Python/C++ extensions for Bob. You use this package by including it in the setup_requires field of your setup.py file.

Building with zc.buildout is possible using the develop recipe in xbob.buildout. Follow the instructions described on that package for this recipe.

Preparing for C++ Compilation

Creating C++/Python bindings should be trivial. Firstly, edit your setup.py so that you include the following:

from xbob.extension import Extension
...

setup(

  name="xbob.myext",
  version="1.0.0",
  ...

  setup_requires=[
      'xbob.extension',
      ],

  ...
  ext_modules=[
    Extension("xbob.myext._myext",
      [
        "xbob/myext/ext/file1.cpp",
        "xbob/myext/ext/file2.cpp",
        "xbob/myext/ext/main.cpp",
      ],
      pkgconfig = [ #bob modules you depend on
        'bob-math',
        'bob-sp',
        ],
      include_dirs = [ #optionally, include directories
        "xbob/myext/ext/headers/",
        ],
      ),
    ... #add more extensions if you wish
  ],

  ...
  )

These modifications will allow you to compile extensions that are linked against the named pkg-config modules. You can specify the modules of Bob you want to link against. You don’t have to specify bob-python, which is automatically added. Furthermore, you can specify any pkg-config module and that will be linked in (for example, opencv). Other modules and options can be set manually using the standard options for python extensions. To hook-in the building on the package through zc.buildout, add the following section to your buildout.cfg:

[xbob.myext]
recipe = xbob.buildout:develop

If you need to build multiple eggs, you will need one entry per project on your buildout.cfg. This includes, possibly, dependent projects. Currently, zc.buildout ignores the setup_requires entry on your setup.py file. The recipe above creates a new interpreter that hooks that package in and builds the project considering variables like prefixes into consideration.

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

xbob.extension-0.2.0.zip (9.6 kB view details)

Uploaded Source

File details

Details for the file xbob.extension-0.2.0.zip.

File metadata

  • Download URL: xbob.extension-0.2.0.zip
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xbob.extension-0.2.0.zip
Algorithm Hash digest
SHA256 5b4b959e4e80a26a9a20b3bd1b1d59f32f4b25a103bef4cb05b99cda752cbbce
MD5 408e1ee4e6d730d07ee46c0c40e08ff6
BLAKE2b-256 37b27375a854db4e651796bdd8d3e627c0c27a87fea40a45dbcca47bc3bf3df4

See more details on using hashes here.

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