CMakeLists.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. cmake_minimum_required(VERSION 2.8)
  2. # CMakeLists for libyuv
  3. # Originally created for "roxlu build system" to compile libyuv on windows
  4. # Run with -DTEST=ON to build unit tests
  5. option(TEST "Built unit tests" OFF)
  6. set(ly_base_dir ${CMAKE_CURRENT_LIST_DIR})
  7. set(ly_src_dir ${ly_base_dir}/source/)
  8. set(ly_inc_dir ${ly_base_dir}/include)
  9. set(ly_lib_name "yuv")
  10. set(ly_source_files
  11. ${ly_src_dir}/compare.cc
  12. ${ly_src_dir}/compare_common.cc
  13. ${ly_src_dir}/compare_neon.cc
  14. ${ly_src_dir}/compare_neon64.cc
  15. ${ly_src_dir}/compare_gcc.cc
  16. ${ly_src_dir}/compare_win.cc
  17. ${ly_src_dir}/convert.cc
  18. ${ly_src_dir}/convert_argb.cc
  19. ${ly_src_dir}/convert_from.cc
  20. ${ly_src_dir}/convert_from_argb.cc
  21. ${ly_src_dir}/convert_jpeg.cc
  22. ${ly_src_dir}/convert_to_argb.cc
  23. ${ly_src_dir}/convert_to_i420.cc
  24. ${ly_src_dir}/cpu_id.cc
  25. ${ly_src_dir}/mjpeg_decoder.cc
  26. ${ly_src_dir}/mjpeg_validate.cc
  27. ${ly_src_dir}/planar_functions.cc
  28. ${ly_src_dir}/rotate.cc
  29. ${ly_src_dir}/rotate_any.cc
  30. ${ly_src_dir}/rotate_argb.cc
  31. ${ly_src_dir}/rotate_common.cc
  32. ${ly_src_dir}/rotate_mips.cc
  33. ${ly_src_dir}/rotate_neon.cc
  34. ${ly_src_dir}/rotate_neon64.cc
  35. ${ly_src_dir}/rotate_gcc.cc
  36. ${ly_src_dir}/rotate_win.cc
  37. ${ly_src_dir}/row_any.cc
  38. ${ly_src_dir}/row_common.cc
  39. ${ly_src_dir}/row_mips.cc
  40. ${ly_src_dir}/row_msa.cc
  41. ${ly_src_dir}/row_neon.cc
  42. ${ly_src_dir}/row_neon64.cc
  43. ${ly_src_dir}/row_gcc.cc
  44. ${ly_src_dir}/row_win.cc
  45. ${ly_src_dir}/scale.cc
  46. ${ly_src_dir}/scale_any.cc
  47. ${ly_src_dir}/scale_argb.cc
  48. ${ly_src_dir}/scale_common.cc
  49. ${ly_src_dir}/scale_mips.cc
  50. ${ly_src_dir}/scale_neon.cc
  51. ${ly_src_dir}/scale_neon64.cc
  52. ${ly_src_dir}/scale_gcc.cc
  53. ${ly_src_dir}/scale_win.cc
  54. ${ly_src_dir}/video_common.cc
  55. )
  56. set(ly_unittest_sources
  57. ${ly_base_dir}/unit_test/basictypes_test.cc
  58. ${ly_base_dir}/unit_test/color_test.cc
  59. ${ly_base_dir}/unit_test/compare_test.cc
  60. ${ly_base_dir}/unit_test/convert_test.cc
  61. ${ly_base_dir}/unit_test/cpu_test.cc
  62. ${ly_base_dir}/unit_test/math_test.cc
  63. ${ly_base_dir}/unit_test/planar_test.cc
  64. ${ly_base_dir}/unit_test/rotate_argb_test.cc
  65. ${ly_base_dir}/unit_test/rotate_test.cc
  66. ${ly_base_dir}/unit_test/scale_argb_test.cc
  67. ${ly_base_dir}/unit_test/scale_test.cc
  68. ${ly_base_dir}/unit_test/unit_test.cc
  69. ${ly_base_dir}/unit_test/video_common_test.cc
  70. )
  71. set(ly_header_files
  72. ${ly_inc_dir}/libyuv/basic_types.h
  73. ${ly_inc_dir}/libyuv/compare.h
  74. ${ly_inc_dir}/libyuv/convert.h
  75. ${ly_inc_dir}/libyuv/convert_argb.h
  76. ${ly_inc_dir}/libyuv/convert_from.h
  77. ${ly_inc_dir}/libyuv/convert_from_argb.h
  78. ${ly_inc_dir}/libyuv/cpu_id.h
  79. ${ly_inc_dir}/libyuv/macros_msa.h
  80. ${ly_inc_dir}/libyuv/planar_functions.h
  81. ${ly_inc_dir}/libyuv/rotate.h
  82. ${ly_inc_dir}/libyuv/rotate_argb.h
  83. ${ly_inc_dir}/libyuv/rotate_row.h
  84. ${ly_inc_dir}/libyuv/row.h
  85. ${ly_inc_dir}/libyuv/scale.h
  86. ${ly_inc_dir}/libyuv/scale_argb.h
  87. ${ly_inc_dir}/libyuv/scale_row.h
  88. ${ly_inc_dir}/libyuv/version.h
  89. ${ly_inc_dir}/libyuv/video_common.h
  90. ${ly_inc_dir}/libyuv/mjpeg_decoder.h
  91. )
  92. include_directories(${ly_inc_dir})
  93. add_library(${ly_lib_name} STATIC ${ly_source_files})
  94. add_executable(convert ${ly_base_dir}/util/convert.cc)
  95. target_link_libraries(convert ${ly_lib_name})
  96. include(FindJPEG)
  97. if (JPEG_FOUND)
  98. include_directories(${JPEG_INCLUDE_DIR})
  99. target_link_libraries(convert ${JPEG_LIBRARY})
  100. add_definitions(-DHAVE_JPEG)
  101. endif()
  102. if(TEST)
  103. find_library(GTEST_LIBRARY gtest)
  104. if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
  105. set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources")
  106. if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)
  107. message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}")
  108. set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc)
  109. add_library(gtest STATIC ${gtest_sources})
  110. include_directories(${GTEST_SRC_DIR})
  111. include_directories(${GTEST_SRC_DIR}/include)
  112. set(GTEST_LIBRARY gtest)
  113. else()
  114. message(FATAL_ERROR "TEST is set but unable to find gtest library")
  115. endif()
  116. endif()
  117. add_executable(libyuv_unittest ${ly_unittest_sources})
  118. target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY} pthread)
  119. if (JPEG_FOUND)
  120. target_link_libraries(libyuv_unittest ${JPEG_LIBRARY})
  121. endif()
  122. if(NACL AND NACL_LIBC STREQUAL "newlib")
  123. target_link_libraries(libyuv_unittest glibc-compat)
  124. endif()
  125. target_link_libraries(libyuv_unittest gflags)
  126. endif()
  127. install(TARGETS ${ly_lib_name} DESTINATION lib)
  128. install(FILES ${ly_header_files} DESTINATION include/libyuv)
  129. install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/)