-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_build.py
More file actions
executable file
·194 lines (166 loc) · 6.7 KB
/
setup_build.py
File metadata and controls
executable file
·194 lines (166 loc) · 6.7 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# -*- coding: utf-8 -*-
"""
The following resources have been really helpful in making this setup script -
https://github.com/numpy/numpy/blob/master/setup.py
https://packaging.python.org/en/latest/index.html
https://github.com/pypa/sampleproject/blob/master/setup.py
https://docs.python.org/2/distutils/apiref.html
http://stackoverflow.com/questions/3207219/how-to-list-all-files-of-a-directory-in-python
"""
from PyQt4 import pyqtconfig
import PyQt4
import sipdistutils
import sys
import os
import platform
osname_ = platform.system()
from distutils.core import setup, Extension
qcfg = pyqtconfig.Configuration()
qcfg.pyqt_sip_flags
remaining = sys.argv[1:]
print("[INFO] Sip flags: %s" % qcfg.pyqt_sip_flags)
print("[INFO] On system: %s" % osname_)
sys.argv = [sys.argv[0],
'build_ext',
'--sip-opts=-I{} -e -g {}'.format(qcfg.pyqt_sip_dir,
qcfg.pyqt_sip_flags)]
sys.argv.extend(remaining)
here = os.path.dirname(__file__)
# print(sys.argv)
# RESOURCES -
# https://docs.python.org/2.7/distutils/apiref.html?highlight=setup#distutils.core.setup
# http://pyqt.sourceforge.net/Docs/sip4/distutils.html#ref-distutils
# https://wiki.python.org/moin/EmbedingPyQtTutorial
# list of object files to be passed to the linker.
# These files must not have extensions, as the default extension
# for the compiler is used.
#os.environ["CC"]="g++"
extra_objects = []
# list of libraries to link against
libraries = ["QtCore",
"QtGui",
"QtOpenGL",
"osg",
"osgFX",
"osgUtil",
"osgFX",
"osgGA",
"osgQt",
"osgAnimation",
"osgViewer",
"osgQt",
"osgManipulator",
"osgSim",
"osgText"]
# list of directories to search for libraries at link-time
library_dirs = []
# list of directories to search for shared (dynamically loaded) libraries at run-time
runtime_library_dirs = PyQt4.__path__
# additional command line options for the compiler command line
extra_compile_args = ["-O2",
"-std=c++0x",
"-Wno-reorder",
"-Wno-overloaded-virtual"]
# additional command line options for the linker command line
if osname_ == 'Linux':
extra_link_args = ["-fPIC", "-shared"]
elif osname_ == 'Windows':
# Who cares
pass
else:
# On MacOSX, leave them empty.
extra_link_args = []
# specify include directories to search
include_dirs = [ "./moogli/bin/include/" ]
includes = [
"include/qt4/",
"include/qt4/QtCore/",
"include/qt4/QtGui/",
"include/qt4/QtOpenGL/",
"include/QtCore/",
"include/QtGui/",
"include/QtOpenGL/",
]
prefixes = [ "/usr", "/usr/local", "/opt" ]
for p in prefixes:
include_dirs += [ os.path.join(p, x) for x in includes ]
# define pre-processor macros
define_macros = []
# undefine pre-processor macros
undef_macros = []
moogli = Extension(name="moogli.core._moogli",
sources=[
# "moogli/bin/src/core/CoordinateSystem.cpp",
# "moogli/bin/src/core/Network.cpp",
# "moogli/bin/src/core/Visualizable.cpp",
# "moogli/bin/src/core/Neuron.cpp",
# "moogli/bin/src/core/ElectricalCompartment.cpp",
# "moogli/bin/src/core/ChemicalCompartment.cpp",
# "moogli/bin/src/core/Visualizables.cpp",
# "moogli/bin/src/view/NetworkViewer.cpp",
# "moogli/bin/src/handlers/GeometrySelector.cpp",
# "moogli/bin/src/utility/record.cpp",
# "moogli/bin/src/utility/globals.cpp",
# "moogli/bin/src/utility/conversions.cpp",
# "moogli/bin/src/utility/numerics.cpp",
# "moogli/bin/src/callbacks/CaptureView.cpp",
# "moogli/bin/moc/NetworkViewer.moc.cpp",
"moogli/bin/src/shapes/Shape.cpp",
"moogli/bin/src/shapes/Frustum.cpp",
"moogli/bin/src/shapes/Sphere.cpp",
"moogli/bin/src/widgets/ColorBar.cpp",
"moogli/bin/src/view/View.cpp",
"moogli/bin/src/view/Viewer.cpp",
"moogli/bin/moc/Viewer.moc.cpp",
"moogli/bin/sip/moogli.sip"
],
include_dirs=include_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
library_dirs=library_dirs,
libraries=libraries,
extra_objects=extra_objects,
runtime_library_dirs=runtime_library_dirs,
define_macros=define_macros,
undef_macros=undef_macros)
with open(os.path.join(here, 'requirements.txt')) as f:
requires = f.read().splitlines()
long_description = open(os.path.join(here, "README.rst")).read()
# scripts_dir = os.path.join(here, "scripts")
# scripts = [os.path.join(scripts_dir, fn) for fn in next(os.walk(scripts_dir))[2]]
setup(name='moogli',
author='Aviral Goel',
author_email='aviralg@ncbs.res.in',
maintainer='Aviral Goel',
maintainer_email='aviralg@ncbs.res.in',
version="0.5.0",
url='',
download_url='',
description="A 3D visualizer for neuronal networks",
long_description=long_description,
classifiers=['Development Status :: 3 - Alpha',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: C++',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Scientific/Engineering'],
license='GPLv2',
requires=requires,
include_package_data = True,
packages=[
"moogli",
"moogli.core",
"moogli.widgets",
"moogli.extensions",
"moogli.extensions.moose",
"moogli.visualization",
"moogli.visualization.pipeline"
],
package_data = { 'moogli.core' : [ 'moogli/core/_moogli.so' ]},
ext_modules=[moogli],
cmdclass={'build_ext': sipdistutils.build_ext},
)