OSX build improvements

metadata
Wenzel Jakob 2011-08-16 02:18:38 -04:00
parent a95656891a
commit 6afff558ef
5 changed files with 24 additions and 28 deletions

View File

@ -267,9 +267,29 @@ 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):
try:
env['CXXFLAGS'].remove(value)
except:
pass
def append_flag(env, value):
env['CXXFLAGS'].append(value)
env.__class__.RemoveFlag = remove_flag
env.__class__.AppendFlag = append_flag
env.__class__.OSXLibInst = osxlibinst_build_function
env.__class__.OSXLibInstAs = osxlibinst_as_build_function
def prepare_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')
env.AppendFlag('-fno-strict-aliasing')
env.__class__.ConfigureForObjectiveCPP = prepare_for_objective_cpp
if hasCollada:
env.Append(CPPDEFINES = [['MTS_HAS_COLLADA', 1]] )

View File

@ -39,13 +39,7 @@ libcore_objects = [
# Add some platform-specific components
if sys.platform == 'darwin':
coreEnv_osx = coreEnv.Clone()
try:
# Objective C++ does not permit the following optimization flags
coreEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing')
coreEnv_osx['CXXFLAGS'].remove('-ftree-vectorize')
coreEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing')
except:
pass
coreEnv_osx.ConfigureForObjectiveCPP()
libcore_objects += coreEnv_osx.SharedObject('platform_darwin.mm')
elif sys.platform == 'win32':
libcore_objects += coreEnv.SharedObject('getopt.c')

View File

@ -30,13 +30,7 @@ if glEnv.has_key('GLINCLUDE'):
if sys.platform == 'darwin':
glEnv_osx = glEnv.Clone()
try:
# Objective C++ does not permit the following optimization flags
glEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing')
glEnv_osx['CXXFLAGS'].remove('-ftree-vectorize')
glEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing')
except:
pass
glEnv_osx.ConfigureForObjectiveCPP()
libhw_objects += glEnv_osx.SharedObject(['nsglsession.mm',
'nsgldevice.mm', 'nsglrenderer.mm'])

View File

@ -20,13 +20,7 @@ if mainEnv.has_key('GLINCLUDE'):
if sys.platform == 'darwin':
# On OSX, we need this stub to access OpenGL from the command line
mainEnv_osx = mainEnv.Clone()
try:
# Objective C++ does not permit the following optimization flags
mainEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing')
mainEnv_osx['CXXFLAGS'].remove('-ftree-vectorize')
mainEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing')
except:
pass
mainEnv_osx.ConfigureForObjectiveCPP()
stubs += [mainEnv_osx.StaticObject('darwin_stub.mm')]
mainEnv.Program('mtsutil', resources + stubs + ['mtsutil.cpp'])

View File

@ -49,13 +49,7 @@ if hasQt:
if sys.platform == 'darwin':
qtEnv_osx = qtEnv.Clone()
try:
# Objective C++ does not permit the following optimization flags
qtEnv_osx['CXXFLAGS'].remove('-fstrict-aliasing')
qtEnv_osx['CXXFLAGS'].remove('-ftree-vectorize')
qtEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing')
except:
pass
qtEnv_osx.ConfigureForObjectiveCPP()
qtEnv_osx['CXXFLAGS'].append(['-Fdependencies/darwin', '-framework', 'BWToolkitFramework'])
qtSources += qtEnv_osx.StaticObject('previewsettingsdlg_cocoa_impl.mm')
else: