-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSConstruct
65 lines (54 loc) · 1.88 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sys
env = Environment(CPPPATH="include",
CXXFLAGS='-g ',
CFLAGS='-g ')
proto_src = ['rt_pool.c', 'buffer.c', 'packet.c', 'protocol.c',
'amf.c', 'utils.c']
env.Library('lib/librushcore.a', ['core/src/%s' % f for f in proto_src])
demo_src = ["connection.cpp", 'main.cpp']
cpppath = ['include']
libpath = ['lib']
if sys.platform.startswith('darwin'): # mac
cpppath.append('/opt/local/include')
libpath.append('/opt/local/lib')
env = Environment(CPPPATH=cpppath,
CXXFLAGS='-g ',
LDFLAGS='-static',
LIBS=['event', 'rushcore'],
LIBPATH=libpath)
env.Program('bin/demo-server',
['aux/%s' % f for f in demo_src])
import re
import sys
def SWIGSharedLibrary(env, library, sources, **args):
swigre = re.compile('(.*).i')
if env.WhereIs('swig') is None:
sourcesbis = []
for source in sources:
cName = swigre.sub(r'\1_wrap.c', source)
cppName = swigre.sub(r'\1_wrap.cc', source)
if os.path.exists(cName):
sourcesbis.append(cName)
elif os.path.exists(cppName):
sourcesbis.append(cppName)
else:
sourcesbis.append(source)
else:
sourcesbis = sources
if 'SWIGFLAGS' in args:
args['SWIGFLAGS'] += ['-python']
else:
args['SWIGFLAGS'] = ['-python'] + env['SWIGFLAGS']
args['SHLIBPREFIX']=""
if sys.version >= '2.5':
args['SHLIBSUFFIX']=".so"
cat=env.SharedLibrary(library, sourcesbis, **args)
return cat
env = Environment(CPPPATH=cpppath + ['/usr/include/python2.5'],
CXXFLAGS='-g ',
CFLAGS='-g ',
LDFLAGS='-static',
LIBS=['python2.5', 'rushcore'],
LIBPATH=['lib'])
env['BUILDERS']['PythonModule'] = SWIGSharedLibrary
env.PythonModule('_pyrushkit', ['bindings/rushkit.i', 'bindings/python/pyrushkit.c', 'bindings/python/py_amf.c'])