automatic multiprocessor builds, fix compilation when COLLADA is missing

metadata
Wenzel Jakob 2010-09-05 17:09:06 +02:00
parent 3d3048f7de
commit debd09e75f
3 changed files with 25 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import sys
import glob import glob
import os import os
import fnmatch import fnmatch
import multiprocessing
if not os.path.exists('config.py'): if not os.path.exists('config.py'):
print 'A configuration file must be selected! Have a look at \"README\"' print 'A configuration file must be selected! Have a look at \"README\"'
@ -66,6 +67,10 @@ if env.has_key('BOOSTINCLUDE'):
if env.has_key('BASELIBDIR'): if env.has_key('BASELIBDIR'):
env.Append(LIBPATH=env['BASELIBDIR']) env.Append(LIBPATH=env['BASELIBDIR'])
env.Decider('MD5-timestamp')
env.SetOption('num_jobs', multiprocessing.cpu_count())
AddOption("--dist", dest="dist", type="string", nargs=0, action='store', help='Make an official release') AddOption("--dist", dest="dist", type="string", nargs=0, action='store', help='Make an official release')
# Check whether everything important is available # Check whether everything important is available
@ -205,6 +210,9 @@ def osxlibinst_build_function(self, target, source, pkgname = None, use_own = No
env.__class__.StripInst = stripinst_build_function env.__class__.StripInst = stripinst_build_function
env.__class__.OSXLibInst = osxlibinst_build_function env.__class__.OSXLibInst = osxlibinst_build_function
if hasCollada:
env.Append(CPPDEFINES = [['MTS_HAS_COLLADA', 1]] )
env.SConsignFile() env.SConsignFile()
# MSVC: Embed the manifest # MSVC: Embed the manifest
@ -240,7 +248,7 @@ if coreEnv.has_key('JPEGINCLUDE'):
if coreEnv.has_key('JPEGLIB'): if coreEnv.has_key('JPEGLIB'):
coreEnv.Append(LIBS=env['JPEGLIB']) coreEnv.Append(LIBS=env['JPEGLIB'])
coreEnv.Append(CPPDEFINES = {'MTS_BUILD_MODULE' : 'MTS_MODULE_CORE'} ) coreEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_CORE']])
libcore_objects = [ libcore_objects = [
'src/libcore/class.cpp', 'src/libcore/object.cpp', 'src/libcore/class.cpp', 'src/libcore/object.cpp',
'src/libcore/statistics.cpp', 'src/libcore/thread.cpp', 'src/libcore/statistics.cpp', 'src/libcore/thread.cpp',
@ -276,7 +284,7 @@ env.Append(LIBPATH=['src/libcore'])
# Rendering-specific library # Rendering-specific library
renderEnv = env.Clone() renderEnv = env.Clone()
renderEnv.Append(CPPDEFINES = {'MTS_BUILD_MODULE' : 'MTS_MODULE_RENDER'} ) renderEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_RENDER']] )
if renderEnv.has_key('XERCESINCLUDE'): if renderEnv.has_key('XERCESINCLUDE'):
renderEnv.Append(CPPPATH=renderEnv['XERCESINCLUDE']) renderEnv.Append(CPPPATH=renderEnv['XERCESINCLUDE'])
if renderEnv.has_key('XERCESLIBDIR'): if renderEnv.has_key('XERCESLIBDIR'):
@ -330,7 +338,7 @@ elif sys.platform == 'linux2':
'src/libhw/glxrenderer.cpp'] 'src/libhw/glxrenderer.cpp']
glEnv = env.Clone() glEnv = env.Clone()
glEnv.Append(CPPDEFINES = {'MTS_BUILD_MODULE' : 'MTS_MODULE_HW'} ) glEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_HW']] )
if glEnv.has_key('GLLIB'): if glEnv.has_key('GLLIB'):
glEnv.Append(LIBS=glEnv['GLLIB']) glEnv.Append(LIBS=glEnv['GLLIB'])
if glEnv.has_key('GLLIBDIR'): if glEnv.has_key('GLLIBDIR'):
@ -423,6 +431,7 @@ if hasQt:
qtEnv = mainEnv.Clone() qtEnv = mainEnv.Clone()
qtEnv.Append(CPPPATH=['src/qtgui']) qtEnv.Append(CPPPATH=['src/qtgui'])
qtEnv.EnableQt4Modules(['QtGui', 'QtCore', 'QtOpenGL', 'QtXml', 'QtNetwork']) qtEnv.EnableQt4Modules(['QtGui', 'QtCore', 'QtOpenGL', 'QtXml', 'QtNetwork'])
print(qtEnv.Dump())
if sys.platform == 'win32': if sys.platform == 'win32':
index = qtEnv['CXXFLAGS'].index('_CONSOLE') index = qtEnv['CXXFLAGS'].index('_CONSOLE')
del qtEnv['CXXFLAGS'][index-1] del qtEnv['CXXFLAGS'][index-1]
@ -449,6 +458,7 @@ if hasQt:
if sys.platform == 'darwin': if sys.platform == 'darwin':
qtEnv_osx = qtEnv.Clone(); qtEnv_osx = qtEnv.Clone();
# Objective C++ does not permit the following optimization flags
qtEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing'); qtEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing');
qtEnv_osx['CXXFLAGS'].remove('-ftree-vectorize'); qtEnv_osx['CXXFLAGS'].remove('-ftree-vectorize');
qtEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing'); qtEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing');

View File

@ -443,6 +443,7 @@ void MainWindow::onBugReportSubmitted() {
} }
void MainWindow::on_actionImport_triggered() { void MainWindow::on_actionImport_triggered() {
#if defined(MTS_HAS_COLLADA)
ref<FileResolver> resolver = FileResolver::getInstance(); ref<FileResolver> resolver = FileResolver::getInstance();
ref<FileResolver> newResolver = resolver->clone(); ref<FileResolver> newResolver = resolver->clone();
for (int i=0; i<m_searchPaths.size(); ++i) for (int i=0; i<m_searchPaths.size(); ++i)
@ -457,6 +458,13 @@ void MainWindow::on_actionImport_triggered() {
dialog->show(); dialog->show();
qApp->processEvents(); qApp->processEvents();
m_activeWindowHack = false; m_activeWindowHack = false;
#else
QMessageBox::critical(this, tr("Importer disabled"),
tr("The importer is disabled in this build. To use it, you will need "
"to install COLLADA-DOM and recompile Mitsuba -- please see the "
"documentation for more details."),
QMessageBox::Ok);
#endif
} }
void MainWindow::onImportDialogClose(int reason) { void MainWindow::onImportDialogClose(int reason) {

View File

@ -52,6 +52,7 @@ SceneImporter::~SceneImporter() {
void SceneImporter::run() { void SceneImporter::run() {
FileResolver::setInstance(m_resolver); FileResolver::setInstance(m_resolver);
#if defined(MTS_HAS_COLLADA)
try { try {
GUIGeometryConverter cvt(m_parent); GUIGeometryConverter cvt(m_parent);
cvt.setSRGB(m_srgb); cvt.setSRGB(m_srgb);
@ -62,6 +63,9 @@ void SceneImporter::run() {
} catch (...) { } catch (...) {
SLog(EWarn, "An unknown type of error occurred!"); SLog(EWarn, "An unknown type of error occurred!");
} }
#else
SLog(EWarn, "The importer was disabled in this build!");
#endif
m_wait->set(true); m_wait->set(true);
} }