scons: Allow to use MS's DXSDK headers with MinGW.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 1 Sep 2009 09:11:08 +0000 (10:11 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 14 Sep 2009 19:12:01 +0000 (20:12 +0100)
scons/dxsdk.py

index de090e4f991aa5356980e88619d12b1d7d9f8d9a..920cc2f689d1df31b12e6b4f4b8775f3a8cf277c 100644 (file)
@@ -52,11 +52,20 @@ def generate(env):
         target_cpu = 'x64'
     else:
         raise SCons.Errors.InternalError, "Unsupported target machine"
-    include_dir = 'Include'
+
+    include_dir = os.path.join(dxsdk_root, 'Include')
+    lib_dir = os.path.join(dxsdk_root, 'Lib', target_cpu)
 
     env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
-    env.Prepend(CPPPATH = [os.path.join(dxsdk_root, 'Include')])
-    env.Prepend(LIBPATH = [os.path.join(dxsdk_root, 'Lib', target_cpu)])
+
+    gcc = 'gcc' in os.path.basename(env['CC']).split('-')
+    if gcc:
+        # Make GCC more forgiving towards Microsoft's headers
+        env.Prepend(CPPFLAGS = ['-isystem', include_dir])
+    else:
+        env.Prepend(CPPPATH = [include_dir])
+
+    env.Prepend(LIBPATH = [lib_dir])
 
 def exists(env):
     return get_dxsdk_root(env) is not None