Skip to main content

Build and distribute C/C++ static libraries

Project description

PyPIl PyPIv Anaconda-Server Badge

Build and distribute C/C++ static libraries via Python packages.

Getting Started

You can have a setup.py similar to

from os.path import join
from setuptools import setup

def get_lib():
  from build_capi import CApiLib

  mylib = CApiLib('pkg_name.lib.nmylib',
                  sources=[join('pkg_name', 'sources', 'example.c')],
                  include_dirs=[join('pkg_name', 'include')])

setup(
      name='pkg_name',
      # ...
      setup_requires=['build_capi'],
      capi_libs=[get_lib],
      include_package_data=True,
      data_files=[(join('pkg_name', 'include'), join('pkg_name', 'include',
                                                     'example.h'))],
      package_data={'': [join('pkg_name', 'lib', '*.*')]})

and then have a pkg_name/__init__.py

def get_include():
  import pkg_name
  from os.path import join, dirname
  return join(dirname(pkg_name.__file__), 'include')

def get_lib():
  import pkg_name
  from os.path import join, dirname
  return join(dirname(pkg_name.__file__), 'lib')

Please, refer to build_capi/example/prj_name for a minimal example of project using build_capi.

Install

The recommended way of installing it is via conda

conda install -c conda-forge build-capi

An alternative way would be via pip

pip install build-capi

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

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

Files for build-capi, version 1.1.10
Filename, size File type Python version Upload date Hashes
Filename, size build-capi-1.1.10.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page