@@ -16,7 +16,7 @@ config.read( [
16
16
'scons.cfg' ,
17
17
] )
18
18
19
- icommonInclude = []
19
+ commonInclude = []
20
20
commonLibDir = []
21
21
installPrefix = "/usr/local"
22
22
@@ -44,20 +44,23 @@ if not config.has_section( 'PYTHON' ):
44
44
45
45
46
46
javaInclude = config .get ( 'JAVA' , 'inc' ).split ( splitChar )
47
+
47
48
pyInclude = config .get ( 'PYTHON' , 'inc' ).split ( splitChar )
49
+ pyLibrary = []
50
+ if config .has_option ( 'PYTHON' , 'libdir' ):
51
+ pyLibrary = config .get ( 'PYTHON' , 'libdir' ).split ( splitChar )
52
+
48
53
libavInclude = config .get ( 'LIBAV' , 'inc' ).split ( splitChar )
49
54
libavLibDir = config .get ( 'LIBAV' , 'libdir' ).split ( splitChar )
50
55
51
- env = Environment ().Clone ()
52
- envJava = Environment ().Clone ()
53
- envPy = Environment ().Clone ()
56
+ env = Environment ( ENV = { 'PATH' : os .environ [ 'PATH' ] } )
54
57
55
58
# C++ environment
56
59
env .Append (
57
60
CPPPATH = [
58
61
libavInclude ,
59
62
"#src" ,
60
- ],
63
+ ] + commonInclude ,
61
64
CXXFLAGS = [
62
65
'-Wall' ,
63
66
'-fPIC' ,
@@ -66,88 +69,108 @@ env.Append(
66
69
libavLibDir ,
67
70
"#src" ,
68
71
"#build/src"
69
- ],
72
+ ] + commonLibDir ,
70
73
)
71
74
75
+ if os .name == "nt" and sys .platform .startswith ("win" ): # detect windows plateform
76
+ env .AppendUnique ( CPPDEFINES = 'WIN' )
77
+ env .AppendUnique ( CPPDEFINES = 'WIN32' )
78
+ env .AppendUnique ( CPPDEFINES = 'WINDOWS' )
79
+ env .AppendUnique ( CPPDEFINES = '_WINDOWS' )
80
+ env .AppendUnique ( CPPDEFINES = '__WINDOWS__' )
81
+ env .AppendUnique ( CPPDEFINES = '__STDC_CONSTANT_MACROS' )
82
+ bits = 64
83
+ if 'PROGRAMFILES(X86)' not in os .environ :
84
+ bits = 32
85
+ env .AppendUnique ( CPPDEFINES = 'WIN' + str (bits ) )
86
+ env .AppendUnique ( TMP = os .environ ['TMP' ].split ( splitChar ) )
87
+
88
+ if 'LIB' not in os .environ or 'LIBPATH' not in os .environ :
89
+ print "Compiler environment not set."
90
+ sys .exit ( - 1 )
91
+ env .AppendUnique ( LIB = os .environ ['LIB' ].split ( splitChar ) )
92
+ env .AppendUnique ( LIBPATH = os .environ ['LIBPATH' ].split ( splitChar ) )
93
+ env .AppendUnique ( TMP = os .environ ['TMP' ].split ( splitChar ) )
94
+ else :
95
+ env .AppendUnique ( CPPDEFINES = 'UNIX' )
96
+ env .AppendUnique ( CPPDEFINES = '__UNIX__' )
97
+ if sys .platform .startswith ( "darwin" ): # for disabling macros such as check, verify, require ... ( AssertMacros.h )
98
+ env .AppendUnique ( CPPDEFINES = '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0' )
99
+
100
+ envJava = env .Clone ()
101
+ envPy = env .Clone ()
102
+
72
103
# Java environment
73
104
envJava .Replace (
74
- CPPPATH = [
75
- javaInclude ,
76
- libavInclude ,
77
- "." ,
78
- ],
79
105
SWIGCXXFILESUFFIX = '_wrapJava$CXXFILESUFFIX' ,
80
- CXXFLAGS = [
81
- '-Wall' ,
82
- ],
83
106
SWIGFLAGS = [
84
107
'-java' ,
85
108
'-c++' ,
86
109
'-fcompact' ,
87
110
],
88
- LINKFLAGS = [
89
- ],
90
- LIBPATH = [
91
- libavLibDir ,
92
- "#src" ,
93
- ],
94
- JARCHDIR = env .Dir ('#build/' + mymode + '/src/AvTranscoder' ).get_abspath (),
95
111
)
96
-
97
- envJava . Append (
112
+ envJava . AppendUnique (
113
+ CPPPATH = javaInclude ,
98
114
SWIGPATH = envJava ['CPPPATH' ],
99
115
SWIGFLAGS = [ '-package' , 'org.AvTranscoder' ],
100
- )
116
+ JARCHDIR = env .Dir ('#build/' + mymode + '/src/AvTranscoder' ).get_abspath (),
117
+ )
101
118
102
119
# Python environment
103
120
envPy .Replace (
104
- CPPPATH = [
105
- pyInclude ,
106
- libavInclude ,
107
- "." ,
108
- ],
109
121
SWIGCXXFILESUFFIX = '_wrapPython$CXXFILESUFFIX' ,
110
122
SHLIBPREFIX = '_' ,
111
- CXXFLAGS = [
112
- '-Wall' ,
113
- ],
114
123
SWIGFLAGS = [
115
124
'-python' ,
116
125
'-c++' ,
117
126
'-fcompact' ,
118
127
],
119
- LINKFLAGS = [
120
- ],
121
- LIBPATH = [
122
- libavLibDir ,
123
- "#src" ,
124
- ],
125
128
)
126
-
127
- envPy .Append ( SWIGPATH = envPy ['CPPPATH' ] )
129
+ envPy .AppendUnique (
130
+ CPPPATH = pyInclude ,
131
+ LIBPATH = pyLibrary ,
132
+ SWIGPATH = envPy ['CPPPATH' ]
133
+ )
128
134
129
135
conf = Configure ( env )
130
136
131
137
resampleLibraryFlag = '-DAV_RESAMPLE_LIBRARY'
132
138
resampleLibraryName = 'avresample'
133
139
134
- if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c' ):
135
- sys .exit ( 0 )
140
+ if os .name == "nt" and sys .platform .startswith ("win" ): # detect windows plateform
141
+ if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c++' ):
142
+ sys .exit ( - 1 )
143
+
144
+ if not conf .CheckLibWithHeader ('avcodec' , 'libavcodec/avcodec.h' , 'c++' ):
145
+ sys .exit ( - 1 )
146
+
147
+ if not conf .CheckLibWithHeader ('avformat' , 'libavformat/avformat.h' , 'c++' ):
148
+ sys .exit ( - 1 )
149
+
150
+ if not conf .CheckLibWithHeader ('swscale' , 'libswscale/swscale.h' , 'c++' ):
151
+ sys .exit ( - 1 )
136
152
137
- if not conf .CheckLibWithHeader ('avresample' , 'libavresample/avresample.h' , 'c' ):
138
- if conf .CheckLibWithHeader ('swresample' , 'libswresample/swresample.h' , 'c' ):
139
- resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
140
- resampleLibraryName = 'swresample'
153
+ if not conf .CheckLibWithHeader ('avresample' , 'libavresample/avresample.h' , 'c++' ):
154
+ if conf .CheckLibWithHeader ('swresample' , 'libswresample/swresample.h' , 'c++' ):
155
+ resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
156
+ resampleLibraryName = 'swresample'
157
+ else :
158
+ if not conf .CheckCHeader ('libavutil/avutil.h' ):
159
+ sys .exit ( - 1 )
141
160
142
- if not conf .CheckLibWithHeader ( 'avcodec' , ' libavcodec/avcodec.h' , 'c ' ):
143
- sys .exit ( 0 )
161
+ if not conf .CheckCHeader ( ' libavcodec/avcodec.h' ):
162
+ sys .exit ( - 1 )
144
163
145
- if not conf .CheckLibWithHeader ( 'avformat' , ' libavformat/avformat.h' , 'c ' ):
146
- sys .exit ( 0 )
164
+ if not conf .CheckCHeader ( ' libavformat/avformat.h' ):
165
+ sys .exit ( - 1 )
147
166
148
- if not conf .CheckLibWithHeader ( 'swscale' , ' libswscale/swscale.h' , 'c ' ):
149
- sys .exit ( 0 )
167
+ if not conf .CheckCHeader ( ' libswscale/swscale.h' ):
168
+ sys .exit ( - 1 )
150
169
170
+ if not conf .CheckCHeader ('libavresample/avresample.h' ):
171
+ if conf .CheckCHeader ('libswresample/swresample.h' ):
172
+ resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
173
+ resampleLibraryName = 'swresample'
151
174
152
175
env .Append (
153
176
CXXFLAGS = resampleLibraryFlag
0 commit comments