Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup: use scikit-build to building of histogram and ctrans extensions
This commit introduces a new dependencies to "scikit-built" and CMake. scikit-build is a drop-in replacement to setuptools.setup function allowing to easily compile and package extensions (C/C++/Cython) by bridging CMake and setuptools. See http://scikit-build.org CMake is is an open-source, cross-platform family of tools designed to build, test and package software. See https://cmake.org Currently, scikit-build and CMake have to be explicitly installed on the system. Since CMake wheels (allowing to pip install CMake) will be published shortly, initial will be simplified. How does it work ? In addition to simplifying setup.py, three new files have been added: <root> | |---- CMakeLists.txt (1) . . . |--- src | |--- CMakeLists.txt (2) . . |--- skbeam | |---core . | |---accumulators . . . |--------- CMakeLists.txt (3) The first CMakeLists.txt specifies requirements for * Python interpreter, * the associated python libraries * and a "PythonExtension" modules containing convenience CMake functions allowing to easily build extension by encapsulating system introspection and platform specific logic. and include the subdirectory associated with the two other CMakeLists.txt. The second CMakeLists.txt is specific to "ctrans" extension and it specifies: * requirement for NumPy * optional dependency on OpenMP. If it is not found on a given platform, nothing is changed, the macro _OPENMP will NOT be defined and a regular implementation will be compiled in. Then, it declares: * a library, associate pytho extension specific properties * and finally add an install rule specifying where in the package hierarchy the extension should be installed. Finally, the third CMakeLists.txt is specific to the "histogram" extension and it specifies: * requirements for NumPy Then, it adds "cythonizing" target for the pyx file using the CMake function "add_cython_target", and proceed to the declaration of the extension like it was done in the previous case. Et voila,
- Loading branch information