1 | {
|
2 | 'variables': {
|
3 | 'vips_version': '<!(node -p "require(\'./lib/libvips\').minimumLibvipsVersion")',
|
4 | 'platform_and_arch': '<!(node -p "require(\'./lib/platform\')()")',
|
5 | 'sharp_vendor_dir': './vendor/<(vips_version)/<(platform_and_arch)'
|
6 | },
|
7 | 'targets': [{
|
8 | 'target_name': 'libvips-cpp',
|
9 | 'conditions': [
|
10 | ['OS == "win"', {
|
11 |
|
12 | 'type': 'shared_library',
|
13 | 'defines': [
|
14 | 'VIPS_CPLUSPLUS_EXPORTS',
|
15 | '_ALLOW_KEYWORD_MACROS'
|
16 | ],
|
17 | 'sources': [
|
18 | 'src/libvips/cplusplus/VError.cpp',
|
19 | 'src/libvips/cplusplus/VConnection.cpp',
|
20 | 'src/libvips/cplusplus/VInterpolate.cpp',
|
21 | 'src/libvips/cplusplus/VImage.cpp'
|
22 | ],
|
23 | 'include_dirs': [
|
24 | '<(sharp_vendor_dir)/include',
|
25 | '<(sharp_vendor_dir)/include/glib-2.0',
|
26 | '<(sharp_vendor_dir)/lib/glib-2.0/include'
|
27 | ],
|
28 | 'link_settings': {
|
29 | 'library_dirs': ['<(sharp_vendor_dir)/lib'],
|
30 | 'libraries': [
|
31 | 'libvips.lib',
|
32 | 'libglib-2.0.lib',
|
33 | 'libgobject-2.0.lib'
|
34 | ],
|
35 | },
|
36 | 'configurations': {
|
37 | 'Release': {
|
38 | 'msvs_settings': {
|
39 | 'VCCLCompilerTool': {
|
40 | 'ExceptionHandling': 1,
|
41 | 'Optimization': 1,
|
42 | 'WholeProgramOptimization': 'true'
|
43 | },
|
44 | 'VCLibrarianTool': {
|
45 | 'AdditionalOptions': [
|
46 | '/LTCG:INCREMENTAL'
|
47 | ]
|
48 | },
|
49 | 'VCLinkerTool': {
|
50 | 'ImageHasSafeExceptionHandlers': 'false',
|
51 | 'OptimizeReferences': 2,
|
52 | 'EnableCOMDATFolding': 2,
|
53 | 'LinkIncremental': 1,
|
54 | 'AdditionalOptions': [
|
55 | '/LTCG:INCREMENTAL'
|
56 | ]
|
57 | }
|
58 | },
|
59 | 'msvs_disabled_warnings': [
|
60 | 4275
|
61 | ]
|
62 | }
|
63 | }
|
64 | }, {
|
65 |
|
66 | 'type': 'none'
|
67 | }]
|
68 | ]
|
69 | }, {
|
70 | 'target_name': 'sharp-<(platform_and_arch)',
|
71 | 'defines': [
|
72 | 'NAPI_VERSION=5'
|
73 | ],
|
74 | 'dependencies': [
|
75 | '<!(node -p "require(\'node-addon-api\').gyp")',
|
76 | 'libvips-cpp'
|
77 | ],
|
78 | 'variables': {
|
79 | 'runtime_link%': 'shared',
|
80 | 'conditions': [
|
81 | ['OS != "win"', {
|
82 | 'pkg_config_path': '<!(node -p "require(\'./lib/libvips\').pkgConfigPath()")',
|
83 | 'use_global_libvips': '<!(node -p "Boolean(require(\'./lib/libvips\').useGlobalLibvips()).toString()")'
|
84 | }, {
|
85 | 'pkg_config_path': '',
|
86 | 'use_global_libvips': ''
|
87 | }]
|
88 | ]
|
89 | },
|
90 | 'sources': [
|
91 | 'src/common.cc',
|
92 | 'src/metadata.cc',
|
93 | 'src/stats.cc',
|
94 | 'src/operations.cc',
|
95 | 'src/pipeline.cc',
|
96 | 'src/utilities.cc',
|
97 | 'src/sharp.cc'
|
98 | ],
|
99 | 'include_dirs': [
|
100 | '<!(node -p "require(\'node-addon-api\').include_dir")',
|
101 | ],
|
102 | 'conditions': [
|
103 | ['use_global_libvips == "true"', {
|
104 |
|
105 | 'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
|
106 | 'conditions': [
|
107 | ['runtime_link == "static"', {
|
108 | 'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs --static vips-cpp)']
|
109 | }, {
|
110 | 'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)']
|
111 | }],
|
112 | ['OS == "linux"', {
|
113 | 'defines': [
|
114 |
|
115 | '_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
|
116 | ]
|
117 | }]
|
118 | ]
|
119 | }, {
|
120 |
|
121 | 'include_dirs': [
|
122 | '<(sharp_vendor_dir)/include',
|
123 | '<(sharp_vendor_dir)/include/glib-2.0',
|
124 | '<(sharp_vendor_dir)/lib/glib-2.0/include'
|
125 | ],
|
126 | 'conditions': [
|
127 | ['OS == "win"', {
|
128 | 'defines': [
|
129 | '_ALLOW_KEYWORD_MACROS',
|
130 | '_FILE_OFFSET_BITS=64'
|
131 | ],
|
132 | 'link_settings': {
|
133 | 'library_dirs': ['<(sharp_vendor_dir)/lib'],
|
134 | 'libraries': [
|
135 | 'libvips.lib',
|
136 | 'libglib-2.0.lib',
|
137 | 'libgobject-2.0.lib'
|
138 | ]
|
139 | }
|
140 | }],
|
141 | ['OS == "mac"', {
|
142 | 'link_settings': {
|
143 | 'library_dirs': ['../<(sharp_vendor_dir)/lib'],
|
144 | 'libraries': [
|
145 | 'libvips-cpp.42.dylib'
|
146 | ]
|
147 | },
|
148 | 'xcode_settings': {
|
149 | 'OTHER_LDFLAGS': [
|
150 |
|
151 | '-Wl,-rpath,\'@loader_path/../../<(sharp_vendor_dir)/lib\''
|
152 | ]
|
153 | }
|
154 | }],
|
155 | ['OS == "linux"', {
|
156 | 'defines': [
|
157 | '_GLIBCXX_USE_CXX11_ABI=1'
|
158 | ],
|
159 | 'link_settings': {
|
160 | 'library_dirs': ['../<(sharp_vendor_dir)/lib'],
|
161 | 'libraries': [
|
162 | '-l:libvips-cpp.so.42'
|
163 | ],
|
164 | 'ldflags': [
|
165 |
|
166 | '-Wl,-s -Wl,--disable-new-dtags -Wl,-rpath=\'$$ORIGIN/../../<(sharp_vendor_dir)/lib\''
|
167 | ]
|
168 | }
|
169 | }]
|
170 | ]
|
171 | }]
|
172 | ],
|
173 | 'cflags_cc': [
|
174 | '-std=c++0x',
|
175 | '-fexceptions',
|
176 | '-Wall',
|
177 | '-Os'
|
178 | ],
|
179 | 'xcode_settings': {
|
180 | 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
|
181 | 'MACOSX_DEPLOYMENT_TARGET': '10.9',
|
182 | 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
183 | 'GCC_ENABLE_CPP_RTTI': 'YES',
|
184 | 'OTHER_CPLUSPLUSFLAGS': [
|
185 | '-fexceptions',
|
186 | '-Wall',
|
187 | '-Oz'
|
188 | ]
|
189 | },
|
190 | 'configurations': {
|
191 | 'Release': {
|
192 | 'conditions': [
|
193 | ['OS == "linux"', {
|
194 | 'cflags_cc': [
|
195 | '-Wno-cast-function-type'
|
196 | ]
|
197 | }],
|
198 | ['target_arch == "arm"', {
|
199 | 'cflags_cc': [
|
200 | '-Wno-psabi'
|
201 | ]
|
202 | }],
|
203 | ['OS == "win"', {
|
204 | 'msvs_settings': {
|
205 | 'VCCLCompilerTool': {
|
206 | 'ExceptionHandling': 1,
|
207 | 'Optimization': 1,
|
208 | 'WholeProgramOptimization': 'true'
|
209 | },
|
210 | 'VCLibrarianTool': {
|
211 | 'AdditionalOptions': [
|
212 | '/LTCG:INCREMENTAL'
|
213 | ]
|
214 | },
|
215 | 'VCLinkerTool': {
|
216 | 'ImageHasSafeExceptionHandlers': 'false',
|
217 | 'OptimizeReferences': 2,
|
218 | 'EnableCOMDATFolding': 2,
|
219 | 'LinkIncremental': 1,
|
220 | 'AdditionalOptions': [
|
221 | '/LTCG:INCREMENTAL'
|
222 | ]
|
223 | }
|
224 | },
|
225 | 'msvs_disabled_warnings': [
|
226 | 4275
|
227 | ]
|
228 | }]
|
229 | ]
|
230 | }
|
231 | },
|
232 | }]
|
233 | }
|