Mercurial > touhou
comparison 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 |
comparison
equal
deleted
inserted
replaced
417:efae61ad6efe | 418:63f59be04a54 |
---|---|
4 from distutils.core import setup | 4 from distutils.core import setup |
5 from distutils.extension import Extension | 5 from distutils.extension import Extension |
6 from distutils.command.build_scripts import build_scripts | 6 from distutils.command.build_scripts import build_scripts |
7 from distutils.dep_util import newer | 7 from distutils.dep_util import newer |
8 from distutils import log | 8 from distutils import log |
9 from subprocess import check_output | |
9 | 10 |
10 # Cython is needed | 11 # Cython is needed |
11 try: | 12 try: |
12 from Cython.Distutils import build_ext | 13 from Cython.Distutils import build_ext |
13 except ImportError: | 14 except ImportError: |
14 print('You don’t seem to have Cython installed. Please get a ' | 15 print('You don’t seem to have Cython installed. Please get a ' |
15 'copy from www.cython.org and install it') | 16 'copy from www.cython.org and install it') |
16 sys.exit(1) | 17 sys.exit(1) |
17 | 18 |
19 | |
20 COMMAND = 'pkg-config' | |
21 LIBRARIES = ['sdl2'] | |
18 | 22 |
19 packages = [] | 23 packages = [] |
20 extension_names = [] | 24 extension_names = [] |
21 extensions = [] | 25 extensions = [] |
22 | 26 |
45 packages.append(package) | 49 packages.append(package) |
46 for filename in files: | 50 for filename in files: |
47 if filename.endswith('.pyx'): | 51 if filename.endswith('.pyx'): |
48 extension_name = '%s.%s' % (package, os.path.splitext(filename)[0]) | 52 extension_name = '%s.%s' % (package, os.path.splitext(filename)[0]) |
49 extension_names.append(extension_name) | 53 extension_names.append(extension_name) |
54 if extension_name == 'pytouhou.lib.sdl': | |
55 compile_args = check_output([COMMAND, '--cflags'] + LIBRARIES).split() | |
56 link_args = check_output([COMMAND, '--libs'] + LIBRARIES).split() | |
57 else: | |
58 compile_args = None | |
59 link_args = None | |
50 extensions.append(Extension(extension_name, | 60 extensions.append(Extension(extension_name, |
51 [os.path.join(directory, filename)])) | 61 [os.path.join(directory, filename)], |
62 extra_compile_args=compile_args, | |
63 extra_link_args=link_args)) | |
52 | 64 |
53 | 65 |
54 | 66 |
55 # TODO: find a less-intrusive, cleaner way to do this... | 67 # TODO: find a less-intrusive, cleaner way to do this... |
56 try: | 68 try: |