MSVC builds: Improve introspection build process

To avoid confusion, have the NMake Makefiles output the built introspection
files in the same location where the binaries are built for the project
files, according to the Visual Studio version, platform and configuration
where the build is carried out.

Also make generating the introspection NMake snippet portion more robust to
source additions and removals by checking on Makefile changes too.
This commit is contained in:
Chun-wei Fan 2019-01-17 18:16:44 +08:00
parent 9c8f1478f9
commit 5ffbeeff91
4 changed files with 22 additions and 14 deletions

View File

@ -79,7 +79,7 @@ $(if $(or $(findstring --header-only,$($(_gir_name)_MSVC_SCANNERFLAGS)),
$($(_gir_name)_MSVC_PROGRAM)),,
$(error Need to define $(_gir_name)_MSVC_LIBS or $(_gir_name)_MSVC_PROGRAM))
$(top_builddir)/build/win32/$(_gir_name)_list:
$(top_builddir)/build/win32/$(_gir_name)_list: Makefile
for F in $(_gir_files_msvc); do \
case $$$$F in \
*.c|*.cpp|*.cc|*.cxx|*.h|*.hpp|*.hh|*.hxx) \
@ -88,11 +88,11 @@ $(top_builddir)/build/win32/$(_gir_name)_list:
esac; \
done
$(top_builddir)/build/win32/$(1).msvc.introspect:
$(top_builddir)/build/win32/$(1).msvc.introspect: Makefile
-$(RM) $(top_builddir)/build/win32/$(1).msvc.introspect
# Assemble the Command to Run g-ir-scanner
echo $(1)': '$(_gir_name)'_list '$($(_gir_name)_MSVC_GIR_DEPS)>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo 'vs$$$$(VSVER)\$$$$(CFG)\$$$$(PLAT)\bin\'$(1)': '$(_gir_name)'_list '$($(_gir_name)_MSVC_GIR_DEPS)>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' @-echo Generating $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' $$$$(PYTHON) $$$$(G_IR_SCANNER) \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --verbose -no-libtool \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
@ -101,6 +101,7 @@ $(top_builddir)/build/win32/$(1).msvc.introspect:
echo ' '$(_gir_packages_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_libraries_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_program_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --add-include-path=./vs$$$$(VSVER)/$$$$(CFG)/$$$$(PLAT)/bin \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --add-include-path=$$$$(G_IR_INCLUDEDIR) \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_includes_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_export_packages_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
@ -114,11 +115,11 @@ $(top_builddir)/build/win32/$(1).msvc.introspect:
echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
# Finally Assemble the Command to Compile the generated .gir
echo '$(_typelib_basename_msvc).typelib: '$(_typelib_basename_msvc)'.gir'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo 'vs$$$$(VSVER)\$$$$(CFG)\$$$$(PLAT)\bin\$(_typelib_basename_msvc).typelib: vs$$$$(VSVER)\$$$$(CFG)\$$$$(PLAT)\bin\'$(_typelib_basename_msvc)'.gir'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' @-echo Compiling $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' $$$$(G_IR_COMPILER) \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --includedir=. --debug --verbose \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(1)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --includedir=$$$$(@D:\=/) --debug --verbose \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' $$$$(@R:\=/).gir \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' -o $$$$@'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
endef

View File

@ -6,8 +6,15 @@ APIVERSION = 3.0
CHECK_PACKAGE = gdk-pixbuf-2.0 atk pangocairo gio-2.0
built_install_girs = Gdk-$(APIVERSION).gir GdkWin32-$(APIVERSION).gir Gtk-$(APIVERSION).gir
built_install_typelibs = Gdk-$(APIVERSION).typelib GdkWin32-$(APIVERSION).typelib Gtk-$(APIVERSION).typelib
built_install_girs = \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).gir \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).gir \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-$(APIVERSION).gir
built_install_typelibs = \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).typelib \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).typelib \
vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-$(APIVERSION).typelib
!include introspection-msvc.mak
@ -30,8 +37,8 @@ setgirbuildenv:
!include introspection.body.mak
install-introspection: all
@-copy *.gir "$(G_IR_INCLUDEDIR)"
@-copy /b *.typelib "$(G_IR_TYPELIBDIR)"
@-copy vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir "$(G_IR_INCLUDEDIR)"
@-copy /b vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib "$(G_IR_TYPELIBDIR)"
!else
all:
@ -39,5 +46,5 @@ all:
!endif
clean:
@-del /f/q *.typelib
@-del /f/q *.gir
@-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib
@-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir

View File

@ -534,7 +534,7 @@ GdkWin32_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
GdkWin32_3_0_gir_MSVC_SCANNERFLAGS = \
--identifier-prefix=Gdk \
--c-include="gdk/gdkwin32.h" \
--include-uninstalled=./Gdk-3.0.gir
--include-uninstalled='./vs$$$$(VSVER)/$$$$(CFG)/$$$$(PLAT)/bin/Gdk-3.0.gir'
include $(top_srcdir)/build/Makefile.msvc-introspection

View File

@ -1551,7 +1551,7 @@ Gtk_3_0_gir_MSVC_EXPORT_PACKAGES = $(Gtk_3_0_gir_EXPORT_PACKAGES)
Gtk_3_0_gir_MSVC_INCLUDE_GIRS = Atk-1.0
Gtk_3_0_gir_MSVC_LIBS = gtk-3.0 gdk-3.0
Gtk_3_0_gir_MSVC_CFLAGS = $(GTK_MSVC_GIR_CFLAGS)
Gtk_3_0_gir_MSVC_SCANNERFLAGS = --warn-all --add-include-path=. --include-uninstalled=./Gdk-3.0.gir
Gtk_3_0_gir_MSVC_SCANNERFLAGS = --warn-all --include-uninstalled='./vs$$$$(VSVER)/$$$$(CFG)/$$$$(PLAT)/bin/Gdk-3.0.gir'
include $(top_srcdir)/build/Makefile.msvc-introspection