1
+ from __future__ import print_function
1
2
import re, multiprocessing
2
3
3
4
Import('sys', 'os', 'SCons', 'resources')
@@ -20,14 +21,14 @@ if parallelize == True:
20
21
SetOption('num_jobs', multiprocessing.cpu_count())
21
22
22
23
if not os.path.exists(configFile):
23
- print '\nA configuration file must be selected! Have a look at http://www.mitsuba-renderer.org/docs.html'
24
+ print( '\nA configuration file must be selected! Have a look at http://www.mitsuba-renderer.org/docs.html')
24
25
Exit(1)
25
26
26
27
needsBuildDependencies = (sys.platform == 'win32' or sys.platform == 'darwin')
27
28
28
29
if needsBuildDependencies and not os.path.exists(GetBuildPath('#dependencies')):
29
- print '\nThe required build dependency files are missing. Please see the documentation'
30
- print 'at http://www.mitsuba-renderer.org/docs.html for details on how to get them.\n'
30
+ print( '\nThe required build dependency files are missing. Please see the documentation')
31
+ print( 'at http://www.mitsuba-renderer.org/docs.html for details on how to get them.\n')
31
32
Exit(1)
32
33
33
34
python_versions = ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"]
@@ -94,11 +95,11 @@ vars.Add('INTEL_COMPILER', 'Should the Intel C++ compiler be used?')
94
95
95
96
try:
96
97
env = Environment(options=vars, ENV = os.environ, tools=['default', 'qt5'], toolpath=['#data/scons'])
97
- print 'Checking for Qt 5.x... yes'
98
+ print( 'Checking for Qt 5.x... yes')
98
99
hasQt = True
99
100
except Exception:
100
101
env = Environment(options=vars, ENV = os.environ, tools=['default'], toolpath=['#data/scons'])
101
- print 'Unable to detect a Qt installation -- not building the GUI!'
102
+ print( 'Unable to detect a Qt installation -- not building the GUI!')
102
103
hasQt = False
103
104
104
105
hasCollada=True
@@ -108,19 +109,19 @@ env.Append(CPPPATH=env['BASEINCLUDE'])
108
109
env.Append(CPPFLAGS=[])
109
110
env.Append(LIBPATH=[])
110
111
env.Append(LIBS=env['BASELIB'])
111
- if env.has_key( 'BOOSTINCLUDE') :
112
+ if 'BOOSTINCLUDE' in env :
112
113
env.Prepend(CPPPATH=env['BOOSTINCLUDE'])
113
- if env.has_key( 'BOOSTLIBDIR') :
114
+ if 'BOOSTLIBDIR' in env :
114
115
env.Prepend(LIBPATH=env['BOOSTLIBDIR'])
115
- if env.has_key( 'BOOSTLIB') :
116
+ if 'BOOSTLIB' in env :
116
117
env.Prepend(LIBS=env['BOOSTLIB'])
117
- if env.has_key( 'BASELIBDIR') :
118
+ if 'BASELIBDIR' in env :
118
119
env.Append(LIBPATH=env['BASELIBDIR'])
119
- if env.has_key( 'OEXRINCLUDE') :
120
+ if 'OEXRINCLUDE' in env :
120
121
env.Prepend(CPPPATH=env['OEXRINCLUDE'])
121
- if env.has_key( 'OEXRLIBDIR') :
122
+ if 'OEXRLIBDIR' in env :
122
123
env.Prepend(LIBPATH=env['OEXRLIBDIR'])
123
- if env.has_key( 'EIGENINCLUDE') :
124
+ if 'EIGENINCLUDE' in env :
124
125
env.Prepend(CPPPATH=env['EIGENINCLUDE'])
125
126
126
127
env.Decider('MD5-timestamp')
@@ -140,64 +141,64 @@ libPathPrevious = SCons.Util.semi_deepcopy(env['LIBPATH'])
140
141
cppFlagsPrevious = SCons.Util.semi_deepcopy(env['CPPFLAGS'])
141
142
cxxFlagsPrevious = SCons.Util.semi_deepcopy(env['CXXFLAGS'])
142
143
143
- if env.has_key( 'PNGINCLUDE') :
144
+ if 'PNGINCLUDE' in env :
144
145
env.Prepend(CPPPATH=env['PNGINCLUDE'])
145
- if env.has_key( 'PNGLIBDIR') :
146
+ if 'PNGLIBDIR' in env :
146
147
env.Prepend(LIBPATH=env['PNGLIBDIR'])
147
- if env.has_key( 'JPEGINCLUDE') :
148
+ if 'JPEGINCLUDE' in env :
148
149
env.Prepend(CPPPATH=env['JPEGINCLUDE'])
149
- if env.has_key( 'JPEGLIBDIR') :
150
+ if 'JPEGLIBDIR' in env :
150
151
env.Prepend(LIBPATH=env['JPEGLIBDIR'])
151
- if env.has_key( 'OEXRFLAGS') :
152
+ if 'OEXRFLAGS' in env :
152
153
env.Prepend(CPPFLAGS=env['OEXRFLAGS'])
153
- if env.has_key( 'OEXRINCLUDE') :
154
+ if 'OEXRINCLUDE' in env :
154
155
env.Prepend(CPPPATH=env['OEXRINCLUDE'])
155
- if env.has_key( 'OEXRLIBDIR') :
156
+ if 'OEXRLIBDIR' in env :
156
157
env.Prepend(LIBPATH=env['OEXRLIBDIR'])
157
- if env.has_key( 'XERCESINCLUDE') :
158
+ if 'XERCESINCLUDE' in env :
158
159
env.Prepend(CPPPATH=env['XERCESINCLUDE'])
159
- if env.has_key( 'XERCESLIBDIR') :
160
+ if 'XERCESLIBDIR' in env :
160
161
env.Prepend(LIBPATH=env['XERCESLIBDIR'])
161
- if env.has_key( 'GLINCLUDE') :
162
+ if 'GLINCLUDE' in env :
162
163
env.Prepend(CPPPATH=env['GLINCLUDE'])
163
- if env.has_key( 'GLFLAGS') :
164
+ if 'GLFLAGS' in env :
164
165
env.Prepend(CPPFLAGS=env['GLFLAGS'])
165
- if env.has_key( 'COLLADAINCLUDE') :
166
+ if 'COLLADAINCLUDE' in env :
166
167
env.Prepend(CPPPATH=env['COLLADAINCLUDE'])
167
- if env.has_key( 'COLLADALIBDIR') :
168
+ if 'COLLADALIBDIR' in env :
168
169
env.Prepend(LIBPATH=env['COLLADALIBDIR'])
169
- if env.has_key( 'FFTWINCLUDE') :
170
+ if 'FFTWINCLUDE' in env :
170
171
env.Prepend(CPPPATH=env['FFTWINCLUDE'])
171
- if env.has_key( 'FFTWLIBDIR') :
172
+ if 'FFTWLIBDIR' in env :
172
173
env.Prepend(LIBPATH=env['FFTWLIBDIR'])
173
174
174
175
if not conf.CheckCXX():
175
- print 'Could not compile a simple C++ fragment, verify that ' + \
176
+ print( 'Could not compile a simple C++ fragment, verify that ' + \
176
177
env['CXX'] + ' is installed! This could also mean that the ' + \
177
178
'Boost libraries are missing. The file "config.log" should ' + \
178
- 'contain more information.'
179
+ 'contain more information.')
179
180
Exit(1)
180
181
if not conf.CheckCHeader(['png.h']):
181
- print 'libpng is missing (install libpng12-dev for PNG I/O support)'
182
+ print( 'libpng is missing (install libpng12-dev for PNG I/O support)')
182
183
else:
183
184
env.Append(CPPDEFINES = [['MTS_HAS_LIBPNG', 1]] )
184
185
185
186
if not conf.CheckCHeader(['stdio.h', 'jpeglib.h']):
186
- print 'libjpeg is missing (install libjpeg62-dev for JPEG I/O support)'
187
+ print( 'libjpeg is missing (install libjpeg62-dev for JPEG I/O support)')
187
188
else:
188
189
env.Append(CPPDEFINES = [['MTS_HAS_LIBJPEG', 1]] )
189
190
190
191
if not conf.CheckCXXHeader('ImfRgba.h'):
191
- print 'OpenEXR is missing (install libopenexr-dev for OpenEXR I/O support)'
192
+ print( 'OpenEXR is missing (install libopenexr-dev for OpenEXR I/O support)')
192
193
else:
193
194
env.Append(CPPDEFINES = [['MTS_HAS_OPENEXR', 1]] )
194
195
195
196
if not conf.CheckCXXHeader('xercesc/dom/DOMLSParser.hpp'):
196
- print 'Xerces-C++ 3.x must be installed (install libxerces-c-dev)!'
197
+ print( 'Xerces-C++ 3.x must be installed (install libxerces-c-dev)!')
197
198
Exit(1)
198
199
if not conf.CheckCXXHeader('dae.h'):
199
200
hasCollada = False
200
- print 'COLLADA DOM is missing: not building the COLLADA importer'
201
+ print( 'COLLADA DOM is missing: not building the COLLADA importer')
201
202
202
203
hasBreakpad = '-DMTS_HAS_BREAKPAD' in env['CCFLAGS'] or 'MTS_HAS_BREAKPAD' in env['CXXFLAGS']
203
204
@@ -211,54 +212,54 @@ for ver in python_versions:
211
212
if conf.CheckCXXHeader('pyconfig.h'):
212
213
hasPython += [ ver ]
213
214
else:
214
- print 'Python ' + ver + ' is missing: not building wrappers'
215
+ print( 'Python ' + ver + ' is missing: not building wrappers')
215
216
env['CPPPATH'][:] = [ x for x in env['CPPPATH'] if x not in includePath ]
216
217
217
218
if not conf.CheckCXXHeader('boost/version.hpp'):
218
- print 'Boost is missing (install libboost-all-dev)!'
219
+ print( 'Boost is missing (install libboost-all-dev)!')
219
220
Exit(1)
220
221
if not conf.TryCompile("#include <boost/version.hpp>\n#if BOOST_VERSION < 104400\n#error Boost is outdated!\n#endif", ".cpp"):
221
- print 'Boost is outdated (you will need version 1.44 or newer)!'
222
+ print( 'Boost is outdated (you will need version 1.44 or newer)!')
222
223
Exit(1)
223
224
if not conf.CheckCXXHeader('Eigen/Core'):
224
- print 'Eigen 3.x is missing (install libeigen3-dev)!'
225
+ print( 'Eigen 3.x is missing (install libeigen3-dev)!')
225
226
Exit(1)
226
227
if not conf.CheckCXXHeader('fftw3.h'):
227
- print 'FFTW3 not found (install for fast image convolution support)'
228
+ print( 'FFTW3 not found (install for fast image convolution support)')
228
229
else:
229
230
env.Append(CPPDEFINES = [['MTS_HAS_FFTW', 1]] )
230
231
if sys.platform == 'win32':
231
232
if not (conf.CheckCHeader(['windows.h', 'GL/gl.h']) \
232
233
and conf.CheckCHeader(['windows.h', 'GL/glu.h']) \
233
234
and conf.CheckCHeader(['windows.h', 'GL/gl.h', 'GL/glext.h'])):
234
- print 'OpenGL headers are missing!'
235
+ print( 'OpenGL headers are missing!')
235
236
Exit(1)
236
237
if not conf.CheckCHeader('GL/glew.h'):
237
- print 'GLEW headers are missing!'
238
+ print( 'GLEW headers are missing!')
238
239
Exit(1)
239
240
elif sys.platform == 'linux2':
240
241
if not (conf.CheckCHeader('GL/gl.h') and conf.CheckCHeader('GL/glu.h') and conf.CheckCHeader(['GL/gl.h', 'GL/glext.h'])):
241
- print 'OpenGL headers are missing!'
242
+ print( 'OpenGL headers are missing!')
242
243
Exit(1)
243
244
if not conf.CheckCHeader('GL/glew.h'):
244
- print 'GLEW headers are missing (install libglewmx1.5-dev)!'
245
+ print( 'GLEW headers are missing (install libglewmx1.5-dev)!')
245
246
Exit(1)
246
247
if not conf.CheckType('GLEWContext', '#include <GL/glew.h>'):
247
- print 'GLEW-MX must be present!'
248
+ print( 'GLEW-MX must be present!')
248
249
Exit(1)
249
250
if not conf.TryCompile("#include <GL/glew.h>\n int i = GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV;", '.cpp'):
250
- print 'Your version of GLEW-MX seems to be outdated!'
251
+ print( 'Your version of GLEW-MX seems to be outdated!')
251
252
Exit(1)
252
253
elif sys.platform == 'darwin':
253
254
if not (conf.CheckCHeader('OpenGL/gl.h') and conf.CheckCHeader('OpenGL/glu.h') and conf.CheckCHeader(['OpenGL/gl.h', 'OpenGL/glext.h'])):
254
- print 'OpenGL headers are missing!'
255
+ print( 'OpenGL headers are missing!')
255
256
Exit(1)
256
257
if not conf.CheckCHeader('OpenGL/glew.h'):
257
- print 'GLEW headers are missing!'
258
+ print( 'GLEW headers are missing!')
258
259
Exit(1)
259
260
if sys.platform == 'linux2':
260
261
if not (conf.CheckCHeader(['X11/Xlib.h', 'X11/extensions/xf86vmode.h'])):
261
- print 'X Video Mode selection library headers are missing! (Install libxxf86vm-dev)'
262
+ print( 'X Video Mode selection library headers are missing! (Install libxxf86vm-dev)')
262
263
Exit(1)
263
264
264
265
env.Replace(CPPPATH=cppPathPrevious)
@@ -273,10 +274,10 @@ for line in file:
273
274
if line.startswith("#define MTS_VERSION "):
274
275
MTS_VERSION = line[21:len(line)-2]
275
276
if MTS_VERSION == "":
276
- print 'could not be determined!'
277
+ print( 'could not be determined!')
277
278
Exit(1)
278
279
else:
279
- print MTS_VERSION
280
+ print( MTS_VERSION)
280
281
Export('MTS_VERSION')
281
282
282
283
if needsBuildDependencies:
@@ -293,14 +294,14 @@ if needsBuildDependencies:
293
294
versionMismatch = True
294
295
295
296
if versionMismatch:
296
- print '\nThe dependency directory and your Mitsuba codebase have different version'
297
- print 'numbers! Your copy of Mitsuba has version %s, whereas the dependencies ' % MTS_VERSION
298
- print 'have version %s. Please bring them into sync, either by running\n' % depVersion
299
- print '$ hg update -r v%s\n' % depVersion
300
- print 'in the Mitsuba directory, or by running\n'
301
- print '$ cd dependencies'
302
- print '$ hg pull'
303
- print '$ hg update -r v%s\n' % MTS_VERSION
297
+ print( '\nThe dependency directory and your Mitsuba codebase have different version')
298
+ print( 'numbers! Your copy of Mitsuba has version %s, whereas the dependencies ' % MTS_VERSION)
299
+ print( 'have version %s. Please bring them into sync, either by running\n' % depVersion)
300
+ print( '$ hg update -r v%s\n' % depVersion)
301
+ print( 'in the Mitsuba directory, or by running\n')
302
+ print( '$ cd dependencies')
303
+ print( '$ hg pull')
304
+ print( '$ hg update -r v%s\n' % MTS_VERSION)
304
305
Exit(1)
305
306
306
307
env = conf.Finish()
0 commit comments