Mercurial > touhou
comparison setup.py @ 636:4fa0a8e7d941
Add a GLFW implementation of gui.Window.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 14 May 2017 20:14:03 +0100 |
parents | 5270c34b4c00 |
children |
comparison
equal
deleted
inserted
replaced
635:80687f258001 | 636:4fa0a8e7d941 |
---|---|
14 'copy from http://www.cython.org/ and install it.') | 14 'copy from http://www.cython.org/ and install it.') |
15 sys.exit(1) | 15 sys.exit(1) |
16 | 16 |
17 | 17 |
18 COMMAND = 'pkg-config' | 18 COMMAND = 'pkg-config' |
19 GLFW_LIBRARIES = ['glfw3'] | |
19 SDL_LIBRARIES = ['sdl2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf'] | 20 SDL_LIBRARIES = ['sdl2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf'] |
20 GL_LIBRARIES = ['epoxy'] | 21 GL_LIBRARIES = ['epoxy'] |
21 | 22 |
22 debug = False # True to generate HTML annotations and display infered types. | 23 debug = False # True to generate HTML annotations and display infered types. |
23 anmviewer = False # It’s currently broken anyway. | 24 anmviewer = False # It’s currently broken anyway. |
62 'from http://pkg-config.freedesktop.org/ and install it.\n' | 63 'from http://pkg-config.freedesktop.org/ and install it.\n' |
63 'Continuing without it, assuming every dependency is available.') | 64 'Continuing without it, assuming every dependency is available.') |
64 | 65 |
65 | 66 |
66 default_libs = { | 67 default_libs = { |
68 'glfw3': '-lglfw', | |
67 'sdl2': '-lSDL2', | 69 'sdl2': '-lSDL2', |
68 'SDL2_image': '-lSDL2_image', | 70 'SDL2_image': '-lSDL2_image', |
69 'SDL2_mixer': '-lSDL2_mixer', | 71 'SDL2_mixer': '-lSDL2_mixer', |
70 'SDL2_ttf': '-lSDL2_ttf', | 72 'SDL2_ttf': '-lSDL2_ttf', |
71 'epoxy': '-lepoxy' | 73 'epoxy': '-lepoxy' |
83 if arg == '--cflags': | 85 if arg == '--cflags': |
84 return [] | 86 return [] |
85 return [default_libs[library] for library in libraries] | 87 return [default_libs[library] for library in libraries] |
86 | 88 |
87 | 89 |
90 glfw_args = {'extra_compile_args': get_arguments('--cflags', GLFW_LIBRARIES), | |
91 'extra_link_args': get_arguments('--libs', GLFW_LIBRARIES)} | |
88 sdl_args = {'extra_compile_args': get_arguments('--cflags', SDL_LIBRARIES), | 92 sdl_args = {'extra_compile_args': get_arguments('--cflags', SDL_LIBRARIES), |
89 'extra_link_args': get_arguments('--libs', SDL_LIBRARIES)} | 93 'extra_link_args': get_arguments('--libs', SDL_LIBRARIES)} |
90 | 94 |
91 if use_opengl: | 95 if use_opengl: |
92 opengl_args = {'extra_compile_args': get_arguments('--cflags', GL_LIBRARIES + SDL_LIBRARIES), | 96 opengl_args = {'extra_compile_args': get_arguments('--cflags', GL_LIBRARIES + SDL_LIBRARIES), |
126 for module_name, extensions in package.items(): | 130 for module_name, extensions in package.items(): |
127 fully_qualified_name = '%s.%s' % (package_name, module_name) | 131 fully_qualified_name = '%s.%s' % (package_name, module_name) |
128 if '.pyx' in extensions or '.pxd' in extensions or compile_everything: | 132 if '.pyx' in extensions or '.pxd' in extensions or compile_everything: |
129 if fully_qualified_name == 'pytouhou.lib.sdl': | 133 if fully_qualified_name == 'pytouhou.lib.sdl': |
130 compile_args = sdl_args | 134 compile_args = sdl_args |
135 elif fully_qualified_name == 'pytouhou.lib.glfw': | |
136 compile_args = glfw_args | |
131 else: | 137 else: |
132 compile_args = package_args | 138 compile_args = package_args |
133 ext = 'pyx' if '.pyx' in extensions else 'py' | 139 ext = 'pyx' if '.pyx' in extensions else 'py' |
134 source = '%s.%s' % (fully_qualified_name.replace('.', os.path.sep), ext) | 140 source = '%s.%s' % (fully_qualified_name.replace('.', os.path.sep), ext) |
135 ext_modules.append(Extension(fully_qualified_name, | 141 ext_modules.append(Extension(fully_qualified_name, |