forked from moderngl/moderngl
-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
executable file
·171 lines (149 loc) · 4.98 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
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
import os
import platform
import re
import sys
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion
from setuptools import Extension, setup
# pylint: disable=C0103, W0212
if sys.version_info < (3, 0):
raise Exception('Python 2 is not supported!')
PLATFORMS = {'windows', 'linux', 'darwin', 'cygwin', 'android'}
target = platform.system().lower()
if 'pydroid3' in sys.executable.lower():
target = 'android'
for known in PLATFORMS:
if target.startswith(known):
target = known
if target not in PLATFORMS:
target = 'linux'
# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
# the version that python was built for. This may be overridden by setting
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
if target == 'darwin':
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(get_config_var('MACOSX_DEPLOYMENT_TARGET'))
if python_target < '10.9' and current_system >= '10.9':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
if target in ['linux', 'cygwin']:
from distutils import sysconfig
cvars = sysconfig.get_config_vars()
if hasattr(sysconfig, '_config_vars') and sysconfig._config_vars is not None:
if 'OPT' in cvars:
sysconfig._config_vars['OPT'] = cvars['OPT'].replace('-Wstrict-prototypes', '')
sysconfig._config_vars['OPT'] = cvars['OPT'].replace('-Wimplicit-function-declaration', '')
if 'CFLAGS' in cvars:
sysconfig._config_vars['CFLAGS'] = cvars['CFLAGS'].replace('-Wstrict-prototypes', '')
sysconfig._config_vars['CFLAGS'] = cvars['CFLAGS'].replace('-Wimplicit-function-declaration', '')
libraries = {
'windows': [],
'linux': [],
'cygwin': [],
'darwin': [],
'android': [],
}
extra_compile_args = {
'windows': [],
'linux': [],
'cygwin': [],
'darwin': ['-Wno-deprecated-declarations'],
'android': [],
}
extra_linker_args = {
'windows': [],
'linux': [],
'cygwin': [],
'darwin': [],
'android': [],
}
mgl = Extension(
name='moderngl.mgl',
include_dirs=['src', 'moderngl', 'moderngl/mgl'],
define_macros=[],
libraries=libraries[target],
extra_compile_args=extra_compile_args[target],
extra_link_args=extra_linker_args[target],
sources=[
'moderngl/old/Sampler.cpp',
'moderngl/old/Attribute.cpp',
'moderngl/old/Buffer.cpp',
'moderngl/old/BufferFormat.cpp',
'moderngl/old/ComputeShader.cpp',
'moderngl/old/Context.cpp',
'moderngl/old/DataType.cpp',
'moderngl/old/Error.cpp',
'moderngl/old/Framebuffer.cpp',
'moderngl/old/InvalidObject.cpp',
'moderngl/old/ModernGL.cpp',
'moderngl/old/Program.cpp',
'moderngl/old/Query.cpp',
'moderngl/old/Renderbuffer.cpp',
'moderngl/old/Scope.cpp',
'moderngl/old/Texture.cpp',
'moderngl/old/Texture3D.cpp',
'moderngl/old/TextureArray.cpp',
'moderngl/old/TextureCube.cpp',
'moderngl/old/Uniform.cpp',
'moderngl/old/UniformBlock.cpp',
'moderngl/old/UniformGetters.cpp',
'moderngl/old/UniformSetters.cpp',
'moderngl/old/VertexArray.cpp',
],
depends=[
'moderngl/old/gl_methods.hpp',
'moderngl/old/OpenGL.hpp',
'moderngl/old/BufferFormat.hpp',
'moderngl/old/Error.hpp',
'moderngl/old/InlineMethods.hpp',
'moderngl/old/OpenGL.hpp',
'moderngl/old/Python.hpp',
'moderngl/old/Types.hpp',
'moderngl/old/UniformGetSetters.hpp',
],
)
short_description = 'ModernGL: High performance rendering for Python 3'
with open('README.md') as f:
long_description = f.read()
long_description = re.sub(r'</?div[^>]*>|\r', '', long_description, flags=re.M)
keywords = [
'ModernGL',
'OpenGL',
'PyOpenGL',
'rendering',
'graphics',
'shader',
'GLSL',
'GPU',
'visualization',
'2D',
'3D',
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Topic :: Games/Entertainment',
'Topic :: Multimedia :: Graphics',
'Topic :: Multimedia :: Graphics :: 3D Rendering',
'Topic :: Scientific/Engineering :: Visualization',
'Programming Language :: Python :: 3 :: Only',
]
setup(
name='moderngl',
version='5.6.0',
description=short_description,
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/moderngl/moderngl',
author='Szabolcs Dombi',
author_email='[email protected]',
license='MIT',
classifiers=classifiers,
keywords=keywords,
packages=['moderngl', 'moderngl.program_members'],
ext_modules=[mgl],
platforms=['any'],
install_requires=['glcontext==1.0.*'],
)