Commit 5ffbeeff authored by Chun-wei Fan's avatar Chun-wei Fan

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.
parent 9c8f1478
...@@ -79,7 +79,7 @@ $(if $(or $(findstring --header-only,$($(_gir_name)_MSVC_SCANNERFLAGS)), ...@@ -79,7 +79,7 @@ $(if $(or $(findstring --header-only,$($(_gir_name)_MSVC_SCANNERFLAGS)),
$($(_gir_name)_MSVC_PROGRAM)),, $($(_gir_name)_MSVC_PROGRAM)),,
$(error Need to define $(_gir_name)_MSVC_LIBS or $(_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 \ for F in $(_gir_files_msvc); do \
case $$$$F in \ case $$$$F in \
*.c|*.cpp|*.cc|*.cxx|*.h|*.hpp|*.hh|*.hxx) \ *.c|*.cpp|*.cc|*.cxx|*.h|*.hpp|*.hh|*.hxx) \
...@@ -88,11 +88,11 @@ $(top_builddir)/build/win32/$(_gir_name)_list: ...@@ -88,11 +88,11 @@ $(top_builddir)/build/win32/$(_gir_name)_list:
esac; \ esac; \
done done
$(top_builddir)/build/win32/$(1).msvc.introspect: $(top_builddir)/build/win32/$(1).msvc.introspect: Makefile
-$(RM) $(top_builddir)/build/win32/$(1).msvc.introspect -$(RM) $(top_builddir)/build/win32/$(1).msvc.introspect
# Assemble the Command to Run g-ir-scanner # 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 ' @-echo Generating $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' $$$$(PYTHON) $$$$(G_IR_SCANNER) \'>>$(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 echo ' --verbose -no-libtool \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
...@@ -101,6 +101,7 @@ $(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_packages_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_libraries_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 ' '$(_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 ' --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_includes_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(_gir_export_packages_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: ...@@ -114,11 +115,11 @@ $(top_builddir)/build/win32/$(1).msvc.introspect:
echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
# Finally Assemble the Command to Compile the generated .gir # 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 ' @-echo Compiling $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' $$$$(G_IR_COMPILER) \'>>$(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 ' --includedir=$$$$(@D:\=/) --debug --verbose \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$(1)' \'>>$(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 ' -o $$$$@'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
endef endef
......
...@@ -6,8 +6,15 @@ APIVERSION = 3.0 ...@@ -6,8 +6,15 @@ APIVERSION = 3.0
CHECK_PACKAGE = gdk-pixbuf-2.0 atk pangocairo gio-2.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_girs = \
built_install_typelibs = Gdk-$(APIVERSION).typelib GdkWin32-$(APIVERSION).typelib Gtk-$(APIVERSION).typelib 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 !include introspection-msvc.mak
...@@ -30,8 +37,8 @@ setgirbuildenv: ...@@ -30,8 +37,8 @@ setgirbuildenv:
!include introspection.body.mak !include introspection.body.mak
install-introspection: all install-introspection: all
@-copy *.gir "$(G_IR_INCLUDEDIR)" @-copy vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir "$(G_IR_INCLUDEDIR)"
@-copy /b *.typelib "$(G_IR_TYPELIBDIR)" @-copy /b vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib "$(G_IR_TYPELIBDIR)"
!else !else
all: all:
...@@ -39,5 +46,5 @@ all: ...@@ -39,5 +46,5 @@ all:
!endif !endif
clean: clean:
@-del /f/q *.typelib @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib
@-del /f/q *.gir @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir
...@@ -534,7 +534,7 @@ GdkWin32_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS) ...@@ -534,7 +534,7 @@ GdkWin32_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
GdkWin32_3_0_gir_MSVC_SCANNERFLAGS = \ GdkWin32_3_0_gir_MSVC_SCANNERFLAGS = \
--identifier-prefix=Gdk \ --identifier-prefix=Gdk \
--c-include="gdk/gdkwin32.h" \ --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 include $(top_srcdir)/build/Makefile.msvc-introspection
......
...@@ -1551,7 +1551,7 @@ Gtk_3_0_gir_MSVC_EXPORT_PACKAGES = $(Gtk_3_0_gir_EXPORT_PACKAGES) ...@@ -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_INCLUDE_GIRS = Atk-1.0
Gtk_3_0_gir_MSVC_LIBS = gtk-3.0 gdk-3.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_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 include $(top_srcdir)/build/Makefile.msvc-introspection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment