+from waflib.Tools import winres
+
+compiler_flags_dictionaries= {
+ 'gcc' : {
+ # Flags required when building a debug build
+ 'debuggable' : [ '-O0', '-g' ],
+ # Flags required for the linker (if any) when building a debug build
+ 'linker-debuggable' : '',
+ # Flags required when building a non-debug optimized build
+ 'nondebuggable' : '-DNDEBUG',
+ # Flags required to enable profiling at runtime
+ 'profile' : '-pg',
+ # Flags required to disable warnings about unused arguments to function calls
+ 'silence-unused-arguments' : '',
+ # Flags required to use SSE unit for general math
+ 'sse' : '-msse',
+ # Flags required to use SSE unit for floating point math
+ 'fpmath-sse' : '-mfpmath=sse',
+ # Flags required to use XMM Intrinsics
+ 'xmmintrinsics' : '-DUSE_XMMINTRIN',
+ # Flags to use posix pipes between compiler stages
+ 'pipe' : '-pipe',
+ # Flags for maximally optimized build
+ 'full-optimization' : [ '-O3', '-fomit-frame-pointer', '-ffast-math', '-fstrength-reduce', ],
+ # Flag to ensure that compiler error output includes column/line numbers
+ 'show-column' : '-fshow-column',
+ # Flags required to build for x86 only (OS X feature)
+ 'generic-x86' : '',
+ # Flags required to build for PowerPC only (OS X feature)
+ 'generic-ppc' : '',
+ # All flags required to get basic warnings to be generated by the compiler
+ 'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ],
+ # Any additional flags for warnings that are specific to C (not C++)
+ 'extra-c-warnings' : [ '-Wstrict-prototypes', '-Wmissing-prototypes' ],
+ # Any additional flags for warnings that are specific to C++ (not C)
+ 'extra-cxx-warnings' : [ '-Woverloaded-virtual', '-Wno-unused-local-typedefs' ],
+ # Flags used for "strict" compilation, C and C++ (i.e. compiler will warn about language issues)
+ 'strict' : ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings', '-Wunsafe-loop-optimizations', '-Wlogical-op' ],
+ # Flags used for "strict" compilation, C only (i.e. compiler will warn about language issues)
+ 'c-strict' : ['-std=c99', '-pedantic', '-Wshadow'],
+ # Flags used for "strict" compilation, C++ only (i.e. compiler will warn about language issues)
+ 'cxx-strict' : [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ],
+ # Flags required for whatever consider the strictest possible compilation
+ 'ultra-strict' : ['-Wredundant-decls', '-Wstrict-prototypes', '-Wmissing-prototypes'],
+ # Flag to turn on C99 compliance by itself
+ 'c99': '-std=c99',
+ },
+ 'msvc' : {
+ 'debuggable' : ['/Od', '/Zi', '/MTd'],
+ 'linker-debuggable' : ['/DEBUG' ],
+ 'nondebuggable' : [ '/MD', '-DNDEBUG' ],
+ 'profile' : '',
+ 'silence-unused-arguments' : '',
+ 'sse' : '',
+ 'fpmath-see' : '',
+ 'xmmintrinsics' : '',
+ 'pipe' : '',
+ 'full-optimization' : '',
+ 'no-frame-pointer' : '',
+ 'fast-math' : '',
+ 'strength-reduce' : '',
+ 'show-column' : '',
+ 'generic-x86' : '',
+ 'generic-ppc' : '',
+ 'basic-warnings' : '',
+ 'extra-c-warnings' : '',
+ 'extra-cxx-warnings' : '',
+ 'ultra-strict' : '',
+ 'c-strict' : '',
+ 'cxx-strict' : '',
+ 'strict' : '',
+ 'c99': '-TP',
+ },
+}
+
+# Copy, edit and insert variants on gcc dict for gcc-darwin and clang
+
+gcc_darwin_dict = compiler_flags_dictionaries['gcc'].copy()
+gcc_darwin_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual' ]
+gcc_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ]
+gcc_darwin_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
+gcc_darwin_dict['generic-x86'] = [ '-arch', 'i386' ]
+gcc_darwin_dict['generic-ppc'] = [ '-arch', 'ppc' ]
+compiler_flags_dictionaries['gcc-darwin'] = gcc_darwin_dict;
+
+clang_dict = compiler_flags_dictionaries['gcc'].copy();
+clang_dict['sse'] = ''
+clang_dict['fpmath-sse'] = ''
+clang_dict['xmmintrinsics'] = ''
+clang_dict['silence-unused-arguments'] = '-Qunused-arguments'
+clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-tags' ]
+clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ]
+clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
+compiler_flags_dictionaries['clang'] = clang_dict;
+
+clang_darwin_dict = compiler_flags_dictionaries['clang'].copy();
+clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', ]
+compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict;