1
1
EnsureSConsVersion (2 , 3 , 0 )
2
2
3
3
import os
4
+ import sys
4
5
import ConfigParser
5
6
6
7
config = ConfigParser .RawConfigParser ()
7
8
8
9
config .read ( [
9
- 'scons.cfg' ,
10
+ 'scons.cfg' ,
10
11
] )
11
12
12
13
icommonInclude = []
@@ -16,24 +17,24 @@ installPrefix = "/usr/local"
16
17
splitChar = ";"
17
18
18
19
if config .has_section ( 'COMMON' ):
19
- if ( config .has_option ( 'COMMON' , 'inc' ) ):
20
- commonInclude .append ( config .get ( 'COMMON' , 'inc' ).split ( splitChar ) )
21
- if ( config .has_option ( 'COMMON' , 'libdir' ) ):
22
- commonLibDir .append ( config .get ( 'COMMON' , 'libdir' ).split ( splitChar ) )
23
- if ( config .has_option ( 'COMMON' , 'prefix' ) ):
24
- installPrefix = config .get ( 'COMMON' , 'prefix' )
20
+ if ( config .has_option ( 'COMMON' , 'inc' ) ):
21
+ commonInclude .append ( config .get ( 'COMMON' , 'inc' ).split ( splitChar ) )
22
+ if ( config .has_option ( 'COMMON' , 'libdir' ) ):
23
+ commonLibDir .append ( config .get ( 'COMMON' , 'libdir' ).split ( splitChar ) )
24
+ if ( config .has_option ( 'COMMON' , 'prefix' ) ):
25
+ installPrefix = config .get ( 'COMMON' , 'prefix' )
25
26
26
27
if not config .has_section ( 'LIBAV' ):
27
- print "missing LIBAV section in scons.cfg file configuration"
28
- sys .exit ( - 1 )
28
+ print "missing LIBAV section in scons.cfg file configuration"
29
+ sys .exit ( - 1 )
29
30
30
31
if not config .has_section ( 'JAVA' ):
31
- print "missing JAVA section in scons.cfg file configuration"
32
- sys .exit ( - 1 )
32
+ print "missing JAVA section in scons.cfg file configuration"
33
+ sys .exit ( - 1 )
33
34
34
35
if not config .has_section ( 'PYTHON' ):
35
- print "missing PYTHON section in scons.cfg file configuration"
36
- sys .exit ( - 1 )
36
+ print "missing PYTHON section in scons.cfg file configuration"
37
+ sys .exit ( - 1 )
37
38
38
39
39
40
javaInclude = config .get ( 'JAVA' , 'inc' ).split ( splitChar )
@@ -45,77 +46,101 @@ env = Environment().Clone()
45
46
envJava = Environment ().Clone ()
46
47
envPy = Environment ().Clone ()
47
48
48
- # C++ environment
49
+ conf = Configure ( env )
50
+
51
+ resampleLibraryFlag = '-DAV_RESAMPLE_LIBRARY'
52
+ resampleLibraryName = 'avresample'
53
+
54
+ if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c' ):
55
+ sys .exit ( 0 )
56
+
57
+ if not conf .CheckLibWithHeader ('avformat' , 'libavformat/avformat.h' , 'c' ):
58
+ sys .exit ( 0 )
49
59
60
+ if not conf .CheckLibWithHeader ('avcodec' , 'libavcodec/avcodec.h' , 'c' ):
61
+ sys .exit ( 0 )
62
+
63
+ if not conf .CheckLibWithHeader ('swscale' , 'libswscale/swscale.h' , 'c' ):
64
+ sys .exit ( 0 )
65
+
66
+ if not conf .CheckLibWithHeader ('avresample' , 'libavresample/avresample.h' , 'c' ):
67
+ if conf .CheckLibWithHeader ('swresample' , 'libswresample/swresample.h' , 'c' ):
68
+ resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
69
+ resampleLibraryName = 'swresample'
70
+
71
+ # C++ environment
50
72
env .Append (
51
- CPPPATH = [
52
- libavInclude ,
53
- "#src" ,
54
- ],
55
- CXXFLAGS = [
56
- '-Wall' ,
57
- '-fPIC' ,
58
- ],
59
- LIBPATH = [
60
- libavLibDir ,
61
- "#src" ,
62
- "#build/src"
63
- ],
73
+ CPPPATH = [
74
+ libavInclude ,
75
+ "#src" ,
76
+ ],
77
+ CXXFLAGS = [
78
+ '-Wall' ,
79
+ '-fPIC' ,
80
+ resampleLibraryFlag ,
81
+ ],
82
+ LIBPATH = [
83
+ libavLibDir ,
84
+ "#src" ,
85
+ "#build/src"
86
+ ],
64
87
)
65
88
66
89
# Java environment
67
90
envJava .Replace (
68
- CPPPATH = [
69
- javaInclude ,
70
- libavInclude ,
71
- "." ,
72
- ],
73
- SWIGCXXFILESUFFIX = '_wrapJava$CXXFILESUFFIX' ,
74
- CXXFLAGS = [
75
- '-Wall' ,
76
- ],
77
- SWIGFLAGS = [
78
- '-java' ,
79
- '-c++' ,
80
- '-fcompact' ,
81
- ],
82
- LINKFLAGS = [
83
- ],
84
- LIBPATH = [
85
- libavLibDir ,
86
- "#src" ,
87
- ],
88
- JARCHDIR = env .Dir ('#build/src/AvTranscoder' ).get_abspath (),
91
+ CPPPATH = [
92
+ javaInclude ,
93
+ libavInclude ,
94
+ "." ,
95
+ ],
96
+ SWIGCXXFILESUFFIX = '_wrapJava$CXXFILESUFFIX' ,
97
+ CXXFLAGS = [
98
+ '-Wall' ,
99
+ resampleLibraryFlag ,
100
+ ],
101
+ SWIGFLAGS = [
102
+ '-java' ,
103
+ '-c++' ,
104
+ '-fcompact' ,
105
+ ],
106
+ LINKFLAGS = [
107
+ ],
108
+ LIBPATH = [
109
+ libavLibDir ,
110
+ "#src" ,
111
+ ],
112
+ JARCHDIR = env .Dir ('#build/src/AvTranscoder' ).get_abspath (),
89
113
)
90
114
91
115
envJava .Append (
92
- SWIGPATH = envJava ['CPPPATH' ],
93
- SWIGFLAGS = [ '-package' , 'org.AvTranscoder' ],
94
- )
116
+ SWIGPATH = envJava ['CPPPATH' ],
117
+ SWIGFLAGS = [ '-package' , 'org.AvTranscoder' ],
118
+ )
95
119
96
120
# Python environment
97
121
envPy .Replace (
98
- CPPPATH = [
99
- pyInclude ,
100
- libavInclude ,
101
- "." ,
102
- ],
103
- SWIGCXXFILESUFFIX = '_wrapPython$CXXFILESUFFIX' ,
104
- SHLIBPREFIX = '_' ,
105
- CXXFLAGS = [
106
- '-Wall' ,
107
- ],
108
- SWIGFLAGS = [
109
- '-python' ,
110
- '-c++' ,
111
- '-fcompact' ,
112
- ],
113
- LINKFLAGS = [
114
- ],
115
- LIBPATH = [
116
- libavLibDir ,
117
- "#src" ,
118
- ],
122
+ CPPPATH = [
123
+ pyInclude ,
124
+ libavInclude ,
125
+ "." ,
126
+ ],
127
+ SWIGCXXFILESUFFIX = '_wrapPython$CXXFILESUFFIX' ,
128
+ SHLIBPREFIX = '_' ,
129
+ CXXFLAGS = [
130
+ '-Wall' ,
131
+ resampleLibraryFlag ,
132
+ ],
133
+ SWIGFLAGS = [
134
+ '-python' ,
135
+ '-c++' ,
136
+ '-fcompact' ,
137
+ ],
138
+ LINKFLAGS = [
139
+ ],
140
+ LIBPATH = [
141
+ libavLibDir ,
142
+ "#src" ,
143
+ ],
119
144
)
120
145
121
146
envPy .Append ( SWIGPATH = envPy ['CPPPATH' ] )
@@ -124,11 +149,12 @@ Export( "env" )
124
149
Export ( "envJava" )
125
150
Export ( "envPy" )
126
151
Export ( "installPrefix" )
152
+ Export ( "resampleLibraryName" )
127
153
128
154
VariantDir ( 'build/src' , 'src' , duplicate = 0 )
129
155
VariantDir ( 'build/app' , 'app' , duplicate = 0 )
130
156
131
157
SConscript ( [
132
- 'build/src/SConscript' ,
133
- 'build/app/SConscript' ,
158
+ 'build/src/SConscript' ,
159
+ 'build/app/SConscript' ,
134
160
] )
0 commit comments