forked from Who8MyLunch/CharPyLS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
54 lines (41 loc) · 1.55 KB
/
setup.py
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
import numpy as np
import setuptools
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Distutils import build_ext
# Cython extension.
source_files = ['jpeg_ls/_CharLS.pyx',
'jpeg_ls/CharLS_src/interface.cpp',
'jpeg_ls/CharLS_src/jpegls.cpp',
'jpeg_ls/CharLS_src/header.cpp']
include_dirs = ['jpeg_ls/CharLS_src',
setuptools.distutils.sysconfig.get_python_inc(),
np.get_include()]
extra_link_args = []
flag_MSVC = False # Set this flag to True if using Visual Studio.
if flag_MSVC:
extra_compile_args = ['/EHsc']
else:
extra_compile_args = []
# These next two lines are left over from when I was playing with MinGW64 on my Windows PC.
# extra_compile_args = ['-m64'] #, '-nostdlib', '-lgcc']
# extra_link_args = ['-m64'] #, '-nostdlib', '-lgcc']
ext = Extension('_CharLS', source_files,
language='c++',
include_dirs=include_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
# Do it.
version = '1.0.1'
setup(name='CharPyLS',
packages=find_packages(),
package_data={'': ['*.txt', '*.cpp', '*.h', '*.pyx']},
cmdclass={'build_ext': build_ext},
ext_modules=[ext],
# Metadata
version=version,
license='MIT',
author='Pierre V. Villeneuve',
author_email='[email protected]',
description='JPEG-LS for Python via CharLS C++ Library',
url='https://github.com/Who8MyLunch/CharPyLS')