libyuv.gyp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. # Can be enabled if your jpeg has GYP support.
  21. 'libyuv_disable_jpeg%': 1,
  22. # 'chromium_code' treats libyuv as internal and increases warning level.
  23. 'chromium_code': 1,
  24. # clang compiler default variable usable by other apps that include libyuv.
  25. 'clang%': 0,
  26. # Link-Time Optimizations.
  27. 'use_lto%': 0,
  28. 'mips_msa%': 0, # Default to msa off.
  29. 'build_neon': 0,
  30. 'build_msa': 0,
  31. 'conditions': [
  32. ['(target_arch == "armv7" or target_arch == "armv7s" or \
  33. (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
  34. and (arm_neon == 1 or arm_neon_optional == 1)', {
  35. 'build_neon': 1,
  36. }],
  37. ['(target_arch == "mipsel" or target_arch == "mips64el")\
  38. and (mips_msa == 1)',
  39. {
  40. 'build_msa': 1,
  41. }],
  42. ],
  43. },
  44. 'targets': [
  45. {
  46. 'target_name': 'libyuv',
  47. # Change type to 'shared_library' to build .so or .dll files.
  48. 'type': 'static_library',
  49. 'variables': {
  50. 'optimize': 'max', # enable O2 and ltcg.
  51. },
  52. # Allows libyuv.a redistributable library without external dependencies.
  53. 'standalone_static_library': 1,
  54. 'conditions': [
  55. # Disable -Wunused-parameter
  56. ['clang == 1', {
  57. 'cflags': [
  58. '-Wno-unused-parameter',
  59. ],
  60. }],
  61. ['build_neon != 0', {
  62. 'defines': [
  63. 'LIBYUV_NEON',
  64. ],
  65. 'cflags!': [
  66. '-mfpu=vfp',
  67. '-mfpu=vfpv3',
  68. '-mfpu=vfpv3-d16',
  69. # '-mthumb', # arm32 not thumb
  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. }],
  86. ],
  87. }],
  88. ['build_msa != 0', {
  89. 'defines': [
  90. 'LIBYUV_MSA',
  91. ],
  92. }],
  93. ['OS != "ios" and libyuv_disable_jpeg != 1', {
  94. 'defines': [
  95. 'HAVE_JPEG'
  96. ],
  97. 'conditions': [
  98. # Caveat system jpeg support may not support motion jpeg
  99. [ 'use_system_libjpeg == 1', {
  100. 'dependencies': [
  101. '<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
  102. ],
  103. }, {
  104. 'dependencies': [
  105. '<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
  106. ],
  107. }],
  108. [ 'use_system_libjpeg == 1', {
  109. 'link_settings': {
  110. 'libraries': [
  111. '-ljpeg',
  112. ],
  113. }
  114. }],
  115. ],
  116. }],
  117. ], #conditions
  118. 'defines': [
  119. # Enable the following 3 macros to turn off assembly for specified CPU.
  120. # 'LIBYUV_DISABLE_X86',
  121. # 'LIBYUV_DISABLE_NEON',
  122. # 'LIBYUV_DISABLE_DSPR2',
  123. # Enable the following macro to build libyuv as a shared library (dll).
  124. # 'LIBYUV_USING_SHARED_LIBRARY',
  125. # TODO(fbarchard): Make these into gyp defines.
  126. ],
  127. 'include_dirs': [
  128. 'include',
  129. '.',
  130. ],
  131. 'direct_dependent_settings': {
  132. 'include_dirs': [
  133. 'include',
  134. '.',
  135. ],
  136. 'conditions': [
  137. ['OS == "android" and target_arch == "arm64"', {
  138. 'ldflags': [
  139. '-Wl,--dynamic-linker,/system/bin/linker64',
  140. ],
  141. }],
  142. ['OS == "android" and target_arch != "arm64"', {
  143. 'ldflags': [
  144. '-Wl,--dynamic-linker,/system/bin/linker',
  145. ],
  146. }],
  147. ], #conditions
  148. },
  149. 'sources': [
  150. '<@(libyuv_sources)',
  151. ],
  152. },
  153. ], # targets.
  154. }
  155. # Local Variables:
  156. # tab-width:2
  157. # indent-tabs-mode:nil
  158. # End:
  159. # vim: set expandtab tabstop=2 shiftwidth=2: