[gtk/msvcproj-nmake-install: 21/22] build: Write introspection rules directly in NMake Makefiles




commit fe548537f9c76dbd556eba829d2116fe99ec23f1
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu May 19 11:22:12 2022 +0800

    build: Write introspection rules directly in NMake Makefiles
    
    By doing so, we can drop the autotools rules that we use to generate the
    file lists and rules for building introspection via NMake Makefiles for
    Visual Studio builds via the project files.

 win32/create-lists-msvc.mak      |  61 +++++++++++++++++++--
 win32/generate-msvc.mak          |   4 +-
 win32/gtk-introspection-msvc.mak | 112 +++++++++++++++++++++++++++++++++++----
 3 files changed, 164 insertions(+), 13 deletions(-)
---
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
index 3fce81333a..3158c02544 100644
--- a/win32/create-lists-msvc.mak
+++ b/win32/create-lists-msvc.mak
@@ -33,7 +33,7 @@
 
 NULL=
 
-# For GDK enumeration sources
+# For GDK public headers and sources
 !include ..\gdk\gdk-sources.inc
 
 !if [call create-lists.bat header gdk_headers.mak GDK_PUBLIC_HEADERS]
@@ -45,9 +45,36 @@ NULL=
 !if [call create-lists.bat footer gdk_headers.mak]
 !endif
 
-# For GDK-Win32 public headers
+!if [call create-lists.bat header gdk_headers.mak GDK_C_SRCS]
+!endif
+
+!if [for %f in ($(gdk_c_sources)) do @call create-lists.bat file gdk_headers.mak ../gdk/%f]
+!endif
+
+!if [call create-lists.bat footer gdk_headers.mak]
+!endif
+
+# For GDK-Win32 public headers and sources
 !include ..\gdk\win32\gdk-win32-sources.inc
 
+!if [call create-lists.bat header gdk_headers.mak GDK_WIN32_PUBLIC_HEADERS]
+!endif
+
+!if [for %f in ($(libgdkwin32include_HEADERS)) do @call create-lists.bat file gdk_headers.mak 
../gdk/win32/%f]
+!endif
+
+!if [call create-lists.bat footer gdk_headers.mak]
+!endif
+
+!if [call create-lists.bat header gdk_headers.mak GDK_WIN32_INTROSPECTION_SRCS]
+!endif
+
+!if [for %f in ($(w32_introspection_files)) do @call create-lists.bat file gdk_headers.mak ../gdk/%f]
+!endif
+
+!if [call create-lists.bat footer gdk_headers.mak]
+!endif
+
 # For GDK-Broadway public headers
 !include ..\gdk\broadway\gdk-broadway-sources.inc
 
@@ -70,10 +97,11 @@ NULL=
 !if [call create-lists.bat header resources_sources.mak GTK_RESOURCES]
 !endif
 
-# For GTK enumeration sources
+# For GTK public headers and sources
 !include ..\gtk\gtk-sources.inc
 !include ..\gtk\a11y\Makefile.inc
 !include ..\gtk\deprecated\Makefile.inc
+!include ..\gtk\inspector\Makefile.inc
 
 !if [call create-lists.bat header gtk_headers.mak GTK_PUBLIC_ENUM_HEADERS]
 !endif
@@ -96,6 +124,33 @@ NULL=
 !if [call create-lists.bat footer gtk_headers.mak]
 !endif
 
+!if [call create-lists.bat header gtk_headers.mak GTK_SEMI_PRIVATE_HEADERS]
+!endif
+
+!if [for %f in ($(gtk_semi_private_h_sources)) do @call create-lists.bat file gtk_headers.mak ../gtk/%f]
+!endif
+
+!if [call create-lists.bat footer gtk_headers.mak]
+!endif
+
+!if [call create-lists.bat header gtk_headers.mak GTK_C_SRCS]
+!endif
+
+!if [for %f in ($(a11y_c_sources) $(gtk_deprecated_c_sources) $(inspector_c_sources)) do @call 
create-lists.bat file gtk_headers.mak ../gtk/%f]
+!endif
+
+!if [for %f in ($(gtk_base_c_sources_base_gtka_gtkh:.c=)) do @call create-lists.bat file gtk_headers.mak 
../gtk/%f.c]
+!endif
+
+!if [for %f in ($(gtk_base_c_sources_base_gtki_gtkw:.c=)) do @call create-lists.bat file gtk_headers.mak 
../gtk/%f.c]
+!endif
+
+!if [for %f in ($(gtk_os_win32_c_sources)) do @call create-lists.bat file gtk_headers.mak ../gtk/%f]
+!endif
+
+!if [call create-lists.bat footer gtk_headers.mak]
+!endif
+
 !include gtk_headers.mak
 
 !if [del /f /q gtk_headers.mak]
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index 63cf6c5c00..67f610fd92 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -39,6 +39,8 @@ GDK_GENERATED_SOURCES =       \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkresources.c        \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkversionmacros.h
 
