Skip to content
🐍 A tool for generating Boost.Python/Pybind11 bindings from C/C++
C++ CMake Python C Shell Dockerfile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci Reflect upstream update of cling_utils_AST (#261) May 19, 2019
bindings Exclude unnamed namespace and class from scope (#259) Feb 19, 2019
cmake Reflect upstream update of cling_utils_AST (#261) May 19, 2019
external Reflect upstream update of cling_utils_AST (#261) May 19, 2019
include/chimera Reflect upstream update of cling_utils_AST (#261) May 19, 2019
src Reflect upstream update of cling_utils_AST (#261) May 19, 2019
test Reflect upstream update of cling_utils_AST (#261) May 19, 2019
tools
.azure-pipelines.yml Reflect upstream update of cling_utils_AST (#261) May 19, 2019
.clang-format Code formatting using ClangFormat 6.0 (#230) Jan 20, 2019
.codecov.yml Add Codecov support (#152) May 24, 2017
.dockerignore Adds Dockerfile for building chimera tool into container. (#181) May 27, 2018
.gitignore
.travis.yml Reflect upstream update of cling_utils_AST (#261) May 19, 2019
Brewfile
CMakeLists.txt Set LLVM_DIR to find LLVM on macOS if necessary (#244) Jan 27, 2019
Dockerfile Adds Dockerfile for building chimera tool into container. (#181) May 27, 2018
LICENSE Update LICENSE Jan 20, 2019
README.md Update README.md Feb 12, 2019
package.xml Fixed merge build issues. Feb 16, 2016

README.md

chimera Build Status Build Status codecov

chi·me·ra
/kīˈmirə,kəˈmirə/ speaker

informal, noun

  1. a thing that is hoped or wished for but in fact is illusory or impossible to achieve.
  2. a utility to generate Boost.Python bindings for C++ code.

Chimera is a tool for generating Boost.Python/Pybind11 bindings from C/C++ header files. It uses the Clang/LLVM toolchain, making it capable of automatically handling fairly complex source files.

Usage

$ ./chimera -c <yaml_config_file> -o <output_path> my_cpp_header1.h my_cpp_header2.h -- [compiler args]

Installation

On Ubuntu using apt

Chimera provides Ubuntu packages for Trusty (14.04), Xenial (16.04), Bionic (18.04), Cosmic (18.10), and Disco (19.04).

Trusty

$ sudo add-apt-repository ppa:personalrobotics/ppa
$ sudo add-apt-repository ppa:renemilk/llvm
$ sudo apt update
$ sudo apt install chimera

Xenial/Bionic/Cosmic/Disco

$ sudo add-apt-repository ppa:personalrobotics/ppa
$ sudo apt update
$ sudo apt install chimera

On macOS using Homebrew

# Install the Homebrew package manager
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Add Homebrew tap for Personal Robotics Lab software
$ brew tap personalrobotics/tap
# Install Chimera
$ brew install chimera

Build from Source

Requirements

  • libclang 3.6, 3,9 or 6.0
  • llvm 3.6, 3,9 or 6.0 (+ tools)
  • libedit
  • yaml-cpp
  • boost

On Ubuntu from Source

Trusty

$ sudo apt-add-repository ppa:george-edison55/cmake-3.x
$ sudo apt-get update
$ sudo apt-get install cmake
$ sudo apt-get install llvm-3.7-dev llvm-3.7-tools libclang-3.7-dev libedit-dev libyaml-cpp-dev libboost-dev lib32z1-dev
$ git clone https://github.com/personalrobotics/chimera.git
$ cd chimera
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
$ sudo make install

Xenial/Bionic

$ sudo apt-get install llvm-4.0-dev llvm-4.0-tools libclang-4.0-dev libedit-dev libyaml-cpp-dev libboost-dev lib32z1-dev
$ git clone https://github.com/personalrobotics/chimera.git
$ cd chimera
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
$ sudo make install

On macOS from Source

$ brew install boost llvm
$ brew install yaml-cpp --with-static-lib
$ git clone https://github.com/personalrobotics/chimera.git
$ cd chimera
$ mkdir build && cd build
$ PKG_CONFIG_PATH=$(brew --prefix yaml-cpp)/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm ..
$ make
$ sudo make install

Example

Let's try running chimera on itself!

$ cd [PATH TO CHIMERA]
$ rm -rf build && mkdir -p build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
$ make
$ chimera -p . -o chimera_py_binding.cpp ../src/chimera.cpp

Configuration

# The C++ namespaces that will be extracted by Chimera
namespaces:
  - dart::dynamics
  - dart::math

# Selected types that should have special handling.
# (Not implemented yet.)
types:
  'class BodyNode':
    convert_to: 'class BodyNodePtr'

# Selected function and class declarations that need custom parameters.
functions:
  'const Eigen::Vector4d & ::dart::dynamics::Shape::getRGBA() const':
    return_value_policy: copy_const_reference
  'bool ::dart::dynamics::Skeleton::isImpulseApplied() const':
    source: 'test.cpp.in'
  'const Eigen::Vector3d & ::dart::dynamics::Shape::getBoundingBoxDim() const':
    content: '/* Instead of implementing this function, insert this comment! */'
  'Eigen::VectorXd & ::dart::optimizer::GradientDescentSolver::getEqConstraintWeights()': null
    # This declaration will be suppressed.

classes:
  '::dart::dynamics::Shape':
    name: Shape
    bases: []
    noncopyable: true

Troubleshooting

Is there a length limit for the keys in the configuration file of Chimera?

Yes. yaml-cpp does not support more than 1024 characters for a single line key. If you want to use a longer key, then you should use multi-line key.

License

Chimera is released under the 3-clause BSD license. See LICENSE for more information.

Authors

Chimera is developed by Michael Koval (@mkoval) and Pras Velagapudi (@psigen).

You can’t perform that action at this time.