libyuv.gyp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. 'includes': [
  10. 'libyuv.gypi',
  11. ],
  12. # Make sure that if we are being compiled to an xcodeproj, nothing tries to
  13. # include a .pch.
  14. 'xcode_settings': {
  15. 'GCC_PREFIX_HEADER': '',
  16. 'GCC_PRECOMPILE_PREFIX_HEADER': 'NO',
  17. },
  18. 'variables': {
  19. 'use_system_libjpeg%': 0,
  20. 'libyuv_disable_jpeg%': 0,
  21. # 'chromium_code' treats libyuv as internal and increases warning level.
  22. 'chromium_code': 1,
  23. # clang compiler default variable usable by other apps that include libyuv.
  24. 'clang%': 0,
  25. # Link-Time Optimizations.
  26. 'use_lto%': 0,
  27. 'yuv_disable_asm%': 0,
  28. 'yuv_disable_avx2%': 0,
  29. 'build_neon': 0,
  30. 'conditions': [
  31. ['(target_arch == "armv7" or target_arch == "armv7s" or \
  32. (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
  33. and (arm_neon == 1 or arm_neon_optional == 1)',
  34. {
  35. 'build_neon': 1,
  36. }],
  37. ],
  38. },
  39. 'targets': [
  40. {
  41. 'target_name': 'libyuv',
  42. # Change type to 'shared_library' to build .so or .dll files.
  43. 'type': 'static_library',
  44. 'variables': {
  45. 'optimize': 'max', # enable O2 and ltcg.
  46. },
  47. # Allows libyuv.a redistributable library without external dependencies.
  48. # 'standalone_static_library': 1,
  49. 'conditions': [
  50. # Disable -Wunused-parameter
  51. ['clang == 1', {
  52. 'cflags': [
  53. '-Wno-unused-parameter',
  54. ],
  55. }],
  56. ['build_neon != 0', {
  57. 'defines': [
  58. 'LIBYUV_NEON',
  59. ],
  60. 'cflags!': [
  61. '-mfpu=vfp',
  62. '-mfpu=vfpv3',
  63. '-mfpu=vfpv3-d16',
  64. # '-mthumb', # arm32 not thumb
  65. ],
  66. 'cflags_mozilla!': [
  67. '-mfpu=vfp',
  68. '-mfpu=vfpv3',
  69. '-mfpu=vfpv3-d16',
  70. ],
  71. 'conditions': [
  72. # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
  73. ['clang == 0 and use_lto == 1', {
  74. 'cflags!': [
  75. '-flto',
  76. '-ffat-lto-objects',
  77. ],
  78. }],
  79. # arm64 does not need -mfpu=neon option as neon is not optional
  80. ['target_arch != "arm64"', {
  81. 'cflags': [
  82. '-mfpu=neon',
  83. # '-marm', # arm32 not thumb
  84. ],
  85. 'cflags_mozilla': [
  86. '-mfpu=neon',
  87. ],
  88. }],
  89. ],
  90. }],
  91. [ 'yuv_disable_asm != 0', {
  92. 'defines': [
  93. # Enable the following 3 macros to turn off assembly for specified CPU.
  94. 'LIBYUV_DISABLE_X86',
  95. 'LIBYUV_DISABLE_NEON',
  96. 'LIBYUV_DISABLE_MIPS',
  97. ],
  98. }],
  99. [ 'yuv_disable_avx2 == 1', {
  100. 'defines': [
  101. 'LIBYUV_DISABLE_AVX2',
  102. ]
  103. }],
  104. ['build_with_mozilla == 1', {
  105. 'defines': [
  106. 'HAVE_JPEG'
  107. ],
  108. 'cflags_mozilla': [
  109. '$(MOZ_JPEG_CFLAGS)',
  110. ],
  111. }],
  112. ['OS != "ios" and libyuv_disable_jpeg != 1 and build_with_mozilla != 1', {
  113. 'defines': [
  114. 'HAVE_JPEG'
  115. ],
  116. 'conditions': [
  117. # Caveat system jpeg support may not support motion jpeg
  118. [ 'use_system_libjpeg == 1', {
  119. 'dependencies': [
  120. '<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
  121. ],
  122. }, {
  123. 'dependencies': [
  124. '<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
  125. ],
  126. }],
  127. [ 'use_system_libjpeg == 1', {
  128. 'link_settings': {
  129. 'libraries': [
  130. '-ljpeg',
  131. ],
  132. }
  133. }],
  134. ],
  135. }],
  136. ], #conditions
  137. 'defines': [
  138. # Enable the following 3 macros to turn off assembly for specified CPU.
  139. # 'LIBYUV_DISABLE_X86',
  140. # 'LIBYUV_DISABLE_NEON',
  141. # 'LIBYUV_DISABLE_MIPS',
  142. # This disables AVX2 (Haswell) support, overriding compiler checks
  143. # 'LIBYUV_DISABLE_AVX2',
  144. # Enable the following macro to build libyuv as a shared library (dll).
  145. # 'LIBYUV_USING_SHARED_LIBRARY',
  146. # TODO(fbarchard): Make these into gyp defines.
  147. ],
  148. 'include_dirs': [
  149. 'include',
  150. '.',
  151. ],
  152. 'direct_dependent_settings': {
  153. 'include_dirs': [
  154. 'include',
  155. '.',
  156. ],
  157. 'conditions': [
  158. ['OS == "android" and target_arch == "arm64"', {
  159. 'ldflags': [
  160. '-Wl,--dynamic-linker,/system/bin/linker64',
  161. ],
  162. }],
  163. ['OS == "android" and target_arch != "arm64"', {
  164. 'ldflags': [
  165. '-Wl,--dynamic-linker,/system/bin/linker',
  166. ],
  167. }],
  168. ], #conditions
  169. },
  170. 'sources': [
  171. '<@(libyuv_sources)',
  172. ],
  173. },
  174. ], # targets.
  175. }
  176. # Local Variables:
  177. # tab-width:2
  178. # indent-tabs-mode:nil
  179. # End: