GNOME Bugzilla – Bug 728190
Visual C++ builds: Eliminate the MinGW/GCC dependency for building introspection files
Last modified: 2015-02-07 16:58:53 UTC
Hi, g-i in its current state is usable on Windows, but currently requires a suitable GCC installation (such as MinGW or mingw64) in order to run the preprocessor to generate the introspection dumper program source. This is, as a result, not optimal, so this bug is to track the process of eliminating that dependency on building the introspection files with Visual C++ builds (but keeping things in the current shape for MinGW-based builds). I will post patches in this bug for this purpose in the next few days. With blessings, thank you!
Created attachment 274327 [details] [review] Update scannerlexer.l to handle Visual C++-specific items Hi, This updates scannerlexer.l in the following ways: -Visual C++-specific items such as __cdecl, __declspec(deprecated|dllexport|dllimport|noalias|restrict), __stdcall, __w64 will be ignored, so that we can avoid many warnings and the scanner bailing out when using the Visual C++ preprocessor to produce the introspection dumper program source. The Visual C++-specific __int64 is also handled here as well. -Handle also the line markers produced by Visual C++ preprocessor, as it puts #line x instead of # x in front the the headers/source files. This is necessary so that the _get_type and _get_gtype symbols can be acquired correctly from the various headers and sources that are passed in.
Created attachment 274328 [details] [review] Update sourcescanner.py to support using the MSVC preprocessor Hi, This adds support to sourcescanner.py to support using the Visual C++ preprocessor, which will eliminate the need for a GCC installation to produce introspection files for Visual C++ builds of g-i. The main thing that is done here is, on Visual C++ builds, instead of passing the "source" containing the headers to scan via stdin, we use a temp file to do the same for Visual C++ builds. Some extra compile-time macros are also defined when we are on Visual C++, as doing so will avoid numerous warnings and the need to handle additional MSVC-specific items in scannerlexer.l. I was able to produce identical .gir files for the glib libraries, as well as ATK, versus the ones that I had when preprocessing the sources via MinGW-GCC, with the ability to run the PyGObject 3.x demos as well as I did before.* [*]: The Gtk-3.0.gir is slightly different, as there is the added advantage here that time_t is supported without having to define it during the build of the introspection files. With blessings, thank you!
Created attachment 274332 [details] [review] Update sourcescanner.py to support using the MSVC preprocessor (take ii) Hi, I updated the patch a bit on sourcescanner.py so that it will satisfy the requirements of PEP-8. With blessings, thank you!
Hi, I am closing this bug and moving the attention for this to bug 728313 as work there is closely related to this as well, so I will shift the patch for scannerlexer.l there as well. With blessings, thank you!
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]