[gtk/msvcproj-git: 2/10] win32/generate-msvc.mak: Add rules to create GDK-Win32 MSVC projects




commit fc3ce465c81a43ba94397ed5ab9dc99da43980ac
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Aug 3 17:00:08 2022 +0800

    win32/generate-msvc.mak: Add rules to create GDK-Win32 MSVC projects
    
    This will allow one to quickly re-generate the Gdk-Win32 Visual Studio
    projects with or without EGL/libANGLE support.  Since some rules are shared
    with the ones that we use to generate the gtk3-demo projects, clean things
    up a bit.

 win32/config-msvc.mak.in    |  3 ++
 win32/create-lists-msvc.mak |  9 +++++
 win32/generate-msvc.mak     | 98 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 107 insertions(+), 3 deletions(-)
---
diff --git a/win32/config-msvc.mak.in b/win32/config-msvc.mak.in
index d3fc362377..8d767f5f14 100644
--- a/win32/config-msvc.mak.in
+++ b/win32/config-msvc.mak.in
@@ -123,6 +123,9 @@ GTK_PREPROCESSOR_FLAGS =    \
         /DGDK_DISABLE_DEPRECATED       \
         /DISOLATION_AWARE_ENABLED
 
+GDKWIN32_VS9_PROJ = gdk3-win32.vcproj
+GDKWIN32_VS1X_PROJ = $(GDKWIN32_VS9_PROJ:.vcproj=.vcxproj)
+GDKWIN32_VS1X_PROJ_FILTERS = $(GDKWIN32_VS9_PROJ:.vcproj=.vcxproj.filters)
 DEMO_VS9_PROJ = gtk3-demo.vcproj
 DEMO_VS1X_PROJ = $(DEMO_VS9_PROJ:.vcproj=.vcxproj)
 DEMO_VS1X_PROJ_FILTERS = $(DEMO_VS9_PROJ:.vcproj=.vcxproj.filters)
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
index a4ba131660..2da0d03fa7 100644
--- a/win32/create-lists-msvc.mak
+++ b/win32/create-lists-msvc.mak
@@ -66,6 +66,15 @@ NULL=
 !if [call create-lists.bat footer gdk_sources_msvc$(VSVER)_$(PLAT).mak]
 !endif
 
+!if [call create-lists.bat header gdk_sources_msvc$(VSVER)_$(PLAT).mak GDK_WIN32_C_SRCS]
+!endif
+
+!if [for %f in ($(libgdk_win32_la_SOURCES)) do @if "%~xf" == ".c" call create-lists.bat file 
gdk_sources_msvc$(VSVER)_$(PLAT).mak ..\gdk\win32\%f]
+!endif
+
+!if [call create-lists.bat footer gdk_sources_msvc$(VSVER)_$(PLAT).mak]
+!endif
+
 !if [call create-lists.bat header gdk_sources_msvc$(VSVER)_$(PLAT).mak GDK_WIN32_INTROSPECTION_SRCS]
 !endif
 
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index acc9252e85..64e88df95d 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -58,6 +58,23 @@ GTK_GENERATED_SOURCES =      \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.c        \
        $(GTK_VERSION_H)
 
+GTK3_GDK_WIN32_VC1X_PROJS =    \
+       vs10\$(GDKWIN32_VS1X_PROJ)      \
+       vs11\$(GDKWIN32_VS1X_PROJ)      \
+       vs12\$(GDKWIN32_VS1X_PROJ)      \
+       vs14\$(GDKWIN32_VS1X_PROJ)      \
+       vs15\$(GDKWIN32_VS1X_PROJ)      \
+       vs16\$(GDKWIN32_VS1X_PROJ)      \
+       vs17\$(GDKWIN32_VS1X_PROJ)
+
+GTK3_GDK_WIN32_VC1X_PROJ_FILTERS =     \
+       vs11\$(GDKWIN32_VS1X_PROJ_FILTERS)      \
+       vs12\$(GDKWIN32_VS1X_PROJ_FILTERS)      \
+       vs14\$(GDKWIN32_VS1X_PROJ_FILTERS)      \
+       vs15\$(GDKWIN32_VS1X_PROJ_FILTERS)      \
+       vs16\$(GDKWIN32_VS1X_PROJ_FILTERS)      \
+       vs17\$(GDKWIN32_VS1X_PROJ_FILTERS)
+
 GTK3_DEMO_VC1X_PROJS = \
        vs10\$(DEMO_VS1X_PROJ)  \
        vs11\$(DEMO_VS1X_PROJ)  \
@@ -75,6 +92,11 @@ GTK3_DEMO_VC1X_PROJ_FILTERS =        \
        vs16\$(DEMO_VS1X_PROJ_FILTERS)  \
        vs17\$(DEMO_VS1X_PROJ_FILTERS)
 
+GTK3_GDK_WIN32_VCPROJS =       \
+       vs9\$(GDKWIN32_VS9_PROJ)        \
+       $(GTK3_GDK_WIN32_VC1X_PROJS)    \
+       $(GTK3_GDK_WIN32_VC1X_PROJ_FILTERS)
+
 GTK3_DEMO_VCPROJS =    \
        vs9\$(DEMO_VS9_PROJ)    \
        $(GTK3_DEMO_VC1X_PROJS) \
@@ -307,6 +329,19 @@ generate-base-sources:     \
        @$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=..\demos\widget-factory      \
        --generate-source ..\demos\widget-factory\widget-factory.gresource.xml
 
+# (Re-) generate Visual Studio projects
+gdk3-win32.sourcefiles: $(GDK_WIN32_C_SRCS)
+       @-del vs9\$(GDKWIN32_VS9_PROJ)
+       @for %%s in ($**) do @echo.   ^<File RelativePath^="..\%%s" /^>>>$@
+
+gdk3-win32.vs10.sourcefiles: $(GDK_WIN32_C_SRCS)
+       @-del vs10\$(GDKWIN32_VS1X_PROJ)
+       @for %%s in ($**) do @echo.   ^<ClCompile Include^="..\%%s" /^>>>$@
+
+gdk3-win32.vs10.sourcefiles.filters: $(GDK_WIN32_C_SRCS)
+       @-del vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+       @for %%s in ($**) do @echo.   ^<ClCompile Include^="..\%%s"^>^<Filter^>Source 
Files^</Filter^>^</ClCompile^>>>$@
+
 gtk3-demo.sourcefiles: $(demo_actual_sources)
        @-del vs9\$(DEMO_VS9_PROJ)
        @for %%s in ($**) do @echo.   ^<File RelativePath^="..\%%s" /^>>>$@
@@ -322,17 +357,48 @@ gtk3-demo.vs10.sourcefiles.filters: $(demo_actual_sources)
        @for %%s in ($**) do @echo.   ^<ClCompile Include^="..\%%s"^>^<Filter^>Source 
Files^</Filter^>^</ClCompile^>>>$@
        @for %%s in (gtkfishbowl.c main.c) do @echo.   ^<ClCompile 
Include^="..\..\demos\gtk-demo\%%s"^>^<Filter^>Source Files^</Filter^>^</ClCompile^>>>$@
 
+vs9\$(GDKWIN32_VS9_PROJ).pre: gdk3-win32.sourcefiles vs9\$(GDKWIN32_VS9_PROJ)in
+vs10\$(GDKWIN32_VS1X_PROJ).pre: gdk3-win32.vs10.sourcefiles vs10\$(GDKWIN32_VS1X_PROJ)in
+vs10\$(GDKWIN32_VS1X_PROJ_FILTERS): gdk3-win32.vs10.sourcefiles.filters vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)in
 vs9\$(DEMO_VS9_PROJ).pre: gtk3-demo.sourcefiles vs9\$(DEMO_VS9_PROJ)in
 vs10\$(DEMO_VS1X_PROJ).pre: gtk3-demo.vs10.sourcefiles vs10\$(DEMO_VS1X_PROJ)in
 vs10\$(DEMO_VS1X_PROJ_FILTERS): gtk3-demo.vs10.sourcefiles.filters vs10\$(DEMO_VS1X_PROJ_FILTERS)in
 
+vs9\$(GDKWIN32_VS9_PROJ).pre vs10\$(GDKWIN32_VS1X_PROJ).pre vs10\$(GDKWIN32_VS1X_PROJ_FILTERS) \
 vs9\$(DEMO_VS9_PROJ).pre vs10\$(DEMO_VS1X_PROJ).pre vs10\$(DEMO_VS1X_PROJ_FILTERS):
        @$(CPP) /nologo /EP /I. $(@:.pre=)in>$(@F:.pre=).tmp
        @for /f "usebackq tokens=* delims=" %%l in ($(@F:.pre=).tmp) do @echo %%l>>$@
        @-del $(@F:.pre=).tmp
-       @-if "$@" == "vs9\$(DEMO_VS9_PROJ).pre" del gtk3-demo.sourcefiles
-       @-if "$@" == "vs10\$(DEMO_VS1X_PROJ).pre" del gtk3-demo.vs10.sourcefiles
-       @-if "$@" == "vs10\$(DEMO_VS1X_PROJ_FILTERS)" del gtk3-demo.vs10.sourcefiles.filters
+       @-for %%f in ($**) do if not "%%f" == "$(@:.pre=)in" del %%f
+
+!ifdef USE_EGL
+regenerate-gdkwin32-vsproj-msg:
+       @echo Regenerating gdk3-win32 Visual Studio projects with EGL support...
+
+vs9\$(GDKWIN32_VS9_PROJ): vs9\$(GDKWIN32_VS9_PROJ).pre
+       @echo Generating $@...
+       @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@       \
+       --instring=";INSIDE_GDK_WIN32\""        \
+       --outstring=";INSIDE_GDK_WIN32;GDK_WIN32_ENABLE_EGL\""
+       @-del $**
+
+vs10\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ).pre
+       @echo Generating $@...
+       @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@       \
+       --instring=";INSIDE_GDK_WIN32;%"        \
+       --outstring=";INSIDE_GDK_WIN32;GDK_WIN32_ENABLE_EGL;%"
+       @-del $**
+!else
+regenerate-gdkwin32-vsproj-msg:
+       @echo Regenerating gdk3-win32 Visual Studio projects without EGL support...
+
+vs9\$(GDKWIN32_VS9_PROJ): vs9\$(GDKWIN32_VS9_PROJ).pre
+vs10\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ).pre
+
+vs9\$(GDKWIN32_VS9_PROJ) vs10\$(GDKWIN32_VS1X_PROJ):
+       @echo Renaming $** to $@...
+       @move $** $@
+!endif
 
 !ifdef FONT_FEATURES_DEMO
 !ifdef FONT_FEATURES_USE_PANGOFT2
@@ -373,6 +439,12 @@ vs9\$(DEMO_VS9_PROJ) vs10\$(DEMO_VS1X_PROJ):
        @move $** $@
 !endif
 
+vs11\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
+vs12\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
+vs14\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
+vs15\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
+vs16\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
+vs17\$(GDKWIN32_VS1X_PROJ): vs10\$(GDKWIN32_VS1X_PROJ)
 vs11\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
 vs12\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
 vs14\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
@@ -380,6 +452,12 @@ vs15\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
 vs16\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
 vs17\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
 
+vs11\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+vs12\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+vs14\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+vs15\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+vs16\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
+vs17\$(GDKWIN32_VS1X_PROJ_FILTERS): vs10\$(GDKWIN32_VS1X_PROJ_FILTERS)
 vs11\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
 vs12\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
 vs14\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
@@ -387,31 +465,43 @@ vs15\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
 vs16\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
 vs17\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
 
+vs11\$(GDKWIN32_VS1X_PROJ)     \
 vs11\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2012
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v110<"
 
+vs12\$(GDKWIN32_VS1X_PROJ)     \
 vs12\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2013
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v120<"
 
+vs14\$(GDKWIN32_VS1X_PROJ)     \
 vs14\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2015
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v140<"
 
+vs15\$(GDKWIN32_VS1X_PROJ)     \
 vs15\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2017
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v141<"
 
+vs16\$(GDKWIN32_VS1X_PROJ)     \
 vs16\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2019
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v142<"
 
+vs17\$(GDKWIN32_VS1X_PROJ)     \
 vs17\$(DEMO_VS1X_PROJ):
        @echo Copying and updating $** for VS2022
        @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v143<"
 
 # VS2012+ .vcxproj.filters: We simply copy the VS2010 ones
+vs11\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
+vs12\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
+vs14\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
+vs15\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
+vs16\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
+vs17\$(GDKWIN32_VS1X_PROJ_FILTERS)     \
 vs11\$(DEMO_VS1X_PROJ_FILTERS) \
 vs12\$(DEMO_VS1X_PROJ_FILTERS) \
 vs14\$(DEMO_VS1X_PROJ_FILTERS) \
@@ -447,6 +537,8 @@ regenerate-demos-h-win32: ..\demos\gtk-demo\geninclude.py $(demo_actual_sources)
        @$(PYTHON) geninclude.py demos.h.win32 $(demo_sources)
        @cd ..\..\win32
 
+regenerate-gdkwin32-vsproj: regenerate-gdkwin32-vsproj-msg $(GTK3_GDK_WIN32_VCPROJS)
+
 # Remove the generated files
 clean:
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gresource


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