-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
119 lines (101 loc) · 4.3 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#################################################################
# Command line options to controll build
#################################################################
AddOption( '--clean-contrib',
help='force rebuilding of contrib libraries',
dest='clean-contrib', action="store_true"
)
#################################################################
# Source files list for each target we are building
#################################################################
#source files for the daemon ####################################
daemon_src = [
'src/fusion.cpp',
'src/containers/ccfMultimodalSyntaxTree.cpp',
'contrib/cJSON/cJSON.c',
'src/modules/ccxSpiritParserModule.cpp',
'src/modules/ccxDebugInputModule.cpp',
'src/modules/ccxDebugOutputModule.cpp',
'src/modules/ccxSphinxASRModule.cpp',
'src/modules/ccxAudioOutputModule.cpp',
'src/modules/ccxTemporalFusionModule.cpp',
'src/modules/ccxDebugGestureOutputModule.cpp',
'src/modules/ccxDebugGestureModule.cpp',
'src/modules/ccxJSONInteractionModule.cpp',
'src/models/ballWorldGrammar.cpp',
'contrib/libresample/lib/resample.c',
'contrib/libresample/lib/filterkit.c',
'contrib/libresample/lib/resamplesubs.c'
]
#source files for ccx, core+modules ########################
ccx_src = [
'ccx/ccxDaemon.cpp',
'ccx/ccxDataGenericContainer.cpp',
'ccx/ccxDataStream.cpp',
'ccx/ccxFactory.cpp',
'ccx/ccxLog.cpp',
'ccx/ccxModule.cpp',
'ccx/ccxPipeline.cpp',
'ccx/ccxProperty.cpp',
'ccx/ccxThread.cpp',
'ccx/ccxUtils.cpp',
]
#################################################################
# Check some arguments in command line
#################################################################
mode = ARGUMENTS.get('mode', 'normal')
if mode not in ('normal', 'debug'):
print 'Invalid mode <%s>, fallback to normal' % mode
mode = 'normal'
print 'Doing compilation in %s mode' % mode
#################################################################
# Build contrib and configure env for linking against deps
#################################################################
env = SConscript('ccx/contrib/SConscript')
#################################################################
# Platform specific settings for build env and OpenCV flags
#################################################################
import sys, os
# WIN32 #########################################################
if sys.platform == 'win32':
#on widnows daemon also needs XgetOpt source file
daemon_src.append('contrib/XgetOpt/XgetOpt.cxx')
#gotta set up msvc compiler and linker for list of options see:
#see http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=VS.71).aspx
#and http://msdn.microsoft.com/en-us/library/y0zzbyt4(VS.80).aspx
env.Append(
CPPDEFINES = ['WIN32'],
CCFLAGS = ['/O2', '/Oi', '/GL', '/EHsc', '/MD'], #mainly optimization
LIBS = ['ws2_32.lib', 'user32.lib'], #ws_32.lib is needed buy libevent
LINKFLAGS = ['/LTCG', '/OPT:REF', '/OPT:ICF']) #mainly optimization
# UNIX #######################################################
else:
#set the compiler if set in ENV, used e.g. to force 32bit by setting to g++ -m32
if os.environ.get('CC'): env.Replace(CC=os.environ['CC'])
if os.environ.get('CXX'): env.Replace(CXX=os.environ['CXX'])
if mode == 'debug':
env.Append(CCFLAGS = ['-ggdb', '-O0'])
#################################################################
# Build Rules for ccx and fusion program
#################################################################
ccx = env.Library('ccx', ccx_src )
env.Append(CPPPATH = ['ccx'])
env.Append(CPPPATH = 'src/modules')
env.Append(CPPPATH = 'src/containers')
env.Append(CPPPATH = 'src/models')
env.Append(CPPPATH = 'contrib/cJSON')
env.Append(CPPPATH = 'contrib/boost')
env.Append(CPPPATH = 'contrib/libresample/include')
env.Append(CPPPATH = 'contrib/libresample/lib')
env.Append(CPPPATH = 'contrib/rtaudio')
env.Append(CPPPATH = 'contrib/rtaudio/include')
env.Append(CPPPATH = 'contrib/sphinx/include')
env.Append(CPPPATH = 'contrib/sphinx/include/sphinxbase')
env.Append(CPPPATH = 'contrib/sphinx/include/sphinx3')
env.Append(LIBPATH = 'contrib/sphinx/lib/osx')
env.Append(LIBPATH = 'contrib/rtaudio')
env.Append(LIBS = 's3decoder')
env.Append(LIBS = 'sphinxbase')
env.Append(LIBS = 'rtaudio')
env.Append(LINKFLAGS = ['-framework', 'CoreAudio'])
env.Program('ccf', daemon_src + [ccx])