]> git.sesse.net Git - vlc/blob - test/setup.py
update module LIST file.
[vlc] / test / setup.py
1 from distutils.core import setup,Extension
2 import os
3
4 def get_vlcconfig():
5     vlcconfig=None
6     for n in ( 'vlc-config',
7                os.path.sep.join( ( '..', 'vlc-config' ))):
8         if os.path.exists(n):
9             vlcconfig=n
10             break
11     if vlcconfig is None:
12         print "*** Warning *** Cannot find vlc-config"
13     elif os.sys.platform == 'win32':
14         # Win32 does not know how to invoke the shell itself.
15         vlcconfig="sh %s" % vlcconfig
16     return vlcconfig
17
18 def get_cflags():
19     vlcconfig=get_vlcconfig()
20     if vlcconfig is None:
21         return []
22     else:
23         cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
24         cflags.append( "-D__LIBVLC__")
25         return cflags
26
27 def get_ldflags():
28     vlcconfig=get_vlcconfig()
29     if vlcconfig is None:
30         return []
31     else:
32         os.environ['top_builddir'] = '..'
33         ldflags = []
34         if os.sys.platform == 'darwin':
35             ldflags = "-read_only_relocs warning".split()
36         ldflags.extend(os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split())
37         if os.sys.platform == 'darwin':
38             ldflags.append('-lstdc++')
39         return ldflags
40
41 # To compile in a local vlc tree
42 native_libvlc_test = Extension( 'native_libvlc_test',
43                 sources = ['native/init.c', 'native/url.c', 'native/i18n.c',
44                             'native/stats.c', 'native/libvlc.c', 'native/profiles.c',
45                 'native/algo.c', 'native/threads.c'],
46                 include_dirs = ['../include', '../', '/usr/win32/include' ],
47                 extra_objects = [ '../src/.libs/libvlc.so', '../src/.libs/libvlc-control.so' ],
48                 extra_compile_args = get_cflags(),
49                     extra_link_args = [ '-L../..' ]  + get_ldflags(),
50                 )
51
52 native_gc_test = Extension( 'native_gc_test',
53                 sources = ['native/gc.c'],
54                 include_dirs = ['../include', '../', '/usr/win32/include' ],
55                 extra_objects = [ '../src/.libs/libvlc.so' ],
56                 extra_compile_args = get_cflags(),
57                     extra_link_args = [ '-L../..' ]  + get_ldflags(),
58                 )
59
60 setup( name = 'native_libvlc_test' ,version = '1242', ext_modules = [ native_libvlc_test ] )
61
62
63 setup( name = 'native_gc_test' ,version = '1242', ext_modules = [ native_gc_test ] )