@@ -48,9 +48,7 @@ pyInclude = config.get( 'PYTHON', 'inc' ).split( splitChar )
48
48
libavInclude = config .get ( 'LIBAV' , 'inc' ).split ( splitChar )
49
49
libavLibDir = config .get ( 'LIBAV' , 'libdir' ).split ( splitChar )
50
50
51
- env = Environment ().Clone ()
52
- envJava = Environment ().Clone ()
53
- envPy = Environment ().Clone ()
51
+ env = Environment ( ENV = { 'PATH' : os .environ [ 'PATH' ] } )
54
52
55
53
# C++ environment
56
54
env .Append (
@@ -69,8 +67,37 @@ env.Append(
69
67
] + commonLibDir ,
70
68
)
71
69
70
+ if os .name == "nt" and sys .platform .startswith ("win" ): # detect windows plateform
71
+ env .AppendUnique ( CPPDEFINES = 'WIN' )
72
+ env .AppendUnique ( CPPDEFINES = 'WIN32' )
73
+ env .AppendUnique ( CPPDEFINES = 'WINDOWS' )
74
+ env .AppendUnique ( CPPDEFINES = '_WINDOWS' )
75
+ env .AppendUnique ( CPPDEFINES = '__WINDOWS__' )
76
+ env .AppendUnique ( CPPDEFINES = '__STDC_CONSTANT_MACROS' )
77
+ bits = 64
78
+ if 'PROGRAMFILES(X86)' not in os .environ :
79
+ bits = 32
80
+ env .AppendUnique ( CPPDEFINES = 'WIN' + str (bits ) )
81
+ env .AppendUnique ( TMP = os .environ ['TMP' ].split ( splitChar ) )
82
+
83
+ if 'LIB' not in os .environ or 'LIBPATH' not in os .environ :
84
+ print "Compiler environment not set."
85
+ sys .exit ( - 1 )
86
+ env .AppendUnique ( LIB = os .environ ['LIB' ].split ( splitChar ) )
87
+ env .AppendUnique ( LIBPATH = os .environ ['LIBPATH' ].split ( splitChar ) )
88
+ env .AppendUnique ( TMP = os .environ ['TMP' ].split ( splitChar ) )
89
+ else :
90
+ env .AppendUnique ( CPPDEFINES = 'UNIX' )
91
+ env .AppendUnique ( CPPDEFINES = '__UNIX__' )
92
+ env .AppendUnique ( CXXFLAGS = '-fPIC' ),
93
+ if sys .platform .startswith ( "darwin" ): # for disabling macros such as check, verify, require ... ( AssertMacros.h )
94
+ env .AppendUnique ( CPPDEFINES = '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0' )
95
+
96
+ envJava = Environment ().Clone ()
97
+ envPy = Environment ().Clone ()
98
+
72
99
# Java environment
73
- envJava .Replace (
100
+ envJava .AppendUnique (
74
101
CPPPATH = [
75
102
javaInclude ,
76
103
libavInclude ,
@@ -93,11 +120,10 @@ envJava.Replace(
93
120
],
94
121
JARCHDIR = env .Dir ('#build/' + mymode + '/src/AvTranscoder' ).get_abspath (),
95
122
)
96
-
97
123
envJava .Append (
98
124
SWIGPATH = envJava ['CPPPATH' ],
99
125
SWIGFLAGS = [ '-package' , 'org.AvTranscoder' ],
100
- )
126
+ )
101
127
102
128
# Python environment
103
129
envPy .Replace (
@@ -123,31 +149,47 @@ envPy.Replace(
123
149
"#src" ,
124
150
],
125
151
)
126
-
127
152
envPy .Append ( SWIGPATH = envPy ['CPPPATH' ] )
128
153
129
154
conf = Configure ( env )
130
155
131
156
resampleLibraryFlag = '-DAV_RESAMPLE_LIBRARY'
132
157
resampleLibraryName = 'avresample'
133
158
134
- if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c' ):
135
- sys .exit ( 0 )
159
+ if os .name == "nt" and sys .platform .startswith ("win" ): # detect windows plateform
160
+ if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c++' ):
161
+ sys .exit ( - 1 )
162
+
163
+ if not conf .CheckLibWithHeader ('avcodec' , 'libavcodec/avcodec.h' , 'c++' ):
164
+ sys .exit ( - 1 )
165
+
166
+ if not conf .CheckLibWithHeader ('avformat' , 'libavformat/avformat.h' , 'c++' ):
167
+ sys .exit ( - 1 )
168
+
169
+ if not conf .CheckLibWithHeader ('swscale' , 'libswscale/swscale.h' , 'c++' ):
170
+ sys .exit ( - 1 )
136
171
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'
172
+ if not conf .CheckLibWithHeader ('avresample' , 'libavresample/avresample.h' , 'c++' ):
173
+ if conf .CheckLibWithHeader ('swresample' , 'libswresample/swresample.h' , 'c++' ):
174
+ resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
175
+ resampleLibraryName = 'swresample'
176
+ else :
177
+ if not conf .CheckLibWithHeader ('avutil' , 'libavutil/avutil.h' , 'c' ):
178
+ sys .exit ( - 1 )
141
179
142
- if not conf .CheckLibWithHeader ('avcodec' , 'libavcodec/avcodec.h' , 'c' ):
143
- sys .exit ( 0 )
180
+ if not conf .CheckLibWithHeader ('avcodec' , 'libavcodec/avcodec.h' , 'c' ):
181
+ sys .exit ( - 1 )
144
182
145
- if not conf .CheckLibWithHeader ('avformat' , 'libavformat/avformat.h' , 'c' ):
146
- sys .exit ( 0 )
183
+ if not conf .CheckLibWithHeader ('avformat' , 'libavformat/avformat.h' , 'c' ):
184
+ sys .exit ( - 1 )
147
185
148
- if not conf .CheckLibWithHeader ('swscale' , 'libswscale/swscale.h' , 'c' ):
149
- sys .exit ( 0 )
186
+ if not conf .CheckLibWithHeader ('swscale' , 'libswscale/swscale.h' , 'c' ):
187
+ sys .exit ( - 1 )
150
188
189
+ if not conf .CheckLibWithHeader ('avresample' , 'libavresample/avresample.h' , 'c' ):
190
+ if conf .CheckLibWithHeader ('swresample' , 'libswresample/swresample.h' , 'c' ):
191
+ resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
192
+ resampleLibraryName = 'swresample'
151
193
152
194
env .Append (
153
195
CXXFLAGS = resampleLibraryFlag
0 commit comments