+GTK_VERSION_H = .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h
+
 GTK_TYPEBUILTIN_SOURCES =      \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtktypebuiltins.h     \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtktypebuiltins.c
@@ -54,7 +56,7 @@ GTK_GENERATED_SOURCES =       \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkmarshalers.c       \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.h        \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.c        \
-       .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h
+       $(GTK_VERSION_H)
 
 generate-base-sources: \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\config.h  \
diff --git a/win32/gtk-introspection-msvc.mak b/win32/gtk-introspection-msvc.mak
index 07d0e2c762..abf122e0e0 100644
--- a/win32/gtk-introspection-msvc.mak
+++ b/win32/gtk-introspection-msvc.mak
@@ -29,19 +29,113 @@ AT_PLAT=aarch64
 AT_PLAT=i686
 !endif
 
-introspect: setgirbuildenv $(built_install_girs) $(built_install_typelibs)
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\Gdk-$(APIVERSION).gir.filelist: $(GDK_PUBLIC_HEADERS) $(GDK_C_SRCS) 
$(GDK_GENERATED_SOURCES)
+       @if exist $@ del $@
+       @for %f in ($(gdk_h_sources:/=\) $(gdk_c_sources:/=\)) do @if not "%f" == "gdkkeysyms-compat.h" echo 
..\gdk\%f>>$@
+       @for %f in ($(GDK_GENERATED_SOURCES)) do @if not "%~nxf" == "gdkconfig.h" echo %f>>$@
 
-setgirbuildenv:
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk3-win32\GdkWin32-$(APIVERSION).gir.filelist: $(GDK_WIN32_INTROSPECTION_SRCS)
+       @if exist $@ del $@
+       @for %f in ($(w32_introspection_files:/=\)) do @echo ..\gdk\%f>>$@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\Gtk-$(APIVERSION).gir.filelist:    \
+$(GTK_PUBLIC_ENUM_HEADERS) $(GTK_SEMI_PRIVATE_HEADERS) \
+$(GTK_GENERATED_PUB_HDRS) $(GTK_C_SRCS)
+       @if exist $@ del $@
+       @for %f in ($(GTK_PUB_HDRS:.h=)) do @if not "%f" == "gtktextdisplay" if not "%f" == "gtkx" echo 
..\gtk\%f.h>>$@
+       @for %f in ($(a11y_h_sources:/=\) $(gtk_deprecated_h_sources:/=\) $(gtk_semi_private_h_sources)) do 
@if not "%f" == "gtktextlayout.h" echo ..\gtk\%f>>$@
+       @for %f in ($(a11y_c_sources:/=\) $(gtk_deprecated_c_sources:/=\) $(inspector_c_sources:/=\)) do 
@echo ..\gtk\%f>>$@
+       @for %f in ($(gtk_base_c_sources_base_gtka_gtkh:.c=)) do @echo ..\gtk\%f.c>>$@
+       @for %f in ($(gtk_base_c_sources_base_gtki_gtkw:.c=)) do @echo ..\gtk\%f.c>>$@
+       @for %f in ($(gtk_clipboard_dnd_c_sources_generic) $(gtk_os_win32_c_sources)) do @echo ..\gtk\%f>>$@
+       @for %f in ($(GTK_TYPEBUILTIN_SOURCES) $(GTK_VERSION_H)) do @echo %f>>$@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).gir: 
vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\Gdk-$(APIVERSION).gir.filelist
+       @-echo Generating $@...
+       @set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
+       @set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
+       @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+       @set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+       @$(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool        \
+       --namespace=Gdk --nsversion=$(APIVERSION)       \
+       --library=gdk-$(APIVERSION)     \
+       --add-include-path=./vs$(VSVER)/$(CFG)/$(PLAT)/bin      \
+       --add-include-path=$(G_IR_INCLUDEDIR)   \
+       --include=Gio-2.0 --include=GdkPixbuf-2.0 --include=Pango-1.0 --include=cairo-1.0       \
+       --cflags-begin  \
+       -DG_LOG_USE_STRUCTURED=1 -DGDK_COMPILATION -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3      \
+       -I.. -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3/gdk -I../gdk -I../gdk/win32        \
+       --cflags-end    \
+       --c-include=gdk/gdk.h   \
+       --filelist=$**  \
+       -L.\vs$(VSVER)\$(CFG)\$(PLAT)\bin       \
+       -o $@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).gir:      \
+./vs$(VSVER)/$(CFG)/$(PLAT)/bin/Gdk-$(APIVERSION).gir  \
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk3-win32\GdkWin32-$(APIVERSION).gir.filelist
+       @-echo Generating $@...
        @set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
        @set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
        @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
        @set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+       $(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool \
+       --namespace=GdkWin32 --nsversion=$(APIVERSION)  \
+       --library=gdk-$(APIVERSION)     \
+       --add-include-path=./vs$(VSVER)/$(CFG)/$(PLAT)/bin      \
+       --add-include-path=$(G_IR_INCLUDEDIR)   \
+       --cflags-begin  \
+       -DG_LOG_USE_STRUCTURED=1 -DGDK_COMPILATION -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3      \
+       -I.. -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3/gdk -I../gdk -I../gdk/win32        \
+       --cflags-end    \
+       --identifier-prefix=Gdk --c-include=gdk/gdkwin32.h      \
+       --include-uninstalled=./vs$(VSVER)/$(CFG)/$(PLAT)/bin/Gdk-$(APIVERSION).gir     \
+       --filelist=vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk3-win32\GdkWin32-$(APIVERSION).gir.filelist \
+       -L.\vs$(VSVER)\$(CFG)\$(PLAT)\bin       \
+       -o $@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-$(APIVERSION).gir:   \
+./vs$(VSVER)/$(CFG)/$(PLAT)/bin/Gdk-$(APIVERSION).gir  \
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\Gtk-$(APIVERSION).gir.filelist
+       @-echo Generating $@...
+       @set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
+       @set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
+       @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+       @set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+       $(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool \
+       --namespace=Gtk --nsversion=$(APIVERSION)       \
+       --library=gtk-$(APIVERSION) --library=gdk-$(APIVERSION) \
+       --add-include-path=./vs$(VSVER)/$(CFG)/$(PLAT)/bin      \
+       --add-include-path=$(G_IR_INCLUDEDIR)   \
+       --include=Atk-1.0       \
+       --pkg-export=gtk+-$(APIVERSION) \
+       --cflags-begin  \
+       -DG_LOG_USE_STRUCTURED=1 -DGTK_VERSION="$(GTK_VERSION)" -DGTK_BINARY_VERSION="3.0.0" 
-DGTK_COMPILATION  \
+       -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED -DGTK_LIBDIR=\"/dummy/lib\" -DGTK_DATADIR=\"/dummy/share\"     
  \
+       -DGTK_DATA_PREFIX=\"/dummy\" -DGTK_SYSCONFDIR=\"/dummy/etc\" -DGTK_HOST=\"$(AT_PLAT)-pc-vs$(VSVER)\"  
  \
+       -DGTK_PRINT_BACKENDS=\"file\" -DINCLUDE_IM_am_et -DINCLUDE_IM_cedilla -DINCLUDE_IM_cyrillic_translit  
  \
+       -DINCLUDE_IM_ime -DINCLUDE_IM_inuktitu -DINCLUDE_IM_ipa -DINCLUDE_IM_multipress -DINCLUDE_IM_thai     
  \
+       -DINCLUDE_IM_ti_er -DINCLUDE_IM_ti_et -DINCLUDE_IM_viqr \
+       -DGTK_TEXT_USE_INTERNAL_UNSUPPORTED_API \
+       -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gtk-3 \
+       -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3 \
+       -I.. -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gtk-3/gtk -I../gtk       \
+       -I./vs$(VSVER)/$(CFG)/$(PLAT)/obj/gdk-3/gdk -I../gdk    \
+       --cflags-end    \
+       --warn-all --include-uninstalled=./vs$(VSVER)/$(CFG)/$(PLAT)/bin/Gdk-$(APIVERSION).gir  \
+       --filelist=vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\Gtk-$(APIVERSION).gir.filelist   \
+       -L.\vs$(VSVER)\$(CFG)\$(PLAT)\bin       \
+       -o $@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).typelib: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).gir
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).typelib: 
vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).gir
+vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-$(APIVERSION).typelib: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-$(APIVERSION).gir
 
-!include introspection.body.mak
+$(built_install_typelibs):
+       @-echo Compiling $@...
+       $(G_IR_COMPILER) --includedir=$(@D:\=/) --debug --verbose $(@R:\=/).gir -o $@
 
-install-introspection: introspect
-       @-copy vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir "$(G_IR_INCLUDEDIR)"
-       @-copy /b vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib "$(G_IR_TYPELIBDIR)"
+introspect: $(built_install_girs) $(built_install_typelibs)
 
 !else
 introspect:
@@ -49,8 +143,8 @@ introspect:
 !endif
 
 introspect-clean:
-       @-del /f/q Gtk_3_0_gir_list_final
-       @-del /f/q GdkWin32_3_0_gir_list_final
-       @-del /f/q Gdk_3_0_gir_list_final
+       @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\Gtk-$(APIVERSION).gir.filelist
+       @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk3-win32\GdkWin32-$(APIVERSION).gir.filelist
+       @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\Gdk-$(APIVERSION).gir.filelist
        @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib
        @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir


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