-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
93 lines (86 loc) · 2.75 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
from setuptools import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import os
import sys
import platform
OpenGL_includes = []
OpenGL_extra_compile_args = []
OpenGL_extra_link_args = []
macOS_link_args = []
if sys.platform == 'darwin':
OS_X_ver = int(platform.mac_ver()[0].split('.')[1])
sdk_roots = [
'/Library/Developer/CommandLineTools/SDKs',
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs'
]
version_strings = [ 'MacOSX10.%d.sdk' % OS_X_ver, 'MacOSX.sdk' ]
poss_roots = [ '' ] + [
'%s/%s' % (sdk_root, version_string)
for sdk_root in sdk_roots
for version_string in version_strings ]
header_dir = '/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/'
poss_includes = [ root + header_dir for root in poss_roots ]
OpenGL_includes += [ path for path in poss_includes if os.path.exists(path)][:1]
OpenGL_extra_link_args = ['-framework', 'OpenGL']
OpenGL_extra_link_args += macOS_link_args
elif sys.platform == 'win32':
OpenGL_includes += ['glew/include']
OpenGL_extra_link_args = [
'glew/lib/Release/x64/glew32s.lib',
'opengl32.lib']
elif sys.platform == 'linux':
OpenGL_extra_link_args = [
'/usr/lib/x86_64-linux-gnu/libGLEW.a',
'-lGL']
extensions = cythonize([
# cythonize accepts a list of Extensions but their sources list
# must have length 1.
Extension(
name="cygl.obsolete",
sources=["src/cygl/obsolete.pyx"],
include_dirs=OpenGL_includes,
extra_link_args=OpenGL_extra_link_args,
),
Extension(
name="cygl.common",
sources=["src/cygl/common.pyx"],
include_dirs=OpenGL_includes,
extra_link_args=OpenGL_extra_link_args,
),
Extension(
name="cygl.vectors",
sources=["src/cygl/vectors.pyx"],
),
Extension(
name="cygl.matrices",
sources=["src/cygl/matrices.pyx"],
),
Extension(
name="cygl.hh",
sources=["src/cygl/hh.pyx"],
),
Extension(
name="cygl.vertex_array",
sources=["src/cygl/vertex_array.pyx"],
include_dirs=OpenGL_includes,
extra_link_args=OpenGL_extra_link_args,
),
Extension(
name="cygl.uniform_buffer",
sources=["src/cygl/uniform_buffer.pyx"],
include_dirs=OpenGL_includes,
extra_link_args=OpenGL_extra_link_args,
),
Extension(
name="cygl.gl_context",
sources=["src/cygl/gl_context.pyx"],
include_dirs=OpenGL_includes,
extra_link_args=OpenGL_extra_link_args,
),
])
setup(
ext_modules=extensions,
packages=['cygl'],
package_dir={'cygl':'src/cygl'}
)