[gobject-introspection] giscanner/sourcescanner.py: Update for Visual C++ usage



commit fe669d9c2d76a369161633ae43b3147ce369aaec
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Aug 14 15:37:14 2012 +0800

    giscanner/sourcescanner.py: Update for Visual C++ usage
    
    Since the Visual C++ (cl.exe) preprocessor does not accept source input
    from stdin (the '-' preprocessor flag, we need to use the GCC preprocessor
    as a helper here.
    
    Note that the generated dumper program is still compiled and run by
    Visual C++.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681820

 giscanner/sourcescanner.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index db282f8..9eb4ab4 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -274,7 +274,16 @@ class SourceScanner(object):
 
         defines = ['__GI_SCANNER__']
         undefs = []
-        cpp_args = os.environ.get('CC', 'cc').split()
+        cpp_exec = os.environ.get('CC', 'cc').split()
+        # The Microsoft compiler/preprocessor (cl) does not accept
+        # source input from stdin (the '-' flag), so we need
+        # some help from gcc from MinGW/Cygwin or so.
+        # Note that the generated dumper program is
+        # still built and linked by Visual C++.
+        if 'cl' in cpp_exec:
+            cpp_args = 'gcc'.split()
+        else:
+            cpp_args = cpp_exec
         cpp_args += ['-E', '-C', '-I.', '-']
 
         cpp_args += self._cpp_options



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]