|
1 | 1 | # coding: UTF-8 |
2 | | -from distutils.core import setup |
3 | | -from Cython.Build import cythonize |
| 2 | +from setuptools import setup |
4 | 3 |
|
5 | 4 | # TODO: |
6 | 5 | # - Wrap learning. |
7 | 6 | # - Make LabelCompatibility, UnaryEnergy, PairwisePotential extensible? (Maybe overkill?) |
8 | 7 |
|
| 8 | + |
| 9 | +# If Cython is available, build using Cython. |
| 10 | +# Otherwise, use the pre-built (by someone who has Cython, i.e. me) wrapper `.cpp` files. |
| 11 | +try: |
| 12 | + from Cython.Build import cythonize |
| 13 | + ext_modules = cythonize(['pydensecrf/eigen.pyx', 'pydensecrf/densecrf.pyx']) |
| 14 | +except ImportError: |
| 15 | + from setuptools.extension import Extension |
| 16 | + ext_modules = [ |
| 17 | + Extension("pydensecrf/eigen", ["pydensecrf/eigen.cpp", "pydensecrf/eigen_impl.cpp"], language="c++", include_dirs=["pydensecrf/densecrf/include"]), |
| 18 | + Extension("pydensecrf/densecrf", ["pydensecrf/densecrf.cpp", "pydensecrf/densecrf/src/densecrf.cpp", "pydensecrf/densecrf/src/unary.cpp", "pydensecrf/densecrf/src/pairwise.cpp", "pydensecrf/densecrf/src/permutohedral.cpp", "pydensecrf/densecrf/src/optimization.cpp", "pydensecrf/densecrf/src/objective.cpp", "pydensecrf/densecrf/src/labelcompatibility.cpp", "pydensecrf/densecrf/src/util.cpp", "pydensecrf/densecrf/external/liblbfgs/lib/lbfgs.c"], language="c++", include_dirs=["pydensecrf/densecrf/include", "pydensecrf/densecrf/external/liblbfgs/include"]), |
| 19 | + ] |
| 20 | + |
9 | 21 | setup( |
10 | 22 | name="pydensecrf", |
11 | | - version="0.1", |
12 | | - description="A python interface to Philipp Krähenbühl's fully-connected CRF code.", |
| 23 | + version="1.0rc2", |
| 24 | + description="A python interface to Philipp Krähenbühl's fully-connected (dense) CRF code.", |
| 25 | + long_description="See the README.md at http://github.com/lucasb-eyer/pydensecrf", |
13 | 26 | author="Lucas Beyer", |
14 | 27 | |
15 | 28 | url="http://github.com/lucasb-eyer/pydensecrf", |
16 | | - ext_modules=cythonize(['pydensecrf/eigen.pyx', 'pydensecrf/densecrf.pyx']), |
17 | | - packages=["pydensecrf"] |
| 29 | + ext_modules=ext_modules, |
| 30 | + packages=["pydensecrf"], |
| 31 | + setup_requires=['cython>=0.22'], |
| 32 | + classifiers=[ |
| 33 | + "Intended Audience :: Developers", |
| 34 | + "License :: OSI Approved :: MIT License", |
| 35 | + "Development Status :: 5 - Production/Stable", |
| 36 | + "Programming Language :: C++", |
| 37 | + "Programming Language :: Python", |
| 38 | + "Operating System :: POSIX :: Linux", |
| 39 | + "Topic :: Software Development :: Libraries", |
| 40 | + "Topic :: Scientific/Engineering :: Image Recognition", |
| 41 | + "Topic :: Scientific/Engineering :: Artificial Intelligence", |
| 42 | + ], |
18 | 43 | ) |
19 | | - |
|
0 commit comments