2012-02-23 23:25:20 +00:00
|
|
|
#
|
|
|
|
# Kivy - Crossplatform NUI toolkit
|
|
|
|
# http://kivy.org/
|
|
|
|
#
|
|
|
|
|
2012-01-29 16:23:42 +00:00
|
|
|
import sys
|
2012-02-23 23:25:20 +00:00
|
|
|
from copy import deepcopy
|
|
|
|
from os.path import join, dirname, sep, exists
|
2011-02-01 10:21:54 +00:00
|
|
|
from os import walk, environ
|
2011-02-19 00:08:40 +00:00
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.extension import Extension
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Detect options
|
|
|
|
#
|
|
|
|
c_options = {
|
|
|
|
'use_opengl_es2': True,
|
|
|
|
'use_opengl_debug': False,
|
|
|
|
'use_glew': False,
|
2012-02-24 00:51:31 +00:00
|
|
|
'use_sdl': False,
|
|
|
|
'use_ios': False,
|
2012-02-23 23:25:20 +00:00
|
|
|
'use_mesagl': 'USE_MESAGL' in environ}
|
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
# now check if environ is changing the default values
|
|
|
|
for key in c_options.keys():
|
|
|
|
ukey = key.upper()
|
|
|
|
if ukey in environ:
|
|
|
|
value = bool(int(environ[ukey]))
|
|
|
|
print 'Environ change %s -> %s' % (key, value)
|
|
|
|
c_options[key] = value
|
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Determine on which platform we are
|
|
|
|
|
2012-01-29 16:23:42 +00:00
|
|
|
platform = sys.platform
|
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# Detect Python for android project (http://github.com/kivy/python-for-android)
|
2012-01-29 16:49:00 +00:00
|
|
|
ndkplatform = environ.get('NDKPLATFORM')
|
|
|
|
if ndkplatform is not None and environ.get('LIBLINK'):
|
2012-01-29 16:23:42 +00:00
|
|
|
platform = 'android'
|
2012-02-24 00:51:31 +00:00
|
|
|
kivy_ios_root = environ.get('KIVYIOSROOT', None)
|
|
|
|
if kivy_ios_root is not None:
|
2012-02-23 00:50:02 +00:00
|
|
|
platform = 'ios'
|
2012-01-29 16:23:42 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Cython check
|
2012-12-16 15:05:25 +00:00
|
|
|
# on python-for-android and kivy-ios, cython usage is external
|
|
|
|
have_cython = False
|
|
|
|
if platform in ('ios', 'android'):
|
2012-12-16 12:47:32 +00:00
|
|
|
print '\nCython check avoided.'
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
# check for cython
|
|
|
|
from Cython.Distutils import build_ext
|
|
|
|
have_cython = True
|
|
|
|
except ImportError:
|
2012-12-16 15:05:25 +00:00
|
|
|
print '\nCython is missing, its required for compiling kivy !\n\n'
|
|
|
|
raise
|
|
|
|
|
|
|
|
if not have_cython:
|
|
|
|
from distutils.command.build_ext import build_ext
|
2011-04-23 16:08:31 +00:00
|
|
|
|
2012-10-17 16:34:28 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Setup classes
|
2012-06-16 15:46:48 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
class KivyBuildExt(build_ext):
|
|
|
|
|
|
|
|
def build_extensions(self):
|
|
|
|
print 'Build configuration is:'
|
|
|
|
for opt, value in c_options.iteritems():
|
|
|
|
print ' *', opt, ' = ', repr(value)
|
|
|
|
print 'Generate config.h'
|
|
|
|
config_h = join(dirname(__file__), 'kivy', 'graphics', 'config.h')
|
|
|
|
with open(config_h, 'w') as fd:
|
|
|
|
fd.write('// Autogenerated file for Kivy C configuration\n')
|
|
|
|
for k, v in c_options.iteritems():
|
|
|
|
fd.write('#define __%s %d\n' % (k.upper(), int(v)))
|
|
|
|
|
|
|
|
print 'Generate config.pxi'
|
|
|
|
config_pxi = join(dirname(__file__), 'kivy', 'graphics', 'config.pxi')
|
|
|
|
with open(config_pxi, 'w') as fd:
|
|
|
|
fd.write('# Autogenerated file for Kivy Cython configuration\n')
|
|
|
|
for k, v in c_options.iteritems():
|
|
|
|
fd.write('DEF %s = %d\n' % (k.upper(), int(v)))
|
|
|
|
|
|
|
|
build_ext.build_extensions(self)
|
|
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
2010-11-03 21:05:03 +00:00
|
|
|
# extract version (simulate doc generation, kivy will be not imported)
|
2011-02-01 10:21:54 +00:00
|
|
|
environ['KIVY_DOC_INCLUDE'] = '1'
|
2010-11-03 21:05:03 +00:00
|
|
|
import kivy
|
|
|
|
|
|
|
|
# extra build commands go in the cmdclass dict {'command-name': CommandClass}
|
2011-01-20 17:17:29 +00:00
|
|
|
# see tools.packaging.{platform}.build.py for custom build commands for
|
|
|
|
# portable packages. also e.g. we use build_ext command from cython if its
|
|
|
|
# installed for c extensions.
|
2012-02-23 23:25:20 +00:00
|
|
|
from kivy.tools.packaging.factory import FactoryBuild
|
|
|
|
cmdclass = {
|
|
|
|
'build_factory': FactoryBuild,
|
2012-06-16 15:46:48 +00:00
|
|
|
'build_ext': KivyBuildExt}
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2011-04-15 12:37:52 +00:00
|
|
|
try:
|
|
|
|
# add build rules for portable packages to cmdclass
|
|
|
|
if platform == 'win32':
|
|
|
|
from kivy.tools.packaging.win32.build import WindowsPortableBuild
|
|
|
|
cmdclass['build_portable'] = WindowsPortableBuild
|
|
|
|
elif platform == 'darwin':
|
|
|
|
from kivy.tools.packaging.osx.build import OSXPortableBuild
|
|
|
|
cmdclass['build_portable'] = OSXPortableBuild
|
|
|
|
except ImportError:
|
|
|
|
print 'User distribution detected, avoid portable command.'
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2011-02-01 19:46:39 +00:00
|
|
|
# Detect which opengl version headers to use
|
2012-02-23 02:34:01 +00:00
|
|
|
if platform in ('android', 'darwin', 'ios'):
|
2012-01-10 13:39:21 +00:00
|
|
|
pass
|
|
|
|
elif platform == 'win32':
|
2011-01-25 16:41:09 +00:00
|
|
|
print 'Windows platform detected, force GLEW usage.'
|
|
|
|
c_options['use_glew'] = True
|
2011-02-01 19:46:39 +00:00
|
|
|
else:
|
|
|
|
# searching GLES headers
|
|
|
|
default_header_dirs = ['/usr/include', '/usr/local/include']
|
|
|
|
found = False
|
|
|
|
for hdir in default_header_dirs:
|
|
|
|
filename = join(hdir, 'GLES2', 'gl2.h')
|
|
|
|
if exists(filename):
|
|
|
|
found = True
|
|
|
|
print 'Found GLES 2.0 headers at', filename
|
|
|
|
break
|
|
|
|
if not found:
|
|
|
|
print 'WARNING: GLES 2.0 headers are not found'
|
|
|
|
print 'Fallback to Desktop opengl headers.'
|
|
|
|
c_options['use_opengl_es2'] = False
|
2011-01-25 16:41:09 +00:00
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
# check if we are in a kivy-ios build
|
|
|
|
if platform == 'ios':
|
|
|
|
print 'Kivy-IOS project environment detect, use it.'
|
|
|
|
print 'Kivy-IOS project located at %r' % kivy_ios_root
|
|
|
|
print 'Activate SDL compilation.'
|
|
|
|
c_options['use_ios'] = True
|
|
|
|
c_options['use_sdl'] = True
|
2011-01-25 16:41:09 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# declare flags
|
2012-06-16 15:46:48 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def get_modulename_from_file(filename):
|
2012-02-24 01:25:25 +00:00
|
|
|
filename = filename.replace(sep, '/')
|
2012-02-23 23:25:20 +00:00
|
|
|
pyx = '.'.join(filename.split('.')[:-1])
|
2012-02-24 01:25:25 +00:00
|
|
|
pyxl = pyx.split('/')
|
2012-02-23 23:25:20 +00:00
|
|
|
while pyxl[0] != 'kivy':
|
|
|
|
pyxl.pop(0)
|
|
|
|
if pyxl[1] == 'kivy':
|
|
|
|
pyxl.pop(0)
|
|
|
|
return '.'.join(pyxl)
|
2011-01-25 16:41:09 +00:00
|
|
|
|
2012-06-16 15:46:48 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
class CythonExtension(Extension):
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
Extension.__init__(self, *args, **kwargs)
|
|
|
|
self.pyrex_directives = {
|
|
|
|
'profile': 'USE_PROFILE' in environ,
|
2012-02-25 10:41:12 +00:00
|
|
|
'embedsignature': 'USE_EMBEDSIGNATURE' in environ}
|
2012-02-23 23:25:20 +00:00
|
|
|
# XXX with pip, setuptools is imported before distutils, and change
|
|
|
|
# our pyx to c, then, cythonize doesn't happen. So force again our
|
|
|
|
# sources
|
|
|
|
self.sources = args[1]
|
2010-12-16 22:00:14 +00:00
|
|
|
|
2012-06-16 15:46:48 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def merge(d1, *args):
|
|
|
|
d1 = deepcopy(d1)
|
|
|
|
for d2 in args:
|
|
|
|
for key, value in d2.iteritems():
|
2012-08-13 17:32:08 +00:00
|
|
|
value = deepcopy(value)
|
2012-02-23 23:25:20 +00:00
|
|
|
if key in d1:
|
|
|
|
d1[key].extend(value)
|
|
|
|
else:
|
|
|
|
d1[key] = value
|
|
|
|
return d1
|
2011-04-27 12:12:58 +00:00
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
def determine_base_flags():
|
|
|
|
flags = {
|
|
|
|
'libraries': ['m'],
|
|
|
|
'include_dirs': [],
|
|
|
|
'extra_link_args': [],
|
|
|
|
'extra_compile_args': []}
|
|
|
|
if c_options['use_ios']:
|
2012-04-17 19:12:41 +00:00
|
|
|
sysroot = environ['SDKROOT']
|
2012-02-24 00:51:31 +00:00
|
|
|
flags['include_dirs'] += [sysroot]
|
|
|
|
flags['extra_compile_args'] += ['-isysroot', sysroot]
|
|
|
|
flags['extra_link_args'] += ['-isysroot', sysroot]
|
|
|
|
elif platform == 'darwin':
|
|
|
|
sysroot = '/System/Library/Frameworks/ApplicationServices.framework/Frameworks'
|
|
|
|
flags['extra_compile_args'] += ['-F%s' % sysroot]
|
|
|
|
flags['extra_link_args'] += ['-F%s' % sysroot]
|
|
|
|
return flags
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def determine_gl_flags():
|
|
|
|
flags = {'libraries': []}
|
2011-02-01 19:46:39 +00:00
|
|
|
if platform == 'win32':
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['libraries'] = ['opengl32']
|
2012-02-24 00:51:31 +00:00
|
|
|
elif platform == 'ios':
|
|
|
|
flags['libraries'] = ['GLESv2']
|
|
|
|
flags['extra_link_args'] = ['-framework', 'OpenGLES']
|
2011-02-01 19:46:39 +00:00
|
|
|
elif platform == 'darwin':
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['extra_link_args'] = ['-framework', 'OpenGL', '-arch', 'x86_64']
|
|
|
|
flags['extra_compile_args'] = ['-arch', 'x86_64']
|
2011-02-01 19:46:39 +00:00
|
|
|
elif platform.startswith('freebsd'):
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['include_dirs'] = ['/usr/local/include']
|
|
|
|
flags['extra_link_args'] = ['-L', '/usr/local/lib']
|
2012-05-24 01:49:54 +00:00
|
|
|
flags['libraries'] = ['GL']
|
2012-04-05 12:17:55 +00:00
|
|
|
elif platform.startswith('openbsd'):
|
|
|
|
flags['include_dirs'] = ['/usr/X11R6/include']
|
|
|
|
flags['extra_link_args'] = ['-L', '/usr/X11R6/lib']
|
|
|
|
flags['libraries'] = ['GL']
|
2012-01-10 13:39:21 +00:00
|
|
|
elif platform == 'android':
|
2012-02-24 10:24:21 +00:00
|
|
|
flags['include_dirs'] = [join(ndkplatform, 'usr', 'include')]
|
|
|
|
flags['extra_link_args'] = ['-L', join(ndkplatform, 'usr', 'lib')]
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['libraries'] = ['GLESv2']
|
2010-11-03 21:05:03 +00:00
|
|
|
else:
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['libraries'] = ['GL']
|
2011-01-25 16:41:09 +00:00
|
|
|
if c_options['use_glew']:
|
2011-02-01 19:46:39 +00:00
|
|
|
if platform == 'win32':
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['libraries'] += ['glew32']
|
2011-01-25 18:55:48 +00:00
|
|
|
else:
|
2012-02-23 23:25:20 +00:00
|
|
|
flags['libraries'] += ['GLEW']
|
|
|
|
return flags
|
2011-01-25 16:41:09 +00:00
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
def determine_sdl():
|
|
|
|
flags = {}
|
|
|
|
if not c_options['use_sdl']:
|
|
|
|
return flags
|
|
|
|
|
|
|
|
flags['libraries'] = ['SDL', 'SDL_ttf', 'freetype', 'z', 'bz2']
|
2012-02-24 01:09:45 +00:00
|
|
|
flags['include_dirs'] = []
|
2012-02-24 00:51:31 +00:00
|
|
|
flags['extra_link_args'] = []
|
|
|
|
flags['extra_compile_args'] = []
|
|
|
|
|
|
|
|
# Paths as per homebrew (modified formula to use hg checkout)
|
|
|
|
if c_options['use_ios']:
|
|
|
|
# Note: on IOS, SDL is already loaded by the launcher/main.m
|
|
|
|
# So if we add it here, it will just complain about duplicate
|
|
|
|
# symbol, cause libSDL.a would be included in main.m binary +
|
|
|
|
# text_sdlttf.so
|
|
|
|
# At the result, we are linking without SDL explicitly, and add
|
|
|
|
# -undefined dynamic_lookup
|
|
|
|
# (/tito)
|
|
|
|
flags['libraries'] = ['SDL_ttf', 'freetype', 'bz2']
|
2012-02-24 01:09:45 +00:00
|
|
|
flags['include_dirs'] += [
|
2012-02-24 00:51:31 +00:00
|
|
|
join(kivy_ios_root, 'build', 'include'),
|
|
|
|
join(kivy_ios_root, 'build', 'include', 'SDL'),
|
|
|
|
join(kivy_ios_root, 'build', 'include', 'freetype')]
|
|
|
|
flags['extra_link_args'] += [
|
|
|
|
'-L', join(kivy_ios_root, 'build', 'lib'),
|
|
|
|
'-undefined', 'dynamic_lookup']
|
|
|
|
else:
|
2012-02-24 01:09:45 +00:00
|
|
|
flags['include_dirs'] = ['/usr/local/include/SDL']
|
2012-02-24 00:51:31 +00:00
|
|
|
flags['extra_link_args'] += ['-L/usr/local/lib/']
|
|
|
|
|
|
|
|
if platform == 'ios':
|
|
|
|
flags['extra_link_args'] += [
|
|
|
|
'-framework', 'Foundation',
|
|
|
|
'-framework', 'UIKit',
|
|
|
|
'-framework', 'AudioToolbox',
|
|
|
|
'-framework', 'CoreGraphics',
|
|
|
|
'-framework', 'QuartzCore',
|
2012-03-14 00:16:54 +00:00
|
|
|
'-framework', 'MobileCoreServices',
|
2012-02-24 00:51:31 +00:00
|
|
|
'-framework', 'ImageIO']
|
|
|
|
elif platform == 'darwin':
|
|
|
|
flags['extra_link_args'] += [
|
|
|
|
'-framework', 'ApplicationServices']
|
|
|
|
return flags
|
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def determine_graphics_pxd():
|
|
|
|
flags = {'depends': [join(dirname(__file__), 'kivy', x) for x in [
|
|
|
|
'graphics/buffer.pxd',
|
|
|
|
'graphics/c_opengl.pxd',
|
|
|
|
'graphics/c_opengl_debug.pxd',
|
|
|
|
'graphics/compiler.pxd',
|
|
|
|
'graphics/context_instructions.pxd',
|
|
|
|
'graphics/fbo.pxd',
|
|
|
|
'graphics/instructions.pxd',
|
|
|
|
'graphics/opengl_utils.pxd',
|
|
|
|
'graphics/shader.pxd',
|
|
|
|
'graphics/texture.pxd',
|
|
|
|
'graphics/transformation.pxd',
|
|
|
|
'graphics/vbo.pxd',
|
|
|
|
'graphics/vertex.pxd']]}
|
|
|
|
return flags
|
2011-02-01 23:17:24 +00:00
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
base_flags = determine_base_flags()
|
2012-02-23 23:25:20 +00:00
|
|
|
gl_flags = determine_gl_flags()
|
|
|
|
graphics_flags = determine_graphics_pxd()
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# sources to compile
|
|
|
|
sources = {
|
|
|
|
'_event.pyx': base_flags,
|
|
|
|
'properties.pyx': base_flags,
|
|
|
|
'graphics/buffer.pyx': base_flags,
|
2012-06-16 15:46:48 +00:00
|
|
|
'graphics/context.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/c_opengl_debug.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/compiler.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/context_instructions.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/fbo.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/gl_instructions.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/instructions.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/opengl.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/opengl_utils.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/shader.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/stencil_instructions.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/texture.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/transformation.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/vbo.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/vertex.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags),
|
|
|
|
'graphics/vertex_instructions.pyx': merge(
|
|
|
|
base_flags, gl_flags, graphics_flags)}
|
2011-02-13 15:06:19 +00:00
|
|
|
|
2012-02-24 00:51:31 +00:00
|
|
|
if c_options['use_sdl']:
|
|
|
|
sdl_flags = determine_sdl()
|
|
|
|
sources['core/window/sdl.pyx'] = merge(
|
|
|
|
base_flags, gl_flags, sdl_flags)
|
|
|
|
sources['core/text/text_sdlttf.pyx'] = merge(
|
|
|
|
base_flags, gl_flags, sdl_flags)
|
2012-02-25 10:41:12 +00:00
|
|
|
sources['core/audio/audio_sdl.pyx'] = merge(
|
|
|
|
base_flags, sdl_flags)
|
2012-02-24 00:51:31 +00:00
|
|
|
|
|
|
|
if platform in ('darwin', 'ios'):
|
|
|
|
# activate ImageIO provider for our core image
|
|
|
|
if platform == 'ios':
|
|
|
|
osx_flags = {'extra_link_args': [
|
|
|
|
'-framework', 'Foundation',
|
|
|
|
'-framework', 'UIKit',
|
|
|
|
'-framework', 'AudioToolbox',
|
|
|
|
'-framework', 'CoreGraphics',
|
|
|
|
'-framework', 'QuartzCore',
|
|
|
|
'-framework', 'ImageIO']}
|
|
|
|
else:
|
|
|
|
osx_flags = {'extra_link_args': [
|
|
|
|
'-framework', 'ApplicationServices']}
|
|
|
|
sources['core/image/img_imageio.pyx'] = merge(
|
|
|
|
base_flags, osx_flags)
|
|
|
|
|
2012-08-13 17:32:08 +00:00
|
|
|
if 'WITH_X11' in environ:
|
|
|
|
sources['core/window/window_x11.pyx'] = merge(
|
|
|
|
base_flags, gl_flags, graphics_flags, {
|
|
|
|
'depends': [join(dirname(__file__),
|
|
|
|
'kivy/core/window/window_x11_core.c')],
|
|
|
|
'libraries': ['Xrender', 'X11', 'm']
|
|
|
|
})
|
|
|
|
|
2010-11-05 16:55:22 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# extension modules
|
2012-06-16 15:46:48 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
def get_extensions_from_sources(sources):
|
|
|
|
ext_modules = []
|
2012-02-24 01:09:45 +00:00
|
|
|
if environ.get('KIVY_FAKE_BUILDEXT'):
|
|
|
|
print 'Fake build_ext asked, will generate only .h/.c'
|
|
|
|
return ext_modules
|
2012-02-23 23:25:20 +00:00
|
|
|
for pyx, flags in sources.iteritems():
|
|
|
|
pyx = join(dirname(__file__), 'kivy', pyx)
|
|
|
|
if not have_cython:
|
|
|
|
pyx = '%s.c' % pyx[:-4]
|
2012-02-24 10:24:21 +00:00
|
|
|
depends = []
|
|
|
|
else:
|
|
|
|
depends = flags.pop('depends', [])
|
2011-02-01 23:17:24 +00:00
|
|
|
module_name = get_modulename_from_file(pyx)
|
2012-02-24 01:14:14 +00:00
|
|
|
flags_clean = {}
|
|
|
|
for key, value in flags.iteritems():
|
|
|
|
if len(value):
|
|
|
|
flags_clean[key] = value
|
2012-02-23 23:25:20 +00:00
|
|
|
ext_modules.append(CythonExtension(module_name,
|
2012-02-24 01:14:14 +00:00
|
|
|
[pyx] + depends, **flags_clean))
|
2012-02-23 23:25:20 +00:00
|
|
|
return ext_modules
|
2010-11-05 16:55:22 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
ext_modules = get_extensions_from_sources(sources)
|
2010-11-03 21:05:03 +00:00
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# automatically detect data files
|
2010-11-03 21:05:03 +00:00
|
|
|
data_file_prefix = 'share/kivy-'
|
|
|
|
examples = {}
|
2011-06-10 00:42:23 +00:00
|
|
|
examples_allowed_ext = ('readme', 'py', 'wav', 'png', 'jpg', 'svg', 'json',
|
2011-01-31 23:25:15 +00:00
|
|
|
'avi', 'gif', 'txt', 'ttf', 'obj', 'mtl', 'kv')
|
2010-12-16 22:00:14 +00:00
|
|
|
for root, subFolders, files in walk('examples'):
|
2012-02-23 23:25:20 +00:00
|
|
|
for fn in files:
|
|
|
|
ext = fn.split('.')[-1].lower()
|
2010-11-03 21:05:03 +00:00
|
|
|
if ext not in examples_allowed_ext:
|
|
|
|
continue
|
2012-02-23 23:25:20 +00:00
|
|
|
filename = join(root, fn)
|
2010-12-16 22:00:14 +00:00
|
|
|
directory = '%s%s' % (data_file_prefix, dirname(filename))
|
2010-11-03 21:05:03 +00:00
|
|
|
if not directory in examples:
|
|
|
|
examples[directory] = []
|
|
|
|
examples[directory].append(filename)
|
|
|
|
|
2012-02-23 23:25:20 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
2010-11-03 21:05:03 +00:00
|
|
|
# setup !
|
|
|
|
setup(
|
|
|
|
name='Kivy',
|
|
|
|
version=kivy.__version__,
|
|
|
|
author='Kivy Crew',
|
|
|
|
author_email='kivy-dev@googlegroups.com',
|
|
|
|
url='http://kivy.org/',
|
|
|
|
license='LGPL',
|
2012-08-13 17:32:08 +00:00
|
|
|
description=(
|
|
|
|
'A software library for rapid development of '
|
|
|
|
'hardware-accelerated multitouch applications.'),
|
2010-11-03 21:05:03 +00:00
|
|
|
ext_modules=ext_modules,
|
|
|
|
cmdclass=cmdclass,
|
|
|
|
packages=[
|
|
|
|
'kivy',
|
2012-10-17 16:34:28 +00:00
|
|
|
'kivy.adapters',
|
2010-11-03 21:05:03 +00:00
|
|
|
'kivy.core',
|
|
|
|
'kivy.core.audio',
|
|
|
|
'kivy.core.camera',
|
|
|
|
'kivy.core.clipboard',
|
|
|
|
'kivy.core.image',
|
2010-11-05 04:27:58 +00:00
|
|
|
'kivy.core.gl',
|
2010-11-03 21:05:03 +00:00
|
|
|
'kivy.core.spelling',
|
|
|
|
'kivy.core.text',
|
|
|
|
'kivy.core.video',
|
2010-11-05 04:27:58 +00:00
|
|
|
'kivy.core.window',
|
2011-05-26 20:39:06 +00:00
|
|
|
'kivy.ext',
|
2010-11-03 21:05:03 +00:00
|
|
|
'kivy.graphics',
|
|
|
|
'kivy.input',
|
|
|
|
'kivy.input.postproc',
|
|
|
|
'kivy.input.providers',
|
|
|
|
'kivy.lib',
|
|
|
|
'kivy.lib.osc',
|
|
|
|
'kivy.modules',
|
2011-08-16 16:28:44 +00:00
|
|
|
'kivy.network',
|
2010-11-03 21:05:03 +00:00
|
|
|
'kivy.tools',
|
|
|
|
'kivy.tools.packaging',
|
2012-03-16 14:38:50 +00:00
|
|
|
'kivy.tools.packaging.pyinstaller_hooks',
|
2012-08-07 22:00:11 +00:00
|
|
|
'kivy.tools.highlight',
|
2012-10-25 03:38:03 +00:00
|
|
|
'kivy.extras',
|
2012-08-07 22:00:11 +00:00
|
|
|
'kivy.tools.extensions',
|
2012-02-23 23:25:20 +00:00
|
|
|
'kivy.uix', ],
|
2010-11-03 21:05:03 +00:00
|
|
|
package_dir={'kivy': 'kivy'},
|
|
|
|
package_data={'kivy': [
|
2011-01-09 23:37:16 +00:00
|
|
|
'data/*.kv',
|
2011-06-10 00:42:23 +00:00
|
|
|
'data/*.json',
|
2011-01-09 23:37:16 +00:00
|
|
|
'data/fonts/*.ttf',
|
|
|
|
'data/images/*.png',
|
2011-04-21 17:43:31 +00:00
|
|
|
'data/images/*.jpg',
|
2011-08-21 21:47:13 +00:00
|
|
|
'data/images/*.gif',
|
2012-01-22 20:00:58 +00:00
|
|
|
'data/images/*.atlas',
|
2011-10-21 16:05:51 +00:00
|
|
|
'data/keyboards/*.json',
|
2011-01-31 23:07:49 +00:00
|
|
|
'data/logo/*.png',
|
2011-01-09 23:37:16 +00:00
|
|
|
'data/glsl/*.png',
|
|
|
|
'data/glsl/*.vs',
|
|
|
|
'data/glsl/*.fs',
|
2012-08-07 22:00:11 +00:00
|
|
|
'tools/highlight/*.vim',
|
|
|
|
'tools/highlight/*.el',
|
2010-11-03 21:05:03 +00:00
|
|
|
'tools/packaging/README.txt',
|
|
|
|
'tools/packaging/win32/kivy.bat',
|
2011-01-31 23:49:50 +00:00
|
|
|
'tools/packaging/win32/kivyenv.sh',
|
2010-11-03 21:05:03 +00:00
|
|
|
'tools/packaging/win32/README.txt',
|
2012-08-07 22:00:11 +00:00
|
|
|
'tools/packaging/osx/Info.plist',
|
|
|
|
'tools/packaging/osx/InfoPlist.strings',
|
2011-01-20 17:17:29 +00:00
|
|
|
'tools/packaging/osx/kivy.sh']},
|
2010-11-03 21:05:03 +00:00
|
|
|
data_files=examples.items(),
|
|
|
|
classifiers=[
|
2011-04-15 19:38:29 +00:00
|
|
|
'Development Status :: 5 - Production/Stable',
|
2010-11-03 21:05:03 +00:00
|
|
|
'Environment :: MacOS X',
|
|
|
|
'Environment :: Win32 (MS Windows)',
|
|
|
|
'Environment :: X11 Applications',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Intended Audience :: End Users/Desktop',
|
|
|
|
'Intended Audience :: Information Technology',
|
|
|
|
'Intended Audience :: Science/Research',
|
2011-01-20 17:17:29 +00:00
|
|
|
'License :: OSI Approved :: GNU Library or Lesser '
|
|
|
|
'General Public License (LGPL)',
|
2010-11-03 21:05:03 +00:00
|
|
|
'Natural Language :: English',
|
|
|
|
'Operating System :: MacOS :: MacOS X',
|
|
|
|
'Operating System :: Microsoft :: Windows',
|
|
|
|
'Operating System :: POSIX :: BSD :: FreeBSD',
|
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Topic :: Artistic Software',
|
|
|
|
'Topic :: Games/Entertainment',
|
|
|
|
'Topic :: Multimedia :: Graphics :: 3D Rendering',
|
|
|
|
'Topic :: Multimedia :: Graphics :: Capture :: Digital Camera',
|
|
|
|
'Topic :: Multimedia :: Graphics :: Presentation',
|
|
|
|
'Topic :: Multimedia :: Graphics :: Viewers',
|
|
|
|
'Topic :: Multimedia :: Sound/Audio :: Players :: MP3',
|
|
|
|
'Topic :: Multimedia :: Video :: Display',
|
|
|
|
'Topic :: Scientific/Engineering :: Human Machine Interfaces',
|
|
|
|
'Topic :: Scientific/Engineering :: Visualization',
|
|
|
|
'Topic :: Software Development :: Libraries :: Application Frameworks',
|
2011-01-20 17:17:29 +00:00
|
|
|
'Topic :: Software Development :: User Interfaces'])
|
|
|
|
|