1.1 --- a/AMBuildScript Sat Jun 30 01:32:39 2012 -0400
1.2 +++ b/AMBuildScript Sat Jun 30 01:01:55 2012 -0500
1.3 @@ -46,15 +46,18 @@
1.4
1.5 #Set up defines
1.6 cxx = self.compiler.cxx
1.7 - if isinstance(cxx, Cpp.GCC):
1.8 - self.vendor = 'gcc'
1.9 + if isinstance(cxx, Cpp.CompatGCC):
1.10 + if isinstance(cxx, Cpp.GCC):
1.11 + self.vendor = 'gcc'
1.12 + elif isinstance(cxx, Cpp.Clang):
1.13 + self.vendor = 'clang'
1.14 self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp')
1.15 self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp')
1.16 self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf')
1.17 self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf')
1.18 self.compiler.AddToListVar('CFLAGS', '-pipe')
1.19 self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing')
1.20 - if cxx.majorVersion >= 4:
1.21 + if (self.vendor == 'gcc' and cxx.majorVersion >= 4) or self.vendor == 'clang':
1.22 self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
1.23 self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
1.24 self.compiler.AddToListVar('CFLAGS', '-Wall')
1.25 @@ -63,16 +66,20 @@
1.26 self.compiler.AddToListVar('CFLAGS', '-Wno-invalid-offsetof')
1.27 self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
1.28 self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
1.29 - self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
1.30 self.compiler.AddToListVar('CFLAGS', '-msse')
1.31 self.compiler.AddToListVar('CFLAGS', '-m32')
1.32 self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
1.33 - self.compiler.AddToListVar('CFLAGS', '-static-libgcc')
1.34 self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
1.35 self.compiler.AddToListVar('CXXFLAGS', '-fno-rtti')
1.36 self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
1.37 self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
1.38 + self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
1.39 + if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 7) or \
1.40 + (self.vendor == 'clang' and cxx.majorVersion >= 3):
1.41 + self.compiler.AddToListVar('CXXFLAGS', '-Wno-delete-non-virtual-dtor')
1.42 self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
1.43 + if self.vendor == 'gcc':
1.44 + self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
1.45 elif isinstance(cxx, Cpp.MSVC):
1.46 self.vendor = 'msvc'
1.47 if AMBuild.options.debug == '1':
1.48 @@ -108,7 +115,7 @@
1.49 #Optimization
1.50 if AMBuild.options.opt == '1':
1.51 self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
1.52 - if self.vendor == 'gcc':
1.53 + if self.vendor == 'gcc' or self.vendor == 'clang':
1.54 self.compiler.AddToListVar('CFLAGS', '-O3')
1.55 elif self.vendor == 'msvc':
1.56 self.compiler.AddToListVar('CFLAGS', '/Ox')
1.57 @@ -119,7 +126,7 @@
1.58 if AMBuild.options.debug == '1':
1.59 self.compiler.AddToListVar('CDEFINES', 'DEBUG')
1.60 self.compiler.AddToListVar('CDEFINES', '_DEBUG')
1.61 - if self.vendor == 'gcc':
1.62 + if self.vendor == 'gcc' or self.vendor == 'clang':
1.63 self.compiler.AddToListVar('CFLAGS', '-g3')
1.64 elif self.vendor == 'msvc':
1.65 self.compiler.AddToListVar('CFLAGS', '/Od')
1.66 @@ -128,9 +135,11 @@
1.67 #Platform-specifics
1.68 if AMBuild.target['platform'] == 'linux':
1.69 self.compiler.AddToListVar('CDEFINES', '_LINUX')
1.70 + if self.vendor == 'gcc':
1.71 + self.compiler.AddToListVar('POSTLINKFLAGS', '-static-libgcc')
1.72 + if self.vendor == 'clang':
1.73 + self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
1.74 elif AMBuild.target['platform'] == 'darwin':
1.75 - self.compiler.AddToListVar('CFLAGS', ['-isysroot',
1.76 - '/Developer/SDKs/MacOSX10.5.sdk'])
1.77 self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
1.78 self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
1.79 self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')