[gtk/msvc-project-improvements] Visual Studio projects: Simplify building font features demo



commit 94e6536b8a3ca47b1b9edc80275ebda4ca964efe
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jan 5 13:12:32 2022 +0800

    Visual Studio projects: Simplify building font features demo
    
    Improve the NMake Makefiles that is used to re-generate demos.h(.win32)
    by re-generating the gtk3-demo Visual Studio projects, so that one would
    no longer need to do that manually.
    
    Update the build instructions accordingly.

 win32/README_FEATURES_MSVC.txt | 13 +++++++------
 win32/config-msvc.mak.in       |  7 +++++++
 win32/generate-msvc.mak        | 30 ++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 6 deletions(-)
---
diff --git a/win32/README_FEATURES_MSVC.txt b/win32/README_FEATURES_MSVC.txt
index 47f80c29cd..9a97730262 100644
--- a/win32/README_FEATURES_MSVC.txt
+++ b/win32/README_FEATURES_MSVC.txt
@@ -64,9 +64,10 @@ $(srcroot)\win32, and run
 "nmake /f generate-msvc.mak regenerate-demos-h-win32 FONT_FEATURES_DEMO=1".
 To undo that, run that command without "FONT_FEATURES_DEMO=1".  Python must
 be present in your PATH or passed in via PYTHON=<path_to_python_interpreter>.
-
-You will then need to add $(srcroot)\demos\gtk-demo\font_features.c into 
-the source list of the "gtk3-demo" project, and add the .lib file for 
-HarfBuzz, and if using pre-Pango 1.44.0 and/or pre-HarfBuzz 2.2.0, the 
-.lib files for PangoFT2 and FreeType into the "Additional Libraries" 
-entry under the linker settings.
+If you are building the font features demo with the older PangoFT2-style
+(i.e. pre-Pango-1.44.x and pre-HarfBuzz-2.2.0) support, pass in 
+"FONT_FEATURES_USE_PANGOFT2=1" in addition to "FONT_FEATURES_DEMO=1" in the 
+NMake command line.  The gtk3-demo project files will also be updated with the 
+appropriate dependent libraries linked in-please check that the project settings 
+contain the correct .lib file names for your system, as they assume the most 
+common names are used there.
diff --git a/win32/config-msvc.mak.in b/win32/config-msvc.mak.in
index e5ef631cd5..017433b97d 100644
--- a/win32/config-msvc.mak.in
+++ b/win32/config-msvc.mak.in
@@ -112,3 +112,10 @@ GTK_PREPROCESSOR_FLAGS =   \
         /DGTK_BINARY_VERSION=\"3.0.0\" \
         /DGDK_DISABLE_DEPRECATED       \
         /DISOLATION_AWARE_ENABLED
+
+DEMO_VS9_PROJ = gtk3-demo.vcproj
+DEMO_VS10_PROJ = gtk3-demo.vcxproj
+DEMO_VS10_PROJ_FILTERS = gtk3-demo.vcxproj.filters
+DEMO_DEP_LIBS_NEW_PANGO=harfbuzz.lib
+DEMO_DEP_LIBS_PANGOFT2_VS9=pangoft2-1.0.lib harfbuzz.lib freetype.lib
+DEMO_DEP_LIBS_PANGOFT2_VS1X=pangoft2-1.0.lib;harfbuzz.lib;freetype.lib
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index 99919f84d8..63cf6c5c00 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -266,6 +266,36 @@ regenerate-demos-h-win32: ..\demos\gtk-demo\geninclude.py $(demo_actual_sources)
        @-del ..\demos\gtk-demo\demos.h.win32
        @cd ..\demos\gtk-demo
        @$(PYTHON) geninclude.py demos.h.win32 $(demo_sources)
+       @cd ..\..\win32
+       @echo Regenerating gtk3-demo VS project files...
+       @-del vs9\$(DEMO_VS9_PROJ) vs10\$(DEMO_VS10_PROJ) vs10\$(DEMO_VS10_PROJ_FILTERS)
+       @for %%s in ($(demo_sources) gtkfishbowl.c demo_resources.c main.c) do  \
+       @echo.   ^<File RelativePath^="..\..\demos\gtk-demo\%%s" /^>>>gtk3-demo.sourcefiles & \
+       @echo.   ^<ClCompile Include^="..\..\demos\gtk-demo\%%s" /^>>>gtk3-demo.vs10.sourcefiles & \
+       @echo.   ^<ClCompile Include^="..\..\demos\gtk-demo\%%s"^>^<Filter^>Source 
Files^</Filter^>^</ClCompile^>>>gtk3-demo.vs10.sourcefiles.filters
+       @$(CPP) /nologo /EP /I. vs9\$(DEMO_VS9_PROJ)in>$(DEMO_VS9_PROJ).tmp
+       @for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS9_PROJ).tmp) do @echo %%l>>$(DEMO_VS9_PROJ).tmp1
+       @$(CPP) /nologo /EP /I. vs10\$(DEMO_VS10_PROJ)in>$(DEMO_VS10_PROJ).tmp
+       @for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS10_PROJ).tmp) do @echo 
%%l>>$(DEMO_VS10_PROJ).tmp1
+       @$(CPP) /nologo /EP /I. vs10\$(DEMO_VS10_PROJ_FILTERS)in> $(DEMO_VS10_PROJ_FILTERS).tmp
+       @for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS10_PROJ_FILTERS).tmp) do @ echo 
%%l>>vs10\$(DEMO_VS10_PROJ_FILTERS)
+       @if not "$(FONT_FEATURES_DEMO)" == ""   \
+        if not "$(FONT_FEATURES_USE_PANGOFT2)" == ""   \
+        ($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS9_PROJ).tmp1 -o=vs9\$(DEMO_VS9_PROJ) 
--instring="AdditionalDependencies=\"\"" 
--outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_PANGOFT2_VS9)\"") & \
+        ($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS10_PROJ).tmp1 -o=vs10\$(DEMO_VS10_PROJ) 
--instring=">%(AdditionalDependencies)<" 
--outstring=">$(DEMO_DEP_LIBS_PANGOFT2_VS1X);%(AdditionalDependencies)<")
+       @if not "$(FONT_FEATURES_DEMO)" == ""   \
+        if "$(FONT_FEATURES_USE_PANGOFT2)" == ""       \
+        ($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS9_PROJ).tmp1 -o=vs9\$(DEMO_VS9_PROJ) 
--instring="AdditionalDependencies=\"\"" --outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_NEW_PANGO)\"") 
& \
+        ($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS10_PROJ).tmp1 -o=vs10\$(DEMO_VS10_PROJ) 
--instring=">%(AdditionalDependencies)<" --outstring=">$(DEMO_DEP_LIBS_NEW_PANGO);%(AdditionalDependencies)<")
+       @if "$(FONT_FEATURES_DEMO)" == "" copy $(DEMO_VS9_PROJ).tmp1 vs9\$(DEMO_VS9_PROJ) & copy 
$(DEMO_VS10_PROJ).tmp1 vs10\$(DEMO_VS10_PROJ)
+       @del *vc*proj*.tmp* gtk3-demo.*sourcefiles*
+       @for %%v in (11 12 14 15 16 17) do @(copy /y vs10\$(DEMO_VS10_PROJ_FILTERS) vs%v\ & del 
vs%v\gtk3-demo.vcxproj)
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs11\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v110<"
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs12\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v120<"
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs14\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v140<"
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs15\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v141<"
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs16\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v142<"
+       @$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS10_PROJ) -o=vs17\$(DEMO_VS10_PROJ) 
--instring=">v100<" --outstring=">v143<"
 
 Gdk_3_0_gir_list_final: Gdk_3_0_gir_list $(GDK_GENERATED_SOURCES)
        @echo Generating $@...


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