diff --git a/build/SConscript.configure b/build/SConscript.configure index e42262ff..9a19dc9c 100644 --- a/build/SConscript.configure +++ b/build/SConscript.configure @@ -1,4 +1,4 @@ -import multiprocessing +import re, multiprocessing Import('sys', 'os', 'SCons', 'resources') @@ -35,8 +35,8 @@ vars.Add('DISTDIR', 'Target directory for the final build') vars.Add('CXX', 'C++ compiler') vars.Add('CC', 'C compiler') vars.Add('CXXFLAGS', 'C++ flags') -vars.Add('CCFLAGS', 'C compiler flags') -vars.Add('SHCXXFLAGS', 'C++ flags (for shared libraries)') +vars.Add('SHCXXFLAGS', 'Extra C++ flags (for shared libraries)') +vars.Add('CCFLAGS', 'Extra C++ flags (for C files)') vars.Add('LINK', 'Linker') vars.Add('LINKFLAGS', 'Linker flags') vars.Add('SHLINKFLAGS', 'Linker flags (dynamic libraries)') @@ -267,37 +267,52 @@ def osxlibinst_as_build_function(self, target, source, pkgname = None, use_own = self.AddPostAction(inst, 'install_name_tool -id @loader_path/../Frameworks/' + name + ' $TARGET') return inst -def remove_flag(env, value): +def remove_flag(env, flag): try: - env['CXXFLAGS'].remove(value) + env['CXXFLAGS'].remove(flag) return True except: return False +def remove_flags(env, patterns): + new_cxxflags = [] + for flag in env['CXXFLAGS']: + found = False + for pattern in patterns: + if re.search(pattern, flag): + found = True + break + if not found: + new_cxxflags.append(flag) + env['CXXFLAGS'] = new_cxxflags + def append_flag(env, value): env['CXXFLAGS'].append(value) env.__class__.RemoveFlag = remove_flag +env.__class__.RemoveFlags = remove_flags env.__class__.AppendFlag = append_flag env.__class__.OSXLibInst = osxlibinst_build_function env.__class__.OSXLibInstAs = osxlibinst_as_build_function def configure_for_objective_cpp(env): - # Objective C++ does not permit the following optimization flags - env.RemoveFlag('-fstrict-aliasing') - env.RemoveFlag('-ftree-vectorize') - env.RemoveFlag('-std=c++0x') + # The OSX Objective C++ compiler does not permit the following flags + env.RemoveFlags(['-fstrict-aliasing', '-ftree-vectorize', + '-std=c\+\+0x']) + # Remove Intel compiler-specific optimization flags + env.RemoveFlags(['-x.*', '-ax.*', '-ipo', '-no-prec-div', + '-fp-model', 'fast=.*', '-wd.*', '-openmp']) env.AppendFlag('-fno-strict-aliasing') + env.AppendFlag('-fopenmp') + # Enforce GCC usage (Intel compiler doesn't handle Objective C/C++) + env['CXX'] = 'g++' + env['CC'] = 'gcc' def relax_compiler_settings(env): # Relax the compiler settings when compiling heavy templated code # (e.g. Boost::Spirit parsers, etc., which don't necessarily have # to be that fast) - env.RemoveFlag('-g') - env.RemoveFlag('/Z7') - env.RemoveFlag('-ipo') - env.RemoveFlag('/Qipo') - env.RemoveFlag('/GL') + env.RemoveFlags(['-g', '/Z7', '-ipo', '/GL']) if env.RemoveFlag('-O3'): env.AppendFlag('-O1') if env.RemoveFlag('/O2'): diff --git a/build/config-icl12-darwin-x86.py b/build/config-icl12-darwin-x86.py new file mode 100644 index 00000000..ebdd3475 --- /dev/null +++ b/build/config-icl12-darwin-x86.py @@ -0,0 +1,32 @@ +BUILDDIR = '#build/release' +DISTDIR = '#Mitsuba.app' +CXX = 'icpc' +CC = 'icc' +CXXFLAGS = ['-arch', 'i386', '-std=c++0x', '-mmacosx-version-min=10.6', '-mfpmath=sse', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-O3', '-ipo', '-no-prec-div', '-xSSSE3', '-fp-model', 'fast=2', '-openmp', '-wd279', '-Wall', '-g', '-pipe', '-DMTS_DEBUG', '-DSINGLE_PRECISION', '-DSPECTRUM_SAMPLES=3', '-DMTS_SSE', '-DMTS_HAS_COHERENT_RT'] +LINKFLAGS = ['-framework', 'OpenGL', '-framework', 'Cocoa', '-arch', 'i386', '-mmacosx-version-min=10.6', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk', '-openmp', '-Wl,-headerpad,128'] +BASEINCLUDE = ['#include'] +BASELIB = ['m', 'pthread', 'gomp'] +OEXRINCLUDE = ['#dependencies/darwin/OpenEXR.framework/Headers/OpenEXR'] +OEXRLIBDIR = ['#dependencies/darwin/OpenEXR.framework/Resources/lib'] +OEXRLIB = ['Half', 'IlmImf', 'Imath', 'z'] +PNGINCLUDE = ['#dependencies/darwin/libpng.framework/Headers'] +PNGLIBDIR = ['#dependencies/darwin/libpng.framework/Resources/lib'] +PNGLIB = ['png'] +JPEGINCLUDE = ['#dependencies/darwin/libjpeg.framework/Headers'] +JPEGLIBDIR = ['#dependencies/darwin/libjpeg.framework/Resources/lib'] +JPEGLIB = ['jpeg'] +XERCESINCLUDE = ['#dependencies/darwin/Xerces-C.framework/Headers'] +XERCESLIBDIR = ['#dependencies/darwin/Xerces-C.framework/Resources/lib'] +XERCESLIB = ['xerces-c'] +GLINCLUDE = ['#dependencies/darwin/GLEW.framework/Headers'] +GLLIBDIR = ['#dependencies/darwin/GLEW.framework/Resources/libs'] +GLLIB = ['GLEW', 'objc'] +GLFLAGS = ['-DGLEW_MX'] +BOOSTINCLUDE = ['#dependencies'] +BOOSTLIB = ['boost_filesystem', 'boost_system'] +BOOSTLIBDIR = ['#dependencies/darwin/libboost.framework/Resources/lib'] +PYTHONINCLUDE = ['/System/Library/Frameworks/Python.framework/Versions/2.6/Headers'] +PYTHONLIB = ['boost_python', 'boost_system', 'Python'] +COLLADAINCLUDE = ['#dependencies/windows/include/colladadom', '#dependencies/windows/include/colladadom/1.4'] +COLLADALIB = ['libCollada14Dom'] +COLLADALIBDIR = ['#dependencies/darwin/Collada14Dom.framework/Resources/lib']