コード例 #1
0
ファイル: generate-wrappers.py プロジェクト: leonhd/rpythonic
sys.path.append("..")
import rpythonic

if sys.argv[-1].startswith("--output="):
    rpythonic.set_cache(sys.argv[-1].split("=")[-1])
else:
    rpythonic.set_cache("../examples")


ALL = "--all" in sys.argv

debug = 0
if "--emokit" in sys.argv or ALL:
    # apt-get install libmcrypt-dev liboscpack-dev
    # git clone http://github.com/qdot/emokit.git
    rpythonic.wrap("emokit", header="/usr/local/include/libepoc.h", library="/usr/local/lib/libepoc.so")


if "--python3" in sys.argv or ALL:
    footer = "PyRun_SimpleString = PyRun_SimpleStringFlags"
    rpythonic.wrap(
        "python3", header="/usr/include/python3.2/Python.h", library="/usr/lib/libpython3.2mu.so", ctypes_footer=footer
    )


if "--ogre" in sys.argv:
    defines = []
    ignore_ogre = "MeshSerializerImpl MeshSerializerImpl_v1_4 MeshSerializerImpl_v1_3 MeshSerializerImpl_v1_2 MeshSerializerImpl_v1_1 InstancedGeometry::MaterialBucket MaterialBucket ScriptCompiler StringUtil".split()
    ignore_ogre += "SharedPtr ExceptionFactory ControllerManager UTFString AnimableValue".split()
    ignore_ogre += "RenderQueueInvocationList RenderQueueInvocationIterator ConstShadowTextureConfigIterator ConstEnabledAnimationStateIterator".split()
    ignore_ogre += "Any AnyNumeric AnimableObject Animation DefaultWorkQueueBase".split()
コード例 #2
0
#!/usr/bin/python
'''
apt-get install python-ply
http://code.google.com/p/rpythonic/

http://dist.schmorp.de/libev/libev-4.11.tar.gz
make and make install - you should then have /usr/local/lib/libev.so
'''
import os, sys

sys.path.append('../../rpythonic')
import rpythonic
rpythonic.set_cache('../.')

rpythonic.wrap(
    'libev',
    header='/usr/local/include/ev.h',
    library_names=['libev'],
    strip_prefixes=['ev_', 'EV_'],
    ctypes_footer=open('ctypes-footer.py', 'rb').read(),
)
コード例 #3
0
    '/usr/include/atk-1.0/',
    '/usr/include/gdk-pixbuf-2.0/',
    '/usr/lib/i386-linux-gnu/glib-2.0/include/',  # glibconfig.h
    '/usr/lib/x86_64-linux-gnu/glib-2.0/include/',  # 64bits
]

glibfooter = open('glibfooter.py', 'rb').read()
gtkfooter = open('gtkfooter.py', 'rb').read()

if '--gtk3' in sys.argv:
    rpythonic.wrap(
        'gtk3',  # do not use "gtk" (already used by old pygtk)
        header='/usr/include/gtk-3.0/gtk/gtk.h',
        library='/usr/lib/libgtk-3.so',
        includes=['/usr/include/gtk-3.0/'] + GINCLUDE,
        #defines=['__G_THREAD_H__', '__G_ASYNCQUEUE_H__'],
        ctypes_footer=glibfooter + gtkfooter,
        strip_prefixes=['GTK_', 'gtk_'],
        insert_headers=['/usr/include/gtk-3.0/gtk/gtkx.h'
                        ],  # required with gtk3 
    )

if '--clutter' in sys.argv:
    # yum install clutter-gtk-devel		# this also gets gtk-devel
    rpythonic.wrap(
        'libclutter-gtk',
        header='/usr/include/clutter-gtk-1.0/clutter-gtk/clutter-gtk.h',
        library_name='libclutter-gtk-1.0',
        includes=[
            '/usr/include/gtk-3.0/',
            '/usr/include/clutter-1.0/',
コード例 #4
0
## for stdarg.h
includes = [
    os.path.join(
        NDK_ROOT,
        'toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/lib/gcc/arm-eabi/4.4.0/include/'
    )
]
defines = ['__ANDROID__']

name = 'android'
header = os.path.join(os.path.join(USR_INC, name), 'native_activity.h')
library = os.path.join(USR_LIB, 'libandroid.so')
rpythonic.wrap(name,
               header=header,
               library=library,
               includes=includes,
               system_include=USR_INC,
               ctypes=False,
               rffi=True,
               platform='android')

name = 'EGL'
header = os.path.join(os.path.join(USR_INC, name), 'egl.h')
library = os.path.join(USR_LIB, 'libEGL.so')
rpythonic.wrap(name,
               header=header,
               library=library,
               includes=includes,
               system_include=USR_INC,
               defines=defines,
               ctypes=False,
               rffi=True,
コード例 #5
0
## requires iOS headers ##
USR_INC = SDK_ROOT = '../../ios-sdk-2.0/'
assert os.path.isdir( SDK_ROOT )

includes = ['./ios-hacks']
defines = ['TARGET_OS_IPHONE', '__arm__', '__LITTLE_ENDIAN__', '__GNUC__', '__APPLE_CPP__', '_ANSI_SOURCE']
undefines = ['__i386__', '__x86_64__']
library = '<undefined>'

name = 'GLES'
header = os.path.join(os.path.join( USR_INC, 'OpenGLES' ), 'ES1')
header = os.path.join( header, 'glext.h' )		# glext superset of gl.h
#library = os.path.join( USR_LIB, 'libGLESv1_CM.so' )
rpythonic.wrap( 
	name, header=header, library=library, 
	includes=includes, system_include=USR_INC,
	defines=defines,
	ctypes=False, platform='iOS'
	)

name = 'OpenAL'
header = os.path.join(os.path.join( USR_INC, name ), 'al.h')
rpythonic.wrap( 
	name, header=header, library=library, 
	includes=includes, system_include=USR_INC,
	defines=defines,
	ctypes=False, platform='iOS'
	)

name = 'QuartzCore'
header = os.path.join(os.path.join( USR_INC, name ), 'QuartzCore.h')
rpythonic.wrap( 
コード例 #6
0
import rpythonic

if sys.argv[-1].startswith('--output='):
	rpythonic.set_cache( sys.argv[-1].split('=')[-1] )
else:
	rpythonic.set_cache('../examples' )


ALL = '--all' in sys.argv

debug=0
if '--emokit' in sys.argv or ALL:
	#apt-get install libmcrypt-dev liboscpack-dev
	#git clone http://github.com/qdot/emokit.git
	rpythonic.wrap( 'emokit', 
		header='/usr/local/include/libepoc.h',
		library = '/usr/local/lib/libepoc.so',
	)


if '--python3' in sys.argv or ALL:
	footer = 'PyRun_SimpleString = PyRun_SimpleStringFlags'
	rpythonic.wrap( 'python3', 
		header='/usr/include/python3.2/Python.h',
		library = '/usr/lib/libpython3.2mu.so',
		ctypes_footer = footer,
	)



if '--ogre' in sys.argv:
	defines = []
コード例 #7
0
ファイル: gen-gtk-wrappers.py プロジェクト: leonhd/rpythonic
	'/usr/include/pango-1.0/',
	'/usr/include/atk-1.0/',
	'/usr/include/gdk-pixbuf-2.0/',
	'/usr/lib/i386-linux-gnu/glib-2.0/include/',		# glibconfig.h
	'/usr/lib/x86_64-linux-gnu/glib-2.0/include/',	# 64bits
]

glibfooter = open( 'glibfooter.py', 'rb' ).read()
gtkfooter = open( 'gtkfooter.py', 'rb' ).read()

if '--gtk3' in sys.argv:
	rpythonic.wrap(
		'gtk3',		# do not use "gtk" (already used by old pygtk)
		header='/usr/include/gtk-3.0/gtk/gtk.h', 
		library='/usr/lib/libgtk-3.so',
		includes=['/usr/include/gtk-3.0/'] + GINCLUDE,
		#defines=['__G_THREAD_H__', '__G_ASYNCQUEUE_H__'],
		ctypes_footer= glibfooter + gtkfooter,
		strip_prefixes = ['GTK_', 'gtk_'],
		insert_headers = ['/usr/include/gtk-3.0/gtk/gtkx.h'],	# required with gtk3 
	)


if '--clutter' in sys.argv:
	# yum install clutter-gtk-devel		# this also gets gtk-devel
	rpythonic.wrap(
		'libclutter-gtk',
		header='/usr/include/clutter-gtk-1.0/clutter-gtk/clutter-gtk.h', 
		library_name='libclutter-gtk-1.0',
		includes=[
			'/usr/include/gtk-3.0/',
			 '/usr/include/clutter-1.0/',
コード例 #8
0
includes = ['./ios-hacks']
defines = [
    'TARGET_OS_IPHONE', '__arm__', '__LITTLE_ENDIAN__', '__GNUC__',
    '__APPLE_CPP__', '_ANSI_SOURCE'
]
undefines = ['__i386__', '__x86_64__']
library = '<undefined>'

name = 'GLES'
header = os.path.join(os.path.join(USR_INC, 'OpenGLES'), 'ES1')
header = os.path.join(header, 'glext.h')  # glext superset of gl.h
#library = os.path.join( USR_LIB, 'libGLESv1_CM.so' )
rpythonic.wrap(name,
               header=header,
               library=library,
               includes=includes,
               system_include=USR_INC,
               defines=defines,
               ctypes=False,
               platform='iOS')

name = 'OpenAL'
header = os.path.join(os.path.join(USR_INC, name), 'al.h')
rpythonic.wrap(name,
               header=header,
               library=library,
               includes=includes,
               system_include=USR_INC,
               defines=defines,
               ctypes=False,
               platform='iOS')