How it works

The extension to install mixed-language projects using Python CFFI and CMake compared to Chapter 9, Mixed-language Projects, Recipe 6, Mixing C, C++, Fortran, and Python using Python CFFI consists of two additional steps:

  1. We require the setup.py layer.
  2. We install targets such that the header files and the shared library file(s) required by the CFFI layer are installed in the correct paths depending on the selected Python environment.

The structure of setup.py is almost identical to the previous recipe, and we refer you to the previous recipe for a discussion of this file. The only addition was a line containing install_requires=['cffi'] to make sure that installing our example package also fetches and installs the required ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.