setup_getMaxRect.py 1.47 KB
Newer Older
Josef Brandt's avatar
Josef Brandt committed
1
#!/usr/bin/env python3
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
# -*- coding: utf-8 -*-
"""
GEPARD - Gepard-Enabled PARticle Detection
Copyright (C) 2018  Lars Bittrich and Josef Brandt, Leibniz-Institut für 
Polymerforschung Dresden e. V. <bittrich-lars@ipfdd.de>    

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program, see COPYING.  
If not, see <https://www.gnu.org/licenses/>.
"""

try:
    from setuptools import setup
    from setuptools import Extension
except ImportError:
    from distutils.core import setup
    from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
Josef Brandt's avatar
Josef Brandt committed
31 32 33 34 35
import sys, os

if os.path.exists('getMaxRect.c'):
    print('removing c file')
    os.remove('getMaxRect.c')
36 37 38 39 40

if len(sys.argv)==1:
    sys.argv.append("build_ext")
    sys.argv.append("--inplace")

Josef Brandt's avatar
Josef Brandt committed
41
ext = Extension("getMaxRect", ["getMaxRect.pyx"],
42 43 44
        extra_compile_args=['-O3'],)

setup(
Josef Brandt's avatar
Josef Brandt committed
45 46
    name="optimized find max rect-module",
    ext_modules=cythonize([ext]),
47
    include_dirs=[np.get_include()]
Josef Brandt's avatar
Josef Brandt committed
48
)