-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup.py
76 lines (65 loc) · 2.2 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
from __future__ import print_function
import os, platform
from stat import ST_MTIME
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from glew_pxd import generate_pxd
lib_dir = []
if platform.system() == 'Darwin':
# find glew.h irrespective of version
for root, dirs, files in os.walk('/usr/local/Cellar/glew'):
if 'glew.h' in files:
glew_header = os.path.join(root,'glew.h')
includes = []
link_args = []
libs = ['GLEW']
elif platform.system() == 'Windows':
glew_header = 'win_glew/gl/glew.h'
includes = ['win_glew']
libs = ['glew32', 'openGL32']
lib_dir = ['win_glew']
link_args = []
elif platform.system() == 'Linux':
glew_header = '/usr/include/GL/glew.h'
includes = ['/usr/include/GL']
libs = ['GLEW']
link_args = []
if os.path.isfile('glew.pxd') and os.stat('glew.pxd')[ST_MTIME] > os.stat(glew_header)[ST_MTIME]:
print("'glew.pxd' is up-to-date.")
else:
print("generating glew.pxd based on '%s'"%glew_header)
generate_pxd(glew_header)
extensions = [
#first submodule: utils
Extension( name="cygl.utils",
sources=['utils.pyx'],
include_dirs = includes,
libraries = libs,
library_dirs = lib_dir,
extra_link_args=link_args,
extra_compile_args=['-std=c++11'],
language="c++"),
Extension( name="cygl.shader",
sources=['shader.pyx'],
include_dirs = includes,
libraries = libs,
library_dirs = lib_dir,
extra_link_args=link_args,
extra_compile_args=['-std=c++11'],
language="c++"),
]
setup( name="cygl",
version = "0.4",
author = 'Moritz Kassner',
licence = 'MIT',
#this package shall be called cygl
packages = ['cygl'],
# dependencies are in flat dir for submodule integration
# this way the source and compiled extension will have the same file layout.
# disutils should treat the files in this dir as being in a dir called cygl.
package_dir = {'cygl':''},
exclude_package_data = {'': ['glew_pxd.py'] },
description = "OpenGL utility functions powered by python. This module can also be used as a submodule for other cython projects that want to use OpenGL.",
ext_modules = cythonize(extensions)
)