1# Copyright 2015 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5# GYP for building gpu
6{
7  'target_defaults': {
8    'conditions': [
9      ['skia_os != "win"', {
10        'sources/': [ ['exclude', '_win.(h|cpp)$'],
11        ],
12      }],
13      ['skia_os != "mac"', {
14        'sources/': [ ['exclude', '_mac.(h|cpp|m|mm)$'],
15        ],
16      }],
17      ['skia_os != "linux" and skia_os != "chromeos"', {
18        'sources/': [ ['exclude', '_glx.(h|cpp)$'],
19        ],
20      }],
21      ['skia_os != "ios"', {
22        'sources/': [ ['exclude', '_iOS.(h|cpp|m|mm)$'],
23        ],
24      }],
25      ['skia_os != "android"', {
26        'sources/': [ ['exclude', '_android.(h|cpp)$'],
27        ],
28      }],
29      ['skia_egl == 0', {
30        'sources/': [ ['exclude', '_egl.(h|cpp)$'],
31        ],
32      }],
33      ['skia_os == "android"', {
34        'sources/': [ ['exclude', 'GrGLCreateNativeInterface_egl.cpp'],
35        ],
36      }],
37      ['skia_egl == 1', {
38        'sources/': [ ['exclude', '_glx.(h|cpp)$'],
39        ],
40      }],
41      # nullify the targets in this gyp file if skia_gpu is 0
42      [ 'skia_gpu == 0', {
43        'sources/': [
44          ['exclude', '.*'],
45        ],
46        'defines/': [
47          ['exclude', '.*'],
48        ],
49        'include_dirs/': [
50           ['exclude', '.*'],
51        ],
52        'link_settings': {
53          'libraries/': [
54            ['exclude', '.*'],
55          ],
56        },
57        'direct_dependent_settings': {
58          'defines/': [
59            ['exclude', '.*'],
60          ],
61          'include_dirs/': [
62            ['exclude', '.*'],
63          ],
64        },
65      }],
66    ],
67    'direct_dependent_settings': {
68      'conditions': [
69        [ 'skia_os == "win"', {
70          'defines': [
71            'GR_GL_FUNCTION_TYPE=__stdcall',
72          ],
73        }],
74      ],
75      'include_dirs': [
76        '../include/gpu',
77      ],
78    },
79  },
80  'targets': [
81    {
82      'target_name': 'skgpu',
83      'product_name': 'skia_skgpu',
84      'type': 'static_library',
85      'standalone_static_library': 1,
86      'dependencies': [
87        'core.gyp:*',
88        'utils.gyp:utils',
89        'etc1.gyp:libetc1',
90        'ktx.gyp:libSkKTX',
91      ],
92      'includes': [
93        'gpu.gypi',
94      ],
95      'include_dirs': [
96        '../include/gpu',
97        '../src/core',
98        '../src/gpu',
99        '../src/image/',
100      ],
101      'sources': [
102        '<@(skgpu_sources)',
103        '<@(skgpu_native_gl_sources)',
104        '<@(skgpu_angle_gl_sources)',
105        '<@(skgpu_mesa_gl_sources)',
106        '<@(skgpu_debug_gl_sources)',
107        '<@(skgpu_null_gl_sources)',
108        'gpu.gypi', # Makes the gypi appear in IDEs (but does not modify the build).
109      ],
110      'conditions': [
111        [ 'skia_gpu_extra_dependency_path', {
112          'dependencies' : [
113              '<(skia_gpu_extra_dependency_path):*',
114          ]
115        }],
116        [ 'skia_stroke_path_rendering', {
117          'sources': [
118            '../experimental/StrokePathRenderer/GrStrokePathRenderer.h',
119            '../experimental/StrokePathRenderer/GrStrokePathRenderer.cpp',
120          ],
121          'defines': [
122            'GR_STROKE_PATH_RENDERING=1',
123          ],
124        }],
125        [ 'skia_android_path_rendering', {
126          'sources': [
127            '../experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp',
128            '../experimental/AndroidPathRenderer/GrAndroidPathRenderer.h',
129            '../experimental/AndroidPathRenderer/AndroidPathRenderer.cpp',
130            '../experimental/AndroidPathRenderer/AndroidPathRenderer.h',
131            '../experimental/AndroidPathRenderer/Vertex.h',
132          ],
133          'defines': [
134            'GR_ANDROID_PATH_RENDERING=1',
135          ],
136        }],
137        [ 'skia_chrome_utils', {
138          'sources': [
139            '../experimental/ChromeUtils/SkBorder.cpp',
140            '../experimental/ChromeUtils/SkBorder.h',
141          ],
142          'defines': [
143            'GR_CHROME_UTILS=1',
144          ],
145        }],
146        [ 'skia_os == "linux" or skia_os == "chromeos"', {
147          'sources!': [
148            '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
149            '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
150          ],
151        }],
152        [ '(skia_os == "linux" or skia_os == "chromeos") and skia_egl == 1', {
153          'link_settings': {
154            'libraries': [
155              '-lEGL',
156              '-lGLESv2',
157            ],
158          },
159        }],
160        [ '(skia_os == "linux" or skia_os == "chromeos") and skia_egl == 0', {
161          'link_settings': {
162            'libraries': [
163              '-lGL',
164              '-lGLU',
165              '-lX11',
166            ],
167          },
168        }],
169        [ 'skia_egl == 1', {
170          'defines': [
171            'SK_EGL=1',
172          ],
173        }],
174        [ 'skia_egl == 0', {
175          'defines': [
176            'SK_EGL=0',
177          ],
178        }],
179        [ 'skia_mesa and skia_os == "linux"', {
180          'link_settings': {
181            'libraries': [
182              '-lOSMesa',
183            ],
184          },
185        }],
186        [ 'skia_os == "mac"', {
187          'link_settings': {
188            'libraries': [
189              '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
190            ],
191          },
192          'sources!': [
193            '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
194            '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
195          ],
196        }],
197        [ 'not skia_mesa', {
198          'sources!': [
199            '../src/gpu/gl/mesa/SkMesaGLContext.cpp',
200            '../src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp',
201          ],
202        }],
203        [ 'skia_mesa and skia_os == "mac"', {
204          'link_settings': {
205            'libraries': [
206              '/opt/X11/lib/libOSMesa.dylib',
207            ],
208          },
209          'include_dirs': [
210             '/opt/X11/include/',
211          ],
212        }],
213        [ 'skia_os in ["win", "ios"]', {
214          'sources!': [
215            '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
216            '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
217          ],
218        }],
219        [ 'skia_angle', {
220          'dependencies': [
221            'angle.gyp:*',
222          ],
223          'export_dependent_settings': [
224            'angle.gyp:*',
225          ],
226        }, { # not skia_angle
227          'sources!': [
228            '<@(skgpu_angle_gl_sources)',
229          ],
230        }],
231        [ 'skia_os == "android"', {
232          'sources!': [
233            '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
234            '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
235          ],
236          'defines': [
237            'GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1',
238          ],
239          'link_settings': {
240            'libraries': [
241              '-lGLESv2',
242              '-lEGL',
243            ],
244          },
245        }],
246      ],
247    },
248  ],
249}
250