Skip to content

AndreLouisCaron/cxxpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

`cxxpy`: Simple API for consuming Python from C++

authors

André Caron

contact

andre.l.caron@gmail.com

Description

This library provides a simple API for consuming Python code bases from C++. The intent of this library is to be a small, lightweight wrapper on the Python C API, easing the embedding of Python into C++ applications.

Differences with Boost.Python

If Boost is so great, why not use Boost.Python? Well, Boost is a huge library which is not installed by default on many systems (most notably Microsoft Windows) and it takes a short eternity to compile programs that use it. Moreover, Boost.Python is mostly designed for exporting C++ classes to use them from Python with embedding added on as an afterthought.

This library is by no means intended as a replacement, or even a substitute of Boost.Python. If you want to write Python bindings for your C++ classes, please use Boost.Python (or SWIG). If you just want a quick way to consume Python software libraries from C++ without heavy dependencies, then use this library.

Requirements

  1. CPython. Only works with the reference implementation, not Jython, IronPython or other variants which don't have an interface for C. Make sure to install a version that is compatible with your C++ compiler toolchain. If you don't have a 64-bit compiler, you can't use 64-bit Python.
  2. A C++ compiler toolchain:
    • Microsoft Visual Studio (for Microsoft Windows). The code base has not been tested on versions prior to 2008. Should work on both the Express and Professional versions.
    • GCC (for UNIX-like systems)
  3. CMake
  4. Git (unless you download the sources as an archive)
  5. Doxygen (to build the API documentation)

Compiling

  1. Open up a terminal (command prompt).
  2. Get the source code.

    git clone git://github.com/AndreLouisCaron:cxxpy.git
    cd cxxpy
  3. Have CMake generate build scripts.

    mkdir work
    cd work
    cmake -G "NMake Makefiles" ..
  4. Build using your favorite toolchain.

    nmake
  5. Enjoy!

About

Simple API for consuming Python from C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published