Permalink
Browse files

if python-for-android project is detected (via NDKPLATFORM env), use …

…it to locate gl2.h and use GLESv2 library.
  • Loading branch information...
1 parent 98f7c2c commit 6e8780fb230cc2dcb9ab84d54cf50d10c1feeb61 @tito tito committed Jan 10, 2012
Showing with 14 additions and 4 deletions.
  1. +14 −4 setup.py
View
@@ -39,6 +39,13 @@
cmdclass['build_factory'] = FactoryBuild
#
+# Detect Python for android project
+#
+ndkplatform = environ.get('NDKPLATFORM', None)
+if ndkplatform is not None:
+ platform = 'android'
+
+#
# Detect options
#
c_options = {
@@ -48,12 +55,11 @@
'use_mesagl': False}
# Detect which opengl version headers to use
-if platform == 'win32':
+if platform in ('android', 'darwin'):
+ pass
+elif platform == 'win32':
print 'Windows platform detected, force GLEW usage.'
c_options['use_glew'] = True
-elif platform == 'darwin':
- # macosx is using their own gl.h
- pass
else:
# searching GLES headers
default_header_dirs = ['/usr/include', '/usr/local/include']
@@ -125,6 +131,10 @@ def build_extensions(self):
elif platform.startswith('freebsd'):
include_dirs += ['/usr/local/include']
extra_link_args += ['-L', '/usr/local/lib']
+ elif platform == 'android':
+ include_dirs += [join(ndkplatform, 'usr', 'include')]
+ extra_link_args += ['-L', join(ndkplatform, 'usr', 'lib')]
+ libraries.append('GLESv2')
else:
libraries.append('GLESv2')

0 comments on commit 6e8780f

Please sign in to comment.