diff setup.py @ 418:63f59be04a54

Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 16 Jul 2013 21:07:15 +0200
parents cbe9dbd80dfb
children 3a7b36324611
line wrap: on
line diff
--- a/setup.py
+++ b/setup.py
@@ -6,6 +6,7 @@ from distutils.extension import Extensio
 from distutils.command.build_scripts import build_scripts
 from distutils.dep_util import newer
 from distutils import log
+from subprocess import check_output
 
 # Cython is needed
 try:
@@ -16,6 +17,9 @@ except ImportError:
     sys.exit(1)
 
 
+COMMAND = 'pkg-config'
+LIBRARIES = ['sdl2']
+
 packages = []
 extension_names = []
 extensions = []
@@ -47,8 +51,16 @@ for directory, _, files in os.walk('pyto
         if filename.endswith('.pyx'):
             extension_name = '%s.%s' % (package, os.path.splitext(filename)[0])
             extension_names.append(extension_name)
+            if extension_name == 'pytouhou.lib.sdl':
+                compile_args = check_output([COMMAND, '--cflags'] + LIBRARIES).split()
+                link_args = check_output([COMMAND, '--libs'] + LIBRARIES).split()
+            else:
+                compile_args = None
+                link_args = None
             extensions.append(Extension(extension_name,
-                                        [os.path.join(directory, filename)]))
+                                        [os.path.join(directory, filename)],
+                                        extra_compile_args=compile_args,
+                                        extra_link_args=link_args))