This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
SConstruct
134 lines (115 loc) · 4.84 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#################################################################
# 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/movid.cpp',
'contrib/cJSON/cJSON.c'
]
#source files for libmovid, core+modules ########################
libmovid_src = [
'src/moDaemon.cpp',
'src/moDataGenericContainer.cpp',
'src/moDataStream.cpp',
'src/moFactory.cpp',
'src/moLog.cpp',
'src/moModule.cpp',
'src/moOSC.cpp',
'src/moPipeline.cpp',
'src/moProperty.cpp',
'src/moThread.cpp',
'src/moUtils.cpp',
'src/modules/moAmplifyModule.cpp',
'src/modules/moBackgroundSubtractModule.cpp',
'src/modules/moBinaryMaskModule.cpp',
'src/modules/moBlobFinderModule.cpp',
'src/modules/moCalibrationModule.cpp',
'src/modules/moCameraModule.cpp',
'src/modules/moCannyModule.cpp',
'src/modules/moCombineModule.cpp',
'src/modules/moDilateModule.cpp',
'src/modules/moDistanceTransformModule.cpp',
'src/modules/moDumpModule.cpp',
'src/modules/moErodeModule.cpp',
'src/modules/moEqualizeHistModule.cpp',
'src/modules/moFiducialFinderModule.cpp',
'src/modules/moFingerTipFinderModule.cpp',
'src/modules/moGreedyBlobTrackerModule.cpp',
'src/modules/moMunkresBlobTrackerModule.cpp',
'src/modules/moAbstractBlobTrackerModule.cpp',
'src/modules/moGrayScaleModule.cpp',
'src/modules/moHighpassModule.cpp',
'src/modules/moHsvModule.cpp',
'src/modules/moHuObjectFinderModule.cpp',
'src/modules/moImageDisplayModule.cpp',
'src/modules/moImageFilterModule.cpp',
'src/modules/moImageModule.cpp',
'src/modules/moInvertModule.cpp',
'src/modules/moJustifyModule.cpp',
'src/modules/moMaskModule.cpp',
'src/modules/moMirrorImageModule.cpp',
'src/modules/moPeakFinderModule.cpp',
'src/modules/moRoiModule.cpp',
'src/modules/moSmoothModule.cpp',
'src/modules/moThresholdModule.cpp',
'src/modules/moTuioModule.cpp',
'src/modules/moTuio2Module.cpp',
'src/modules/moVideoModule.cpp',
'src/modules/moYCrCbThresholdModule.cpp',
'contrib/bitmap_munkres/match.c'
]
#################################################################
# 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('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')
#OpenCV, must config manually on windowze :/
opencv_dir = ARGUMENTS.get('OPENCV_DIR', 'C:\OpenCV2.2')
env.Append(
LIBS = ['opencv_legacy220', 'opencv_imgproc220', 'opencv_core220', 'opencv_highgui220'],
LIBPATH = [opencv_dir+'\lib'],
CPPPATH = [opencv_dir+'\include\opencv', opencv_dir+'\include'])
#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:
#add OpenCV flags and libs
env.ParseConfig('pkg-config --cflags --libs opencv') #gotta love unix :P
#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 libmovid and movid daemon
#################################################################
libmovid = env.Library('libmovid', libmovid_src )
env.Program('movid', daemon_src + [libmovid])