blob: f73a1a4b745e4ff53cf589027674c09f70c7c395 [file] [log] [blame]
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -08001# Copyright 2011 The LibYuv Project Authors. All rights reserved.
Shri Borde7cd81492011-11-02 13:20:24 -07002#
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
Hangyu Kuangf047e7c2016-07-06 14:21:45 -07006# in the file PATENTS. All contributing project authors may
Shri Borde7cd81492011-11-02 13:20:24 -07007# be found in the AUTHORS file in the root of the source tree.
8
9{
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070010 'includes': [
11 'libyuv.gypi',
12 ],
13 # Make sure that if we are being compiled to an xcodeproj, nothing tries to
14 # include a .pch.
15 'xcode_settings': {
16 'GCC_PREFIX_HEADER': '',
17 'GCC_PRECOMPILE_PREFIX_HEADER': 'NO',
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -080018 },
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070019 'variables': {
20 'use_system_libjpeg%': 0,
Frank Barchardb83bb382017-02-22 18:01:07 -080021 # Can be enabled if your jpeg has GYP support.
22 'libyuv_disable_jpeg%': 1,
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070023 # 'chromium_code' treats libyuv as internal and increases warning level.
24 'chromium_code': 1,
25 # clang compiler default variable usable by other apps that include libyuv.
26 'clang%': 0,
27 # Link-Time Optimizations.
28 'use_lto%': 0,
Frank Barchardb83bb382017-02-22 18:01:07 -080029 'mips_msa%': 0, # Default to msa off.
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070030 'build_neon': 0,
Frank Barchardb83bb382017-02-22 18:01:07 -080031 'build_msa': 0,
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070032 'conditions': [
33 ['(target_arch == "armv7" or target_arch == "armv7s" or \
34 (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
Frank Barchardb83bb382017-02-22 18:01:07 -080035 and (arm_neon == 1 or arm_neon_optional == 1)', {
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070036 'build_neon': 1,
37 }],
Frank Barchardb83bb382017-02-22 18:01:07 -080038 ['(target_arch == "mipsel" or target_arch == "mips64el")\
39 and (mips_msa == 1)',
40 {
41 'build_msa': 1,
42 }],
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070043 ],
44 },
45
Shri Borde7cd81492011-11-02 13:20:24 -070046 'targets': [
47 {
48 'target_name': 'libyuv',
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070049 # Change type to 'shared_library' to build .so or .dll files.
Shri Borde7cd81492011-11-02 13:20:24 -070050 'type': 'static_library',
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070051 'variables': {
52 'optimize': 'max', # enable O2 and ltcg.
53 },
54 # Allows libyuv.a redistributable library without external dependencies.
55 'standalone_static_library': 1,
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -080056 'conditions': [
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070057 # Disable -Wunused-parameter
58 ['clang == 1', {
59 'cflags': [
60 '-Wno-unused-parameter',
61 ],
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -080062 }],
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070063 ['build_neon != 0', {
64 'defines': [
65 'LIBYUV_NEON',
66 ],
67 'cflags!': [
68 '-mfpu=vfp',
69 '-mfpu=vfpv3',
70 '-mfpu=vfpv3-d16',
71 # '-mthumb', # arm32 not thumb
72 ],
73 'conditions': [
74 # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
75 ['clang == 0 and use_lto == 1', {
76 'cflags!': [
77 '-flto',
78 '-ffat-lto-objects',
79 ],
80 }],
81 # arm64 does not need -mfpu=neon option as neon is not optional
82 ['target_arch != "arm64"', {
83 'cflags': [
84 '-mfpu=neon',
85 # '-marm', # arm32 not thumb
86 ],
87 }],
88 ],
89 }],
Frank Barchardb83bb382017-02-22 18:01:07 -080090 ['build_msa != 0', {
91 'defines': [
92 'LIBYUV_MSA',
93 ],
94 }],
Hangyu Kuangf047e7c2016-07-06 14:21:45 -070095 ['OS != "ios" and libyuv_disable_jpeg != 1', {
96 'defines': [
97 'HAVE_JPEG'
98 ],
99 'conditions': [
100 # Caveat system jpeg support may not support motion jpeg
101 [ 'use_system_libjpeg == 1', {
102 'dependencies': [
103 '<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
104 ],
105 }, {
106 'dependencies': [
107 '<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
108 ],
109 }],
110 [ 'use_system_libjpeg == 1', {
111 'link_settings': {
112 'libraries': [
113 '-ljpeg',
114 ],
115 }
116 }],
117 ],
118 }],
119 ], #conditions
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -0800120 'defines': [
Hangyu Kuangf047e7c2016-07-06 14:21:45 -0700121 # Enable the following 3 macros to turn off assembly for specified CPU.
122 # 'LIBYUV_DISABLE_X86',
123 # 'LIBYUV_DISABLE_NEON',
Frank Barchardb83bb382017-02-22 18:01:07 -0800124 # 'LIBYUV_DISABLE_DSPR2',
Hangyu Kuangf047e7c2016-07-06 14:21:45 -0700125 # Enable the following macro to build libyuv as a shared library (dll).
126 # 'LIBYUV_USING_SHARED_LIBRARY',
127 # TODO(fbarchard): Make these into gyp defines.
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -0800128 ],
Shri Borde7cd81492011-11-02 13:20:24 -0700129 'include_dirs': [
Shri Borde7cd81492011-11-02 13:20:24 -0700130 'include',
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -0800131 '.',
Shri Borde7cd81492011-11-02 13:20:24 -0700132 ],
133 'direct_dependent_settings': {
134 'include_dirs': [
Shri Borde7cd81492011-11-02 13:20:24 -0700135 'include',
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -0800136 '.',
Shri Borde7cd81492011-11-02 13:20:24 -0700137 ],
Hangyu Kuangf047e7c2016-07-06 14:21:45 -0700138 'conditions': [
139 ['OS == "android" and target_arch == "arm64"', {
140 'ldflags': [
141 '-Wl,--dynamic-linker,/system/bin/linker64',
142 ],
143 }],
144 ['OS == "android" and target_arch != "arm64"', {
145 'ldflags': [
146 '-Wl,--dynamic-linker,/system/bin/linker',
147 ],
148 }],
149 ], #conditions
Shri Borde7cd81492011-11-02 13:20:24 -0700150 },
151 'sources': [
Hangyu Kuangf047e7c2016-07-06 14:21:45 -0700152 '<@(libyuv_sources)',
Shri Borde7cd81492011-11-02 13:20:24 -0700153 ],
Shri Borde7cd81492011-11-02 13:20:24 -0700154 },
Hendrik Dahlkamp33cfdeb2013-01-23 18:27:37 -0800155 ], # targets.
Shri Borde7cd81492011-11-02 13:20:24 -0700156}
157
158# Local Variables:
159# tab-width:2
160# indent-tabs-mode:nil
161# End:
162# vim: set expandtab tabstop=2 shiftwidth=2: