]> git.sesse.net Git - vlc/blob - test/setup.py
Fix test
[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         return cflags
25
26 def get_ldflags():
27     vlcconfig=get_vlcconfig()
28     if vlcconfig is None:
29         return []
30     else:
31         os.environ['top_builddir'] = '..'
32         ldflags = []
33         if os.sys.platform == 'darwin':
34             ldflags = "-read_only_relocs warning".split()
35         ldflags.extend(os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split())
36         if os.sys.platform == 'darwin':
37             ldflags.append('-lstdc++')
38         return ldflags
39
40 # To compile in a local vlc tree
41 native_libvlc_test = Extension( 'native_libvlc_test',
42                 sources = ['native/libvlc.c'],
43                 include_dirs = ['../include', '../', '/usr/win32/include' ],
44                 extra_objects = [ '../src/libvlc.a' ],
45                 extra_compile_args = get_cflags(),
46                     extra_link_args = [ '-L../..' ]  + get_ldflags(),
47                 )
48
49 native_stats_test = Extension( 'native_stats_test',
50                 sources = ['native/stats.c'],
51                 include_dirs = ['../include', '../', '/usr/win32/include' ],
52                 extra_objects = [ '../src/libvlc.a' ],
53                 extra_compile_args = get_cflags(),
54                     extra_link_args = [ '-L../..' ]  + get_ldflags(),
55                 )
56
57
58 setup( name = 'native_libvlc_test' ,version = '1242', ext_modules = [ native_libvlc_test ] )
59 setup( name = 'native_stats_test' ,version = '1242', ext_modules = [ native_stats_test ] )