-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (65 loc) · 2.53 KB
/
setup.py
File metadata and controls
79 lines (65 loc) · 2.53 KB
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
from setuptools import setup, Extension
from pathlib import Path
import glob, os, sys
import numpy
from distutils.sysconfig import get_python_inc
def file_search( directory, extension = None ):
found_headers = []
if( extension == None ):
for path, subdirs, files in os.walk( directory ):
for name in files:
found_headers.append( os.path.join( path , name ) )
else:
for path, subdirs, files in os.walk( directory ):
for name in files:
if name.endswith( extension ):
found_headers.append( os.path.join( path , name ) )
return found_headers
def maybe_find_eigen():
eigen_path = os.path.dirname( [ filename for filename in glob.iglob('../**/eigen3/Eigen', recursive=True) ][0] )
if( eigen_path == None ):
raise ValueError( "Eigen3 include directory not found.")
return eigen_path
if sys.platform == 'darwin':
# Apple OS X
inc_dirs = ['/usr/include/eigen3']
inc_dirs.append( numpy.get_include() ) # Numpy header files
inc_dirs.append( get_python_inc() ) # Python header files
elif sys.platform == 'linux':
# Linux
inc_dirs = ['/usr/include/eigen3']
elif sys.platform == 'win32':
# Windows
inc_dirs = [ maybe_find_eigen() ]
else:
# We don't support other Operating Systems. Do people want to use our package on Haiku ...?
raise OSError( "Can't install on this system -- unsupported OS." )
source_files = glob.glob( 'hdim/hdim_wrap.cxx' )
source_files.extend( file_search( "src", '.cpp' ) )
header_files = []
header_files.extend( file_search( "src", '.hpp' ) )
extension = Extension('_hdim',
define_macros = [('NDEBUG',None)],
include_dirs = inc_dirs,
sources = source_files,
language='c++',
extra_compile_args=['--std=c++11','-O3','-mtune=native','-march=native'])
setup(name="hdim",
version="0.1.4",
description=("A toolkit for working with high-dimensional data."),
url="https://github.com/LedererLab/FOS",
author="Benjamin J Phillips",
author_email="bejphil@uw.edu",
license="MIT",
packages=['hdim'],
data_files = header_files, # Actually the header files needed to build from source
ext_modules=[extension],
requires=["NumPy (>= 1.3)"],
platforms = ["Linux"],
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: C++',
'Topic :: Scientific/Engineering :: Mathematics',
'Intended Audience :: Science/Research',
],
zip_safe=False)