UNPKG

6.83 kBPlain TextView Raw
1{
2 'conditions': [
3 ['OS=="win"', {
4 'variables': {
5 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
6 'with_jpeg%': 'false',
7 'with_gif%': 'false',
8 'with_rsvg%': 'false',
9 'variables': { # Nest jpeg_root to evaluate it before with_jpeg
10 'jpeg_root%': '<!(node ./util/win_jpeg_lookup)'
11 },
12 'jpeg_root%': '<(jpeg_root)', # Take value of nested variable
13 'conditions': [
14 ['jpeg_root==""', {
15 'with_jpeg%': 'false'
16 }, {
17 'with_jpeg%': 'true'
18 }]
19 ]
20 }
21 }, { # 'OS!="win"'
22 'variables': {
23 'with_jpeg%': '<!(node ./util/has_lib.js jpeg)',
24 'with_gif%': '<!(node ./util/has_lib.js gif)',
25 'with_rsvg%': '<!(node ./util/has_lib.js rsvg)'
26 }
27 }]
28 ],
29 'targets': [
30 {
31 'target_name': 'canvas-postbuild',
32 'dependencies': ['canvas'],
33 'conditions': [
34 ['OS=="win"', {
35 'copies': [{
36 'destination': '<(PRODUCT_DIR)',
37 'files': [
38 '<(GTK_Root)/bin/zlib1.dll',
39 '<(GTK_Root)/bin/libintl-8.dll',
40 '<(GTK_Root)/bin/libpng14-14.dll',
41 '<(GTK_Root)/bin/libpangocairo-1.0-0.dll',
42 '<(GTK_Root)/bin/libpango-1.0-0.dll',
43 '<(GTK_Root)/bin/libpangoft2-1.0-0.dll',
44 '<(GTK_Root)/bin/libpangowin32-1.0-0.dll',
45 '<(GTK_Root)/bin/libcairo-2.dll',
46 '<(GTK_Root)/bin/libfontconfig-1.dll',
47 '<(GTK_Root)/bin/libfreetype-6.dll',
48 '<(GTK_Root)/bin/libglib-2.0-0.dll',
49 '<(GTK_Root)/bin/libgobject-2.0-0.dll',
50 '<(GTK_Root)/bin/libgmodule-2.0-0.dll',
51 '<(GTK_Root)/bin/libgthread-2.0-0.dll',
52 '<(GTK_Root)/bin/libexpat-1.dll'
53 ]
54 }]
55 }]
56 ]
57 },
58 {
59 'target_name': 'canvas',
60 'include_dirs': ["<!(node -e \"require('nan')\")"],
61 'sources': [
62 'src/backend/Backend.cc',
63 'src/backend/ImageBackend.cc',
64 'src/backend/PdfBackend.cc',
65 'src/backend/SvgBackend.cc',
66 'src/bmp/BMPParser.cc',
67 'src/Backends.cc',
68 'src/Canvas.cc',
69 'src/CanvasGradient.cc',
70 'src/CanvasPattern.cc',
71 'src/CanvasRenderingContext2d.cc',
72 'src/closure.cc',
73 'src/color.cc',
74 'src/Image.cc',
75 'src/ImageData.cc',
76 'src/init.cc',
77 'src/register_font.cc'
78 ],
79 'conditions': [
80 ['OS=="win"', {
81 'libraries': [
82 '-l<(GTK_Root)/lib/cairo.lib',
83 '-l<(GTK_Root)/lib/libpng.lib',
84 '-l<(GTK_Root)/lib/pangocairo-1.0.lib',
85 '-l<(GTK_Root)/lib/pango-1.0.lib',
86 '-l<(GTK_Root)/lib/freetype.lib',
87 '-l<(GTK_Root)/lib/glib-2.0.lib',
88 '-l<(GTK_Root)/lib/gobject-2.0.lib'
89 ],
90 'include_dirs': [
91 '<(GTK_Root)/include',
92 '<(GTK_Root)/include/cairo',
93 '<(GTK_Root)/include/pango-1.0',
94 '<(GTK_Root)/include/glib-2.0',
95 '<(GTK_Root)/include/freetype2',
96 '<(GTK_Root)/lib/glib-2.0/include'
97 ],
98 'defines': [
99 '_USE_MATH_DEFINES' # for M_PI
100 ],
101 'configurations': {
102 'Debug': {
103 'msvs_settings': {
104 'VCCLCompilerTool': {
105 'WarningLevel': 4,
106 'ExceptionHandling': 1,
107 'DisableSpecificWarnings': [
108 4100, 4611
109 ]
110 }
111 }
112 },
113 'Release': {
114 'msvs_settings': {
115 'VCCLCompilerTool': {
116 'WarningLevel': 4,
117 'ExceptionHandling': 1,
118 'DisableSpecificWarnings': [
119 4100, 4611
120 ]
121 }
122 }
123 }
124 }
125 }, { # 'OS!="win"'
126 'libraries': [
127 '<!@(pkg-config pixman-1 --libs)',
128 '<!@(pkg-config cairo --libs)',
129 '<!@(pkg-config libpng --libs)',
130 '<!@(pkg-config pangocairo --libs)',
131 '<!@(pkg-config freetype2 --libs)'
132 ],
133 'include_dirs': [
134 '<!@(pkg-config cairo --cflags-only-I | sed s/-I//g)',
135 '<!@(pkg-config libpng --cflags-only-I | sed s/-I//g)',
136 '<!@(pkg-config pangocairo --cflags-only-I | sed s/-I//g)',
137 '<!@(pkg-config freetype2 --cflags-only-I | sed s/-I//g)'
138 ],
139 'cflags!': ['-fno-exceptions'],
140 'cflags_cc!': ['-fno-exceptions']
141 }],
142 ['OS=="mac"', {
143 'xcode_settings': {
144 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
145 }
146 }],
147 ['with_jpeg=="true"', {
148 'defines': [
149 'HAVE_JPEG'
150 ],
151 'conditions': [
152 ['OS=="win"', {
153 'copies': [{
154 'destination': '<(PRODUCT_DIR)',
155 'files': [
156 '<(jpeg_root)/bin/jpeg62.dll',
157 ]
158 }],
159 'include_dirs': [
160 '<(jpeg_root)/include'
161 ],
162 'libraries': [
163 '-l<(jpeg_root)/lib/jpeg.lib',
164 ]
165 }, {
166 'libraries': [
167 '-ljpeg'
168 ]
169 }]
170 ]
171 }],
172 ['with_gif=="true"', {
173 'defines': [
174 'HAVE_GIF'
175 ],
176 'conditions': [
177 ['OS=="win"', {
178 'libraries': [
179 '-l<(GTK_Root)/lib/gif.lib'
180 ]
181 }, {
182 'libraries': [
183 '-lgif'
184 ]
185 }]
186 ]
187 }],
188 ['with_rsvg=="true"', {
189 'defines': [
190 'HAVE_RSVG'
191 ],
192 'conditions': [
193 ['OS=="win"', {
194 'copies': [{
195 'destination': '<(PRODUCT_DIR)',
196 'files': [
197 '<(GTK_Root)/bin/librsvg-2-2.dll',
198 '<(GTK_Root)/bin/libgdk_pixbuf-2.0-0.dll',
199 '<(GTK_Root)/bin/libgio-2.0-0.dll',
200 '<(GTK_Root)/bin/libcroco-0.6-3.dll',
201 '<(GTK_Root)/bin/libgsf-1-114.dll',
202 '<(GTK_Root)/bin/libxml2-2.dll'
203 ]
204 }],
205 'libraries': [
206 '-l<(GTK_Root)/lib/librsvg-2-2.lib'
207 ]
208 }, {
209 'include_dirs': [
210 '<!@(pkg-config librsvg-2.0 --cflags-only-I | sed s/-I//g)'
211 ],
212 'libraries': [
213 '<!@(pkg-config librsvg-2.0 --libs)'
214 ]
215 }]
216 ]
217 }]
218 ]
219 }
220 ]
221}