From b999434414a81d44caaa8423f39ae355ae411889 Mon Sep 17 00:00:00 2001 From: Sepehr Laal Date: Thu, 3 Sep 2015 20:33:35 -0700 Subject: [PATCH 1/6] Added support for JPEG on Windows --- binding.gyp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index b0d713776..85fabf560 100755 --- a/binding.gyp +++ b/binding.gyp @@ -3,6 +3,7 @@ ['OS=="win"', { 'variables': { 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle + 'JPEG_ROOT%': 'C:/libjpeg-turbo', # Set the location of LibJpeg Turbo 'with_jpeg%': 'false', 'with_gif%': 'false', 'with_pango%': 'false', @@ -141,7 +142,10 @@ 'conditions': [ ['OS=="win"', { 'libraries': [ - '-l<(GTK_Root)/lib/jpeg.lib' + '-l<(JPEG_ROOT)/lib/jpeg.lib' + ], + 'include_dirs': [ + '<(JPEG_ROOT)/include' ] }, { 'libraries': [ From 01a1fc1fd798e894d2c15dc44a4e20826c8afcdc Mon Sep 17 00:00:00 2001 From: Sepehr Laal Date: Thu, 3 Sep 2015 20:41:56 -0700 Subject: [PATCH 2/6] Added support for Pango on Windows --- binding.gyp | 12 ++++++++++-- src/CanvasRenderingContext2d.cc | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index 85fabf560..b007d325f 100755 --- a/binding.gyp +++ b/binding.gyp @@ -123,8 +123,16 @@ 'conditions': [ ['OS=="win"', { 'libraries': [ - '-l<(GTK_Root)/lib/pangocairo.lib' - ] + '-l<(GTK_Root)/lib/fontconfig.lib', + '-l<(GTK_Root)/lib/gobject-2.0.lib', + '-l<(GTK_Root)/lib/pango-1.0.lib', + '-l<(GTK_Root)/lib/pangocairo-1.0.lib' + ], + 'include_dirs': [ + '<(GTK_Root)/include/glib-2.0', + '<(GTK_Root)/lib/glib-2.0/include', + '<(GTK_Root)/include/pango-1.0', + ] }, { # 'OS!="win"' 'include_dirs': [ # tried to pass through cflags but failed ' Date: Thu, 3 Sep 2015 20:45:17 -0700 Subject: [PATCH 3/6] Added support for GifLib on Windows --- binding.gyp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index b007d325f..9115bb55f 100755 --- a/binding.gyp +++ b/binding.gyp @@ -4,6 +4,7 @@ 'variables': { 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle 'JPEG_ROOT%': 'C:/libjpeg-turbo', # Set the location of LibJpeg Turbo + 'GIF_Root': 'C:/giflib', # Set the location of GifLib source root 'with_jpeg%': 'false', 'with_gif%': 'false', 'with_pango%': 'false', @@ -168,9 +169,16 @@ ], 'conditions': [ ['OS=="win"', { - 'libraries': [ - '-l<(GTK_Root)/lib/gif.lib' - ] + 'sources': [ + '<(GIF_Root)/lib/dgif_lib.c', + '<(GIF_Root)/lib/egif_lib.c', + '<(GIF_Root)/lib/gif_err.c', + '<(GIF_Root)/lib/gif_font.c', + '<(GIF_Root)/lib/gif_hash.c', + '<(GIF_Root)/lib/quantize.c', + '<(GIF_Root)/lib/gifalloc.c' + ], + 'include_dirs': ["<(GIF_Root)/lib"] }, { 'libraries': [ '-lgif' From 7885c3bec05c6beb9fa596970d44f1d138c40596 Mon Sep 17 00:00:00 2001 From: Sepehr Laal Date: Thu, 3 Sep 2015 20:55:08 -0700 Subject: [PATCH 4/6] Added FreeType support on Windows --- binding.gyp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index 9115bb55f..0a9bc6b45 100755 --- a/binding.gyp +++ b/binding.gyp @@ -5,6 +5,8 @@ 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle 'JPEG_ROOT%': 'C:/libjpeg-turbo', # Set the location of LibJpeg Turbo 'GIF_Root': 'C:/giflib', # Set the location of GifLib source root + # NOTE: Freetype2 when built and installed by CMake, creates the include directory like: linclude/freetype2. You need to rename freetype2 to freetype. + 'FT_Root': 'C:/freetype', # Points to Freetype root of CMake install directory 'with_jpeg%': 'false', 'with_gif%': 'false', 'with_pango%': 'false', @@ -74,6 +76,9 @@ 'WarningLevel': 4, 'ExceptionHandling': 1, 'DisableSpecificWarnings': [4100, 4127, 4201, 4244, 4267, 4506, 4611, 4714, 4512] + }, + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': ['libcmtd'] } } }, @@ -83,6 +88,9 @@ 'WarningLevel': 4, 'ExceptionHandling': 1, 'DisableSpecificWarnings': [4100, 4127, 4201, 4244, 4267, 4506, 4611, 4714, 4512] + }, + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': ['libcmt'] } } } @@ -107,7 +115,13 @@ ], 'conditions': [ ['OS=="win"', { - # No support for windows right now. + 'libraries': [ + '-l<(FT_Root)/lib/freetype.lib' + ], + 'include_dirs': [ + '<(FT_Root)/include', + '<(FT_Root)/include/freetype' + ] }, { # 'OS!="win"' 'include_dirs': [ # tried to pass through cflags but failed. # Need to include the header files of cairo AND freetype. From 871bf216a27e8cd6c8d4e073e8b51f38324bf5c9 Mon Sep 17 00:00:00 2001 From: Sepehr Laal Date: Thu, 3 Sep 2015 21:04:46 -0700 Subject: [PATCH 5/6] moved /NODEFAULTLIB command to FreeType condition only --- binding.gyp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/binding.gyp b/binding.gyp index 0a9bc6b45..3d274c873 100755 --- a/binding.gyp +++ b/binding.gyp @@ -76,9 +76,6 @@ 'WarningLevel': 4, 'ExceptionHandling': 1, 'DisableSpecificWarnings': [4100, 4127, 4201, 4244, 4267, 4506, 4611, 4714, 4512] - }, - 'VCLinkerTool': { - 'IgnoreDefaultLibraryNames': ['libcmtd'] } } }, @@ -88,9 +85,6 @@ 'WarningLevel': 4, 'ExceptionHandling': 1, 'DisableSpecificWarnings': [4100, 4127, 4201, 4244, 4267, 4506, 4611, 4714, 4512] - }, - 'VCLinkerTool': { - 'IgnoreDefaultLibraryNames': ['libcmt'] } } } @@ -121,7 +115,23 @@ 'include_dirs': [ '<(FT_Root)/include', '<(FT_Root)/include/freetype' - ] + ], + 'configurations': { + 'Debug': { + 'msvs_settings': { + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': ['libcmtd'] + } + } + }, + 'Release': { + 'msvs_settings': { + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': ['libcmt'] + } + } + } + } }, { # 'OS!="win"' 'include_dirs': [ # tried to pass through cflags but failed. # Need to include the header files of cairo AND freetype. From 6a47205a6b490e1e49f867162edd7a207f40f9a1 Mon Sep 17 00:00:00 2001 From: Sepehr Laal Date: Thu, 3 Sep 2015 21:07:19 -0700 Subject: [PATCH 6/6] Added a proxy unistd.h for various packages that expect it on Windows --- binding.gyp | 1 + src/unistd/unistd.h | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 src/unistd/unistd.h diff --git a/binding.gyp b/binding.gyp index 3d274c873..665f9075d 100755 --- a/binding.gyp +++ b/binding.gyp @@ -64,6 +64,7 @@ 'include_dirs': [ '<(GTK_Root)/include', '<(GTK_Root)/include/cairo', + 'src/unistd' # needed for Freetype, GifLib, and Pango ], 'defines': [ 'snprintf=_snprintf', diff --git a/src/unistd/unistd.h b/src/unistd/unistd.h new file mode 100644 index 000000000..a09c3ee44 --- /dev/null +++ b/src/unistd/unistd.h @@ -0,0 +1,2 @@ +/* This is needed on Windows (MSVC) for Freetype, Pango, and GifLib to pass compilation */ +#include \ No newline at end of file