summaryrefslogtreecommitdiff
path: root/src/python/setup.py.in
blob: 1d6745fdaf4c632bd164833eccd196382775a766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"""This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
    See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
    Author(s):       Vincent Rouvreau

   Copyright (C) 2019  Inria

   Modification(s):
     - YYYY/MM Author: Description of the modification
"""

from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
from numpy import get_include as numpy_get_include
import sys
import pybind11

__author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016  Inria"
__license__ = "MIT"

cython_modules = [@GUDHI_CYTHON_MODULES@]
pybind11_modules = [@GUDHI_PYBIND11_MODULES@]

source_dir='@CMAKE_CURRENT_SOURCE_DIR@/gudhi/'
extra_compile_args=[@GUDHI_PYTHON_EXTRA_COMPILE_ARGS@]
extra_link_args=[@GUDHI_PYTHON_EXTRA_LINK_ARGS@]
libraries=[@GUDHI_PYTHON_LIBRARIES@]
library_dirs=[@GUDHI_PYTHON_LIBRARY_DIRS@]
include_dirs = [numpy_get_include(), '@CMAKE_CURRENT_SOURCE_DIR@/gudhi/', @GUDHI_PYTHON_INCLUDE_DIRS@]
runtime_library_dirs=[@GUDHI_PYTHON_RUNTIME_LIBRARY_DIRS@]

# Create ext_modules list from module list
ext_modules = []
for module in cython_modules:
    ext_modules.append(Extension(
        'gudhi.' + module,
        sources = [source_dir + module + '.pyx',],
        language = 'c++',
        extra_compile_args=extra_compile_args,
        extra_link_args=extra_link_args,
        libraries=libraries,
        library_dirs=library_dirs,
        include_dirs=include_dirs,
        runtime_library_dirs=runtime_library_dirs,
        cython_directives = {'language_level': str(sys.version_info[0])},))

ext_modules = cythonize(ext_modules)

for module in pybind11_modules:
    my_include_dirs = include_dirs + [pybind11.get_include(False), pybind11.get_include(True)]
    if module == 'hera/wasserstein':
        my_include_dirs = ['@HERA_WASSERSTEIN_INCLUDE_DIR@'] + my_include_dirs
    elif module == 'hera/bottleneck':
        my_include_dirs = ['@HERA_BOTTLENECK_INCLUDE_DIR@'] + my_include_dirs
    ext_modules.append(Extension(
        'gudhi.' + module.replace('/', '.'),
        sources = [source_dir + module + '.cc'],
        language = 'c++',
        include_dirs = my_include_dirs,
        extra_compile_args=extra_compile_args + [@GUDHI_PYBIND11_EXTRA_COMPILE_ARGS@],
        extra_link_args=extra_link_args,
        libraries=libraries,
        library_dirs=library_dirs,
        runtime_library_dirs=runtime_library_dirs,
        ))

# read the contents of introduction.rst
with open("@CMAKE_CURRENT_BINARY_DIR@/introduction.rst", "r") as fh:
    long_description = fh.read()

setup(
    name = 'gudhi',
    packages=find_packages(), # find_namespace_packages(include=["gudhi*"])
    author='GUDHI Editorial Board',
    author_email='gudhi-contact@lists.gforge.inria.fr',
    version='@GUDHI_VERSION@',
    url='https://gudhi.inria.fr/',
    project_urls={
        'Bug Tracker': 'https://github.com/GUDHI/gudhi-devel/issues',
        'Documentation': 'https://gudhi.inria.fr/python/latest/',
        'Source Code': 'https://github.com/GUDHI/gudhi-devel',
        'License': 'https://gudhi.inria.fr/licensing/'
        },
    description='The Gudhi library is an open source library for ' \
        'Computational Topology and Topological Data Analysis (TDA).',
    long_description_content_type='text/x-rst',
    long_description=long_description,
    ext_modules = ext_modules,
    install_requires = ['numpy >= 1.9',],
    setup_requires = ['cython','numpy >= 1.9','pybind11',],
    package_data={"": ["*.dll"], },
)