1# Copyright 2011 The LibYuv Project Authors. All rights reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9{
10  'variables': {
11    'libyuv_disable_jpeg%': 0,
12  },
13  'targets': [
14    {
15      'target_name': 'libyuv_unittest',
16      'type': '<(gtest_target_type)',
17      'dependencies': [
18        'libyuv.gyp:libyuv',
19        'testing/gtest.gyp:gtest',
20        'third_party/gflags/gflags.gyp:gflags',
21      ],
22      'direct_dependent_settings': {
23        'defines': [
24          'GTEST_RELATIVE_PATH',
25        ],
26      },
27      'export_dependent_settings': [
28        '<(DEPTH)/testing/gtest.gyp:gtest',
29      ],
30      'sources': [
31        # headers
32        'unit_test/unit_test.h',
33
34        # sources
35        'unit_test/basictypes_test.cc',
36        'unit_test/compare_test.cc',
37        'unit_test/color_test.cc',
38        'unit_test/convert_test.cc',
39        'unit_test/cpu_test.cc',
40        'unit_test/math_test.cc',
41        'unit_test/planar_test.cc',
42        'unit_test/rotate_argb_test.cc',
43        'unit_test/rotate_test.cc',
44        'unit_test/scale_argb_test.cc',
45        'unit_test/scale_test.cc',
46        'unit_test/unit_test.cc',
47        'unit_test/video_common_test.cc',
48      ],
49      'conditions': [
50        ['OS=="linux"', {
51          'cflags': [
52            '-fexceptions',
53          ],
54        }],
55        [ 'OS == "ios" and target_subarch == 64', {
56          'defines': [
57            'LIBYUV_DISABLE_NEON'
58          ],
59        }],
60        [ 'OS == "ios"', {
61          'xcode_settings': {
62            'DEBUGGING_SYMBOLS': 'YES',
63            'DEBUG_INFORMATION_FORMAT' : 'dwarf-with-dsym',
64            # Work around compile issue with isosim.mm, see
65            # https://code.google.com/p/libyuv/issues/detail?id=548 for details.
66            'WARNING_CFLAGS': [
67              '-Wno-sometimes-uninitialized',
68            ],
69          },
70          'cflags': [
71            '-Wno-sometimes-uninitialized',
72          ],
73        }],
74        [ 'OS != "ios" and libyuv_disable_jpeg != 1', {
75          'defines': [
76            'HAVE_JPEG',
77          ],
78        }],
79        ['OS=="android"', {
80          'dependencies': [
81            '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
82          ],
83        }],
84        # TODO(YangZhang): These lines can be removed when high accuracy
85        # YUV to RGB to Neon is ported.
86        [ '(target_arch == "armv7" or target_arch == "armv7s" \
87          or (target_arch == "arm" and arm_version >= 7) \
88          or target_arch == "arm64") \
89          and (arm_neon == 1 or arm_neon_optional == 1)', {
90          'defines': [
91            'LIBYUV_NEON'
92          ],
93        }],
94      ], # conditions
95      'defines': [
96        # Enable the following 3 macros to turn off assembly for specified CPU.
97        # 'LIBYUV_DISABLE_X86',
98        # 'LIBYUV_DISABLE_NEON',
99        # 'LIBYUV_DISABLE_MIPS',
100        # Enable the following macro to build libyuv as a shared library (dll).
101        # 'LIBYUV_USING_SHARED_LIBRARY',
102      ],
103    },
104    {
105      'target_name': 'compare',
106      'type': 'executable',
107      'dependencies': [
108        'libyuv.gyp:libyuv',
109      ],
110      'sources': [
111        # sources
112        'util/compare.cc',
113      ],
114      'conditions': [
115        ['OS=="linux"', {
116          'cflags': [
117            '-fexceptions',
118          ],
119        }],
120      ], # conditions
121    },
122    {
123      'target_name': 'convert',
124      'type': 'executable',
125      'dependencies': [
126        'libyuv.gyp:libyuv',
127      ],
128      'sources': [
129        # sources
130        'util/convert.cc',
131      ],
132      'conditions': [
133        ['OS=="linux"', {
134          'cflags': [
135            '-fexceptions',
136          ],
137        }],
138      ], # conditions
139    },
140    # TODO(fbarchard): Enable SSE2 and OpenMP for better performance.
141    {
142      'target_name': 'psnr',
143      'type': 'executable',
144      'sources': [
145        # sources
146        'util/psnr_main.cc',
147        'util/psnr.cc',
148        'util/ssim.cc',
149      ],
150      'dependencies': [
151        'libyuv.gyp:libyuv',
152      ],
153      'conditions': [
154        [ 'OS == "ios" and target_subarch == 64', {
155          'defines': [
156            'LIBYUV_DISABLE_NEON'
157          ],
158        }],
159
160        [ 'OS != "ios" and libyuv_disable_jpeg != 1', {
161          'defines': [
162            'HAVE_JPEG',
163          ],
164        }],
165      ], # conditions
166    },
167
168    {
169      'target_name': 'cpuid',
170      'type': 'executable',
171      'sources': [
172        # sources
173        'util/cpuid.c',
174      ],
175      'dependencies': [
176        'libyuv.gyp:libyuv',
177      ],
178    },
179  ], # targets
180  'conditions': [
181    ['OS=="android"', {
182      'targets': [
183        {
184          # TODO(kjellander): Figure out what to change in build/apk_test.gypi
185          # to it can be used instead of the copied code below. Using it in its
186          # current version was not possible, since the target starts with 'lib',
187          # which somewhere confuses the variables.
188          'target_name': 'libyuv_unittest_apk',
189          'type': 'none',
190          'variables': {
191            # These are used to configure java_apk.gypi included below.
192            'test_type': 'gtest',
193            'apk_name': 'libyuv_unittest',
194            'test_suite_name': 'libyuv_unittest',
195            'intermediate_dir': '<(PRODUCT_DIR)/libyuv_unittest_apk',
196            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)libyuv_unittest<(SHARED_LIB_SUFFIX)',
197            'final_apk_path': '<(intermediate_dir)/libyuv_unittest-debug.apk',
198            'java_in_dir': '<(DEPTH)/testing/android/native_test/java',
199            'test_runner_path': '<(DEPTH)/util/android/test_runner.py',
200            'native_lib_target': 'libyuv_unittest',
201            'gyp_managed_install': 0,
202          },
203          'includes': [
204            'build/android/test_runner.gypi',
205            'build/java_apk.gypi',
206           ],
207          'dependencies': [
208            '<(DEPTH)/base/base.gyp:base_java',
209            # TODO(kjellander): Figure out why base_build_config_gen is needed
210            # here. It really shouldn't since it's a dependency of base_java
211            # above, but there's always 0 tests run if it's missing.
212            '<(DEPTH)/base/base.gyp:base_build_config_gen',
213            '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
214            '<(DEPTH)/build/android/pylib/remote/device/dummy/dummy.gyp:remote_device_dummy_apk',
215            '<(DEPTH)/testing/android/appurify_support.gyp:appurify_support_java',
216            '<(DEPTH)/testing/android/on_device_instrumentation.gyp:reporter_java',
217            '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
218            'libyuv_unittest',
219          ],
220        },
221      ],
222    }],
223  ],
224}
225
226# Local Variables:
227# tab-width:2
228# indent-tabs-mode:nil
229# End:
230# vim: set expandtab tabstop=2 shiftwidth=2:
231