libyuv.gyp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. 'mips_msa%': 0, # Default to msa off.
  28. 'build_neon': 0,
  29. 'build_msa': 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. 'build_neon': 1,
  35. }],
  36. ['(target_arch == "mipsel" or target_arch == "mips64el")\
  37. and (mips_msa == 1)',
  38. {
  39. 'build_msa': 1,
  40. }],
  41. ],
  42. },
  43. 'targets': [
  44. {
  45. 'target_name': 'libyuv',
  46. # Change type to 'shared_library' to build .so or .dll files.
  47. 'type': 'static_library',
  48. 'variables': {
  49. 'optimize': 'max', # enable O2 and ltcg.
  50. },
  51. # Allows libyuv.a redistributable library without external dependencies.
  52. 'standalone_static_library': 1,
  53. 'conditions': [
  54. # Disable -Wunused-parameter
  55. ['clang == 1', {
  56. 'cflags': [
  57. '-Wno-unused-parameter',
  58. ],
  59. }],
  60. ['build_neon != 0', {
  61. 'defines': [
  62. 'LIBYUV_NEON',
  63. ],
  64. 'cflags!': [
  65. '-mfpu=vfp',
  66. '-mfpu=vfpv3',
  67. '-mfpu=vfpv3-d16',
  68. # '-mthumb', # arm32 not thumb
  69. ],
  70. 'conditions': [
  71. # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
  72. ['clang == 0 and use_lto == 1', {
  73. 'cflags!': [
  74. '-flto',
  75. '-ffat-lto-objects',
  76. ],
  77. }],
  78. # arm64 does not need -mfpu=neon option as neon is not optional
  79. ['target_arch != "arm64"', {
  80. 'cflags': [
  81. '-mfpu=neon',
  82. # '-marm', # arm32 not thumb
  83. ],
  84. }],
  85. ],
  86. }],
  87. ['build_msa != 0', {
  88. 'defines': [
  89. 'LIBYUV_MSA',
  90. ],
  91. }],
  92. ['OS != "ios" and libyuv_disable_jpeg != 1', {
  93. 'defines': [
  94. 'HAVE_JPEG'
  95. ],
  96. 'conditions': [
  97. # Caveat system jpeg support may not support motion jpeg
  98. [ 'use_system_libjpeg == 1', {
  99. 'dependencies': [
  100. '<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
  101. ],
  102. }, {
  103. 'dependencies': [
  104. '<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
  105. ],
  106. }],
  107. [ 'use_system_libjpeg == 1', {
  108. 'link_settings': {
  109. 'libraries': [
  110. '-ljpeg',
  111. ],
  112. }
  113. }],
  114. ],
  115. }],
  116. ], #conditions
  117. 'defines': [
  118. # Enable the following 3 macros to turn off assembly for specified CPU.
  119. # 'LIBYUV_DISABLE_X86',
  120. # 'LIBYUV_DISABLE_NEON',
  121. # 'LIBYUV_DISABLE_MIPS',
  122. # Enable the following macro to build libyuv as a shared library (dll).
  123. # 'LIBYUV_USING_SHARED_LIBRARY',
  124. # TODO(fbarchard): Make these into gyp defines.
  125. ],
  126. 'include_dirs': [
  127. 'include',
  128. '.',
  129. ],
  130. 'direct_dependent_settings': {
  131. 'include_dirs': [
  132. 'include',
  133. '.',
  134. ],
  135. 'conditions': [
  136. ['OS == "android" and target_arch == "arm64"', {
  137. 'ldflags': [
  138. '-Wl,--dynamic-linker,/system/bin/linker64',
  139. ],
  140. }],
  141. ['OS == "android" and target_arch != "arm64"', {
  142. 'ldflags': [
  143. '-Wl,--dynamic-linker,/system/bin/linker',
  144. ],
  145. }],
  146. ], #conditions
  147. },
  148. 'sources': [
  149. '<@(libyuv_sources)',
  150. ],
  151. },
  152. ], # targets.
  153. }
  154. # Local Variables:
  155. # tab-width:2
  156. # indent-tabs-mode:nil
  157. # End:
  158. # vim: set expandtab tabstop=2 shiftwidth=2: