From 4cd0cd67914db1da10906e40335faea7dbec1d0a Mon Sep 17 00:00:00 2001 From: elmarb Date: Wed, 7 Dec 2016 11:50:27 +0100 Subject: [PATCH] NMake ICU option builds with builtin ICU (#375) --- win32/build-rules-msvc.mak | 13 ------------- win32/config-msvc.mak | 37 ++++++++++++++++++++----------------- win32/create-lists-msvc.mak | 13 ------------- win32/detectenv-msvc.mak | 4 +++- win32/generate-msvc.mak | 2 +- win32/info-msvc.mak | 12 +++++------- win32/install.mak | 4 ---- 7 files changed, 29 insertions(+), 56 deletions(-) diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak index 03b3833..bfe0286 100644 --- a/win32/build-rules-msvc.mak +++ b/win32/build-rules-msvc.mak @@ -23,11 +23,6 @@ $< $< << -{..\src\}.cc{$(CFG)\$(PLAT)\harfbuzz-icu\}.obj:: - $(CXX) $(CFLAGS) $(HB_LIB_CFLAGS) $(HB_ICU_CFLAGS) /Fo$(CFG)\$(PLAT)\harfbuzz-icu\ /c @<< -$< -<< - {..\util\}.cc{$(CFG)\$(PLAT)\util\}.obj:: $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_CFLAGS) /Fo$(CFG)\$(PLAT)\util\ /c @<< $< @@ -48,7 +43,6 @@ $< # Rules for building .lib files $(CFG)\$(PLAT)\harfbuzz.lib: $(HARFBUZZ_DLL_FILENAME).dll -$(CFG)\$(PLAT)\harfbuzz-icu.lib: $(HARFBUZZ_ICU_DLL_FILENAME).dll $(CFG)\$(PLAT)\harfbuzz-gobject.lib: $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll # Rules for linking DLLs @@ -64,12 +58,6 @@ $(harfbuzz_dll_OBJS) << @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 -$(HARFBUZZ_ICU_DLL_FILENAME).dll: $(CFG)\$(PLAT)\harfbuzz.lib $(harfbuzz_icu_OBJS) $(CFG)\$(PLAT)\harfbuzz-icu - link /DLL $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_ICU_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz-icu.lib -out:$@ @<< -$(harfbuzz_icu_OBJS) -<< - @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 - $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll: $(CFG)\$(PLAT)\harfbuzz.lib $(harfbuzz_gobject_OBJS) $(CFG)\$(PLAT)\harfbuzz-gobject link /DLL $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_GOBJECT_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz-gobject.lib -out:$@ @<< $(harfbuzz_gobject_OBJS) @@ -131,7 +119,6 @@ clean: @-del /f /q $(CFG)\$(PLAT)\*.obj @-if exist $(CFG)\$(PLAT)\util del /f /q $(CFG)\$(PLAT)\util\*.obj @-if exist $(CFG)\$(PLAT)\harfbuzz-gobject del /f /q $(CFG)\$(PLAT)\harfbuzz-gobject\*.obj - @-if exist $(CFG)\$(PLAT)\harfbuzz-icu del /f /q $(CFG)\$(PLAT)\harfbuzz-icu\*.obj @-del /f /q $(CFG)\$(PLAT)\harfbuzz\*.obj @-rmdir /s /q $(CFG)\$(PLAT) @-if exist $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h del $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak index d8b851d..ecbbe92 100644 --- a/win32/config-msvc.mak +++ b/win32/config-msvc.mak @@ -60,29 +60,12 @@ HB_TESTS_DEP_LIBS = $(HB_GLIB_LIBS) # Use libtool-style DLL names, if desired !if "$(LIBTOOL_DLL_NAME)" == "1" HARFBUZZ_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-0 -HARFBUZZ_ICU_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-icu-0 HARFBUZZ_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-gobject-0 !else HARFBUZZ_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-vs$(VSVER) -HARFBUZZ_ICU_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-icu-vs$(VSVER) HARFBUZZ_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-gobject-vs$(VSVER) !endif -# Enable HarfBuzz-ICU, if desired -!if "$(ICU)" == "1" -HB_ICU_CFLAGS = -HB_LIBS = \ - $(HB_LIBS) \ - $(CFG)\$(PLAT)\harfbuzz-icu.lib - -# We don't want to re-define int8_t Visual Studio 2008, will cause build breakage -# as we define it in hb-common.h, and we ought to use the definitions there. -!if "$(VSVER)" == "9" -HB_ICU_CFLAGS = /DU_HAVE_INT8_T -!endif - -!endif - # Enable Introspection (enables HarfBuzz-Gobject as well) !if "$(INTROSPECTION)" == "1" GOBJECT = 1 @@ -181,6 +164,26 @@ HB_TESTS = \ $(CFG)\$(PLAT)\test-unicode.exe \ $(CFG)\$(PLAT)\test-version.exe +!elseif "$(ICU)" == "1" +# use ICU for Unicode functions +# and define some of the macros in GLib's msvc_recommended_pragmas.h +# to reduce some unneeded build-time warnings +HB_DEFINES = $(HB_DEFINES) /DHAVE_ICU=1 /DHAVE_ICU_BUILTIN=1 +HB_CFLAGS = \ + $(HB_CFLAGS) \ + /wd4244 \ + /D_CRT_SECURE_NO_WARNINGS \ + /D_CRT_NONSTDC_NO_WARNINGS + +# We don't want ICU to re-define int8_t in VS 2008, will cause build breakage +# as we define it in hb-common.h, and we ought to use the definitions there. +!if "$(VSVER)" == "9" +HB_CFLAGS = $(HB_CFLAGS) /DU_HAVE_INT8_T +!endif + +HB_SOURCES = $(HB_SOURCES) $(HB_ICU_sources) +HB_HEADERS = $(HB_HEADERS) $(HB_ICU_headers) +HB_DEP_LIBS = $(HB_DEP_LIBS) $(HB_ICU_DEP_LIBS) !else # If there is no GLib support, use the built-in UCDN # and define some of the macros in GLib's msvc_recommended_pragmas.h diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak index 9b5574b..dbd2a57 100644 --- a/win32/create-lists-msvc.mak +++ b/win32/create-lists-msvc.mak @@ -59,19 +59,6 @@ NULL= !endif !endif -# For HarfBuzz-ICU -!if "$(ICU)" == "1" - -!if [call create-lists.bat header hb_objs.mak harfbuzz_icu_OBJS] -!endif - -!if [for %c in ($(HB_ICU_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\harfbuzz-icu\%~nc.obj] -!endif - -!if [call create-lists.bat footer hb_objs.mak] -!endif -!endif - # For the utility programs (GLib support is required) !if "$(GLIB)" == "1" diff --git a/win32/detectenv-msvc.mak b/win32/detectenv-msvc.mak index 80a5eed..ca09793 100644 --- a/win32/detectenv-msvc.mak +++ b/win32/detectenv-msvc.mak @@ -110,7 +110,9 @@ VALID_CFGSET = TRUE # the resulting binaries !if "$(CFG)" == "release" CFLAGS_ADD = /MD /O2 /GL /MP -!if "$(VSVER)" != "9" +!if $(VSVER) > 9 && $(VSVER) < 14 +# Undocumented "enhance optimized debugging" switch. Became documented +# as "/Zo" in VS 2013 Update 3, and is turned on by default in VS 2015. CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+ !endif !else diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak index 57cfb6e..32214eb 100644 --- a/win32/generate-msvc.mak +++ b/win32/generate-msvc.mak @@ -22,5 +22,5 @@ $(HB_GOBJECT_ENUM_GENERATED_SOURCES): ..\src\hb-gobject-enums.h.tmpl ..\src\hb-g !endif # Create the build directories -$(CFG)\$(PLAT)\harfbuzz $(CFG)\$(PLAT)\harfbuzz-icu $(CFG)\$(PLAT)\harfbuzz-gobject $(CFG)\$(PLAT)\util: +$(CFG)\$(PLAT)\harfbuzz $(CFG)\$(PLAT)\harfbuzz-gobject $(CFG)\$(PLAT)\util: @-md $@ diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak index bbe631b..3ec11d4 100644 --- a/win32/info-msvc.mak +++ b/win32/info-msvc.mak @@ -11,6 +11,8 @@ BUILT_TOOLS = hb-shape.exe hb-ot-shape-closure.exe !if "$(CAIRO_FT)" == "1" BUILT_TOOLS = hb-view.exe $(BUILT_TOOLS) !endif +!elseif "$(ICU)" == "1" +UNICODE_IMPL = ICU !else UNICODE_IMPL = ucdn !endif @@ -31,10 +33,6 @@ INC_FEATURES = $(INC_FEATURES) Uniscribe INC_FEATURES = $(INC_FEATURES) DirectWrite !endif -!if "$(ICU)" == "1" -BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-ICU -!endif - !if "$(GOBJECT)" == "1" BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-GObject !endif @@ -101,20 +99,20 @@ help: @echo library. Enables the build of utility programs. @echo. @echo ICU: - @echo Enable the HarfBuzz-ICU layout library, requires the International + @echo Enable build with ICU Unicode functions, requires the International @echo Components for Unicode (ICU) libraries. @echo. @echo GOBJECT: @echo Enable the HarfBuzz-GObject library, also implies GLib2 support, @echo requires the GNOME GLib2 libraries and tools, notably the glib-mkenums - @echo tool script, which will require a PERL interpretor (use + @echo tool script, which will require a PERL interpreter (use @echo PERL=^$(PATH_TO_PERL_INTERPRETOR)) if it is not already in your PATH). @echo. @echo INTROSPECTION: @echo Enable the build of introspection files, also implies GObject/GLib2 support, @echo requires the GNOME gobject-introspection libraries and tools. You will need @echo to ensure the pkg-config (.pc) files can be found for GObject-2.0 and the - @echo Python interpretor (that was used to build the gobject-introsoection tools) + @echo Python interpreter (that was used to build the gobject-introspection tools) @echo can be found by setting PKG_CONFIG_PATH beforehand, and passing in PYTHON= @echo ^$(PATH_TO_PYTHON_INTERPRETOR) respectively, if python.exe is not already @echo in your PATH. diff --git a/win32/install.mak b/win32/install.mak index fa239ea..e0a38e3 100644 --- a/win32/install.mak +++ b/win32/install.mak @@ -8,9 +8,6 @@ install: all @copy /b $(HARFBUZZ_DLL_FILENAME).dll $(PREFIX)\bin @copy /b $(HARFBUZZ_DLL_FILENAME).pdb $(PREFIX)\bin @copy /b $(CFG)\$(PLAT)\harfbuzz.lib $(PREFIX)\lib - @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(HARFBUZZ_ICU_DLL_FILENAME).dll $(PREFIX)\bin - @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(HARFBUZZ_ICU_DLL_FILENAME).pdb $(PREFIX)\bin - @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(CFG)\$(PLAT)\harfbuzz-icu.lib $(PREFIX)\lib @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll $(PREFIX)\bin @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(HARFBUZZ_GOBJECT_DLL_FILENAME).pdb $(PREFIX)\bin @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(CFG)\$(PLAT)\harfbuzz-gobject.lib $(PREFIX)\lib @@ -21,7 +18,6 @@ install: all @if exist $(CFG)\$(PLAT)\hb-shape.exe copy /b $(CFG)\$(PLAT)\hb-shape.exe $(PREFIX)\bin @if exist $(CFG)\$(PLAT)\hb-shape.exe copy /b $(CFG)\$(PLAT)\hb-shape.pdb $(PREFIX)\bin @for %h in ($(HB_ACTUAL_HEADERS)) do @copy %h $(PREFIX)\include\harfbuzz - @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll for %h in ($(HB_ICU_headers)) do @copy ..\src\%h $(PREFIX)\include\harfbuzz @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll for %h in ($(HB_GOBJECT_headers)) do @copy ..\src\%h $(PREFIX)\include\harfbuzz @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h $(PREFIX)\include\harfbuzz @rem Copy the generated introspection files -- 2.7.4