fix-cmakelists.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index bc641685..42e72a39 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -1,19 +1,22 @@
  6. +CMAKE_MINIMUM_REQUIRED( VERSION 3.12 )
  7. +
  8. # CMakeLists for libyuv
  9. # Originally created for "roxlu build system" to compile libyuv on windows
  10. # Run with -DTEST=ON to build unit tests
  11. PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
  12. -CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
  13. OPTION( TEST "Built unit tests" OFF )
  14. +SET( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
  15. +
  16. SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
  17. SET ( ly_src_dir ${ly_base_dir}/source )
  18. SET ( ly_inc_dir ${ly_base_dir}/include )
  19. SET ( ly_tst_dir ${ly_base_dir}/unit_test )
  20. SET ( ly_lib_name yuv )
  21. SET ( ly_lib_static ${ly_lib_name} )
  22. -SET ( ly_lib_shared ${ly_lib_name}_shared )
  23. +FILE ( GLOB_RECURSE ly_include_files ${ly_inc_dir}/libyuv/*.h )
  24. FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
  25. LIST ( SORT ly_source_files )
  26. @@ -28,27 +31,20 @@ endif()
  27. # this creates the static library (.a)
  28. ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
  29. -
  30. -# this creates the shared library (.so)
  31. -ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
  32. -SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
  33. -SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
  34. -if(WIN32)
  35. - SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" )
  36. -endif()
  37. +SET_TARGET_PROPERTIES ( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
  38. # this creates the conversion tool
  39. ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
  40. -TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
  41. +TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
  42. # this creates the yuvconstants tool
  43. -ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
  44. -TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
  45. +ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
  46. +TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
  47. find_package ( JPEG )
  48. if (JPEG_FOUND)
  49. - include_directories( ${JPEG_INCLUDE_DIR} )
  50. - target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
  51. + include_directories( ${JPEG_INCLUDE_DIR})
  52. + target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
  53. add_definitions( -DHAVE_JPEG )
  54. endif()
  55. @@ -89,12 +85,11 @@ if(TEST)
  56. endif()
  57. endif()
  58. -
  59. # install the conversion tool, .so, .a, and all the header files
  60. -INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
  61. -INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
  62. -INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
  63. -INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
  64. +INSTALL ( TARGETS yuvconvert DESTINATION tools )
  65. +INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
  66. +INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
  67. +INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
  68. # create the .deb and .rpm packages using cpack
  69. INCLUDE ( CM_linux_packages.cmake )