-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
105 lines (97 loc) · 3.1 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python3
from setuptools import setup, Extension, Command
import os.path;
import platform;
enableParallelism = True;
extraOptions = []
extraLinkOptions=[]
if(platform.system()=="Darwin"):
extraOptions = ["-D OSX"];
if(enableParallelism):
extraOptions += ["-DCV_USE_LIBDISPATCH=1"];
elif(platform.system()=="Windows"):
extraOptions = ["-D WIN32 -lpthread"];
if(enableParallelism):
extraOptions += ["-DCV_USE_OPENMP=1","-fopenmp"];
extraLinkOptions+=["-lgomp"];
elif(platform.system()=="Linux"):
extraOptions = ["-D Linux","-D_GNU_SOURCE=1"];
if(enableParallelism):
extraOptions += ["-DCV_USE_OPENMP=1","-fopenmp"];
extraLinkOptions+=["-lgomp"];
else:
if(enableParallelism):
extraOptions += ["-DCV_USE_OPENMP=1","-fopenmp"];
extraLinkOptions+=["-lgomp"];
# WORKAROUND: https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy
class get_numpy_include(object):
def __str__(self):
import numpy
return numpy.get_include()
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
building_on_windows = platform.system() == "Windows"
with open(os.path.join("helios-core","Python", "PyCXVersion.h"),"rt") as fd:
version = fd.readline().strip().split(" ")[-1]
print("Compiling version %s"%version);
setup(
name="heliosFR",
version=version,
author="Filipi N. Silva",
author_email="[email protected]",
compiler = "mingw32" if building_on_windows else None,
setup_requires=['wheel',"numpy"],
description="Experimental library to visualize complex networks",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/heliosnet/helios-core",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Development Status :: 3 - Alpha",
"Programming Language :: C",
"Topic :: Scientific/Engineering :: Visualization",
"Intended Audience :: Science/Research"
],
python_requires='>=3.6',
ext_modules = [
Extension(
"heliosFR",
sources=[
os.path.join("helios-core","Source", "CVSimpleQueue.c"),
os.path.join("helios-core","Source", "CVSet.c"),
os.path.join("helios-core","Source", "CVNetwork.c"),
os.path.join("helios-core","Source", "CVDictionary.c"),
os.path.join("helios-core","Source", "CVNetworkLayout.c"),
os.path.join("helios-core","Python", "PyCXNetwork.c"),
os.path.join("helios-core","Python", "PyCXBind.c"),
],
include_dirs=[
os.path.join("helios-core","Source"),
os.path.join("helios-core","Python"),
get_numpy_include()
],
extra_compile_args=[
# "-g",
"-std=c11",
#"-m64",
"-Wall",
"-Wno-unused-function",
"-Wno-deprecated-declarations",
"-Wno-sign-compare",
"-Wno-strict-prototypes",
"-Wno-unused-variable",
"-O3",
# "-fvisibility=hidden",
"-funroll-loops",
"-fstrict-aliasing"
]+extraOptions,
extra_link_args=extraLinkOptions,
),
]
);