CMakeLists.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_neon.cc
  41. ${ly_src_dir}/row_neon64.cc
  42. ${ly_src_dir}/row_gcc.cc
  43. ${ly_src_dir}/row_win.cc
  44. ${ly_src_dir}/scale.cc
  45. ${ly_src_dir}/scale_any.cc
  46. ${ly_src_dir}/scale_argb.cc
  47. ${ly_src_dir}/scale_common.cc
  48. ${ly_src_dir}/scale_mips.cc
  49. ${ly_src_dir}/scale_neon.cc
  50. ${ly_src_dir}/scale_neon64.cc
  51. ${ly_src_dir}/scale_gcc.cc
  52. ${ly_src_dir}/scale_win.cc
  53. ${ly_src_dir}/video_common.cc
  54. )
  55. set(ly_unittest_sources
  56. ${ly_base_dir}/unit_test/basictypes_test.cc
  57. ${ly_base_dir}/unit_test/color_test.cc
  58. ${ly_base_dir}/unit_test/compare_test.cc
  59. ${ly_base_dir}/unit_test/convert_test.cc
  60. ${ly_base_dir}/unit_test/cpu_test.cc
  61. ${ly_base_dir}/unit_test/math_test.cc
  62. ${ly_base_dir}/unit_test/planar_test.cc
  63. ${ly_base_dir}/unit_test/rotate_argb_test.cc
  64. ${ly_base_dir}/unit_test/rotate_test.cc
  65. ${ly_base_dir}/unit_test/scale_argb_test.cc
  66. ${ly_base_dir}/unit_test/scale_test.cc
  67. ${ly_base_dir}/unit_test/unit_test.cc
  68. ${ly_base_dir}/unit_test/video_common_test.cc
  69. )
  70. set(ly_header_files
  71. ${ly_inc_dir}/libyuv/basic_types.h
  72. ${ly_inc_dir}/libyuv/compare.h
  73. ${ly_inc_dir}/libyuv/convert.h
  74. ${ly_inc_dir}/libyuv/convert_argb.h
  75. ${ly_inc_dir}/libyuv/convert_from.h
  76. ${ly_inc_dir}/libyuv/convert_from_argb.h
  77. ${ly_inc_dir}/libyuv/cpu_id.h
  78. ${ly_inc_dir}/libyuv/planar_functions.h
  79. ${ly_inc_dir}/libyuv/rotate.h
  80. ${ly_inc_dir}/libyuv/rotate_argb.h
  81. ${ly_inc_dir}/libyuv/rotate_row.h
  82. ${ly_inc_dir}/libyuv/row.h
  83. ${ly_inc_dir}/libyuv/scale.h
  84. ${ly_inc_dir}/libyuv/scale_argb.h
  85. ${ly_inc_dir}/libyuv/scale_row.h
  86. ${ly_inc_dir}/libyuv/version.h
  87. ${ly_inc_dir}/libyuv/video_common.h
  88. ${ly_inc_dir}/libyuv/mjpeg_decoder.h
  89. )
  90. include_directories(${ly_inc_dir})
  91. add_library(${ly_lib_name} STATIC ${ly_source_files})
  92. add_executable(convert ${ly_base_dir}/util/convert.cc)
  93. target_link_libraries(convert ${ly_lib_name})
  94. include(FindJPEG)
  95. if (JPEG_FOUND)
  96. include_directories(${JPEG_INCLUDE_DIR})
  97. target_link_libraries(convert ${JPEG_LIBRARY})
  98. add_definitions(-DHAVE_JPEG)
  99. endif()
  100. if(TEST)
  101. find_library(GTEST_LIBRARY gtest)
  102. if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
  103. set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources")
  104. if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)
  105. message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}")
  106. set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc)
  107. add_library(gtest STATIC ${gtest_sources})
  108. include_directories(${GTEST_SRC_DIR})
  109. include_directories(${GTEST_SRC_DIR}/include)
  110. set(GTEST_LIBRARY gtest)
  111. else()
  112. message(FATAL_ERROR "TEST is set but unable to find gtest library")
  113. endif()
  114. endif()
  115. add_executable(libyuv_unittest ${ly_unittest_sources})
  116. target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY} pthread)
  117. if (JPEG_FOUND)
  118. target_link_libraries(libyuv_unittest ${JPEG_LIBRARY})
  119. endif()
  120. if(NACL AND NACL_LIBC STREQUAL "newlib")
  121. target_link_libraries(libyuv_unittest glibc-compat)
  122. endif()
  123. target_link_libraries(libyuv_unittest gflags)
  124. endif()
  125. install(TARGETS ${ly_lib_name} DESTINATION lib)
  126. install(FILES ${ly_header_files} DESTINATION include/libyuv)
  127. install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/)