[gtk/msvc-project-improvements: 4/4] Visual Studio projects: Generate versioned sources




commit 388d0c8391b8d3226cb829c211e2341362a42c6a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jan 3 16:38:21 2022 +0800

    Visual Studio projects: Generate versioned sources
    
    Instead of relying on the ones that are currently shipped with the tarballs,
    generate them from their .in counterparts prior to the build.  This includes
    the Resource Scripts (.rc) for libgdk/libgtk, as well as gtkversion.h, in
    addition to gdkversionmacros.h which can now be generated during prebuild.

 gtk/Makefile.am            |  2 +-
 win32/generate-msvc.mak    | 21 ++++++++++++++++-----
 win32/vs10/gdk-3.vcxprojin | 26 +++++++++++++++++++++++++-
 win32/vs9/gdk-3.vcprojin   | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 86 insertions(+), 8 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index fc4067255f..142915fae7 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1334,7 +1334,7 @@ INTROSPECTION_INTERMEDIATE_ITEMS = \
        $(top_builddir)/win32/Gtk_3_0_gir_list
 
 Gtk_3_0_gir_MSVC_FILES =               \
-       $(filter-out gtktypebuiltins.h, $(introspected_pub_headers)) \
+       $(filter-out gtktypebuiltins.h gtkversion.h, $(introspected_pub_headers)) \
        $(gtk_base_c_sources)           \
        $(gtk_os_win32_c_sources)
 
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index f017db11dc..90d85bd8d9 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -53,12 +53,14 @@ GTK_GENERATED_SOURCES =     \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkmarshalers.h       \
        .\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\gtkresources.c        \
+       .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h
 
 generate-base-sources: \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\config.h  \
        $(GDK_GENERATED_SOURCES)        \
        $(GTK_GENERATED_SOURCES)        \
+       .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdk.rc        \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk-win32.rc  \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\libgtk3.manifest      \
        .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk.gresource.xml     \
@@ -69,7 +71,12 @@ generate-base-sources:       \
 # Copy the pre-defined config.h.win32 and demos.h.win32
 .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\config.h: ..\config.h.win32
 ..\demos\gtk-demo\demos.h: ..\demos\gtk-demo\demos.h.win32
-.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk-win32.rc: ..\gtk\gtk-win32.rc.body
+
+# Generate the versioned headers and resource scripts (*.rc)
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkversionmacros.h: ..\gdk\gdkversionmacros.h.in
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h: ..\gtk\gtkversion.h.in
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdk.rc: ..\gdk\win32\rc\gdk.rc.in
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk-win32.rc: ..\gtk\gtk-win32.rc.body.in
 
 ..\gdk-$(CFG)-$(GDK_CONFIG)-build: $(GDK_CONFIG_TEMPLATE)
        @if exist ..\gdk-$(GDK_OLD_CFG)-$(GDK_DEL_CONFIG)-build del 
..\gdk-$(GDK_OLD_CFG)-$(GDK_DEL_CONFIG)-build
@@ -81,7 +88,6 @@ generate-base-sources:        \
 
 .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\config.h \
 .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkconfig.h  \
-.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk-win32.rc \
 ..\demos\gtk-demo\demos.h:
        @echo Copying $@...
        @if not exist $(@D)\ md $(@D)
@@ -118,7 +124,10 @@ generate-base-sources:     \
        @$(PYTHON) $(GLIB_MKENUMS) --template $(@F).template $(GTK_PRIVATE_TYPE_HDRS) > ..\win32\$@
        @cd ..\win32
 
-.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkversionmacros.h: ..\gdk\gdkversionmacros.h.in
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkversionmacros.h   \
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h \
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdk.rc       \
+.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtk-win32.rc:
        @echo Generating $@...
        @if not exist $(@D)\ md $(@D)
        @$(PYTHON) gen-version-items.py --version=$(GTK_VERSION) --interface-age=$(GTK_INTERFACE_AGE) 
--source=$** --output=$@
@@ -264,7 +273,7 @@ Gdk_3_0_gir_list_final: Gdk_3_0_gir_list $(GDK_GENERATED_SOURCES)
 Gtk_3_0_gir_list_final: Gtk_3_0_gir_list $(GTK_TYPEBUILTIN_SOURCES)
        @echo Generating $@...
        @type Gtk_3_0_gir_list>$@
-       @for %%s in ($(GTK_TYPEBUILTIN_SOURCES)) do echo %%s>>$@
+       @for %%s in ($(GTK_TYPEBUILTIN_SOURCES) .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h) do 
echo %%s>>$@
 
 GdkWin32_3_0_gir_list_final: GdkWin32_3_0_gir_list
        @echo Copying $@...
@@ -279,6 +288,7 @@ clean:
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtktypebuiltins.h
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkprivatetypebuiltins.c
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkprivatetypebuiltins.h
+       @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkversion.h
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.c
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.h
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkmarshalers.c
@@ -297,6 +307,7 @@ clean:
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdk.gresource.xml
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkmarshalers.c
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkmarshalers.h
+       @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdk.rc
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkversionmacros.h
        @-del /f /q .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\gdk\gdkconfig.h
        @if exist ..\gdk-$(CFG)-$(GDK_CONFIG)-build del ..\gdk-$(CFG)-$(GDK_CONFIG)-build
diff --git a/win32/vs10/gdk-3.vcxprojin b/win32/vs10/gdk-3.vcxprojin
index cd40fa6181..fd5e79eb17 100644
--- a/win32/vs10/gdk-3.vcxprojin
+++ b/win32/vs10/gdk-3.vcxprojin
@@ -143,6 +143,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       <AdditionalDependencies>$(GdkAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -166,6 +169,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       
<AdditionalDependencies>$(GdkAdditionalLibs);$(GdkBroadwayAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -186,6 +192,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       <AdditionalDependencies>$(GdkAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -208,6 +217,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       
<AdditionalDependencies>$(GdkAdditionalLibs);$(GdkBroadwayAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -233,6 +245,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       <AdditionalDependencies>$(GdkAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -256,6 +271,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       
<AdditionalDependencies>$(GdkAdditionalLibs);$(GdkBroadwayAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -276,6 +294,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       <AdditionalDependencies>$(GdkAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -298,6 +319,9 @@
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
+    <ResourceCompile>
+      
<AdditionalIncludeDirectories>..\..\gdk\win32\rc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
     <Link>
       
<AdditionalDependencies>$(GdkAdditionalLibs);$(GdkBroadwayAdditionalLibs);%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
@@ -311,7 +335,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\gdk\win32\rc\gdk.rc" />
+    <ResourceCompile Include="$(GdkGenSrcDir)\gdk\gdk.rc" />
   </ItemGroup>
   <ItemGroup>
 #include "gdk-3.vs10.sourcefiles"
diff --git a/win32/vs9/gdk-3.vcprojin b/win32/vs9/gdk-3.vcprojin
index 0e7ef550f1..9ba9da9d43 100644
--- a/win32/vs9/gdk-3.vcprojin
+++ b/win32/vs9/gdk-3.vcprojin
@@ -40,6 +40,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="4"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs)"
@@ -72,6 +76,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="4"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs) $(GdkBroadwayAdditionalLibs)"
@@ -102,6 +110,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs)"
@@ -134,6 +146,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs) $(GdkBroadwayAdditionalLibs)"
@@ -168,6 +184,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs)"
@@ -200,6 +220,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs) $(GdkBroadwayAdditionalLibs)"
@@ -230,6 +254,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs)"
@@ -262,6 +290,10 @@
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               AdditionalIncludeDirectories="..\..\gdk\win32\rc"
+                       />
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="$(GdkAdditionalLibs) $(GdkBroadwayAdditionalLibs)"
@@ -290,7 +322,18 @@
                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
                        >
-                       <File RelativePath="..\..\gdk\win32\rc\gdk.rc" />
+                       <File RelativePath=".\Debug\$(PlatformName)\obj\gdk-3\gdk\gdk.rc" >
+                               <FileConfiguration Name="Release|Win32" ExcludedFromBuild="true" ><Tool 
Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Release_Broadway|Win32" ExcludedFromBuild="true" 
<Tool Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Release|x64" ExcludedFromBuild="true" ><Tool 
Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Release_Broadway|x64" ExcludedFromBuild="true" 
<Tool Name="VCResourceCompilerTool" /></FileConfiguration>
+                       </File>
+                       <File RelativePath=".\Release\$(PlatformName)\obj\gdk-3\gdk\gdk.rc" >
+                               <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true" ><Tool 
Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Debug_Broadway|Win32" ExcludedFromBuild="true" 
<Tool Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Debug|x64" ExcludedFromBuild="true" ><Tool 
Name="VCResourceCompilerTool" /></FileConfiguration>
+                               <FileConfiguration Name="Debug_Broadway|x64" ExcludedFromBuild="true" ><Tool 
Name="VCResourceCompilerTool" /></FileConfiguration>
+                       </File>
                </Filter>
                <Filter
                        Name="Source Files"


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