aom-install.diff 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 18190f647..f4b1b359d 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -23,6 +23,9 @@ endif()
  6. project(AOM C CXX)
  7. +include(GNUInstallDirs)
  8. +include(CMakePackageConfigHelpers)
  9. +
  10. # GENERATED source property global visibility.
  11. if(POLICY CMP0118)
  12. cmake_policy(SET CMP0118 NEW)
  13. @@ -302,6 +305,52 @@ if(BUILD_SHARED_LIBS)
  14. set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static)
  15. endif()
  16. +set(PUBLIC_HEADERS
  17. + aom/aom.h
  18. + aom/aom_codec.h
  19. + aom/aom_decoder.h
  20. + aom/aom_encoder.h
  21. + aom/aom_frame_buffer.h
  22. + aom/aom_image.h
  23. + aom/aom_integer.h
  24. + aom/aomcx.h
  25. + aom/aomdx.h
  26. +)
  27. +
  28. +set_target_properties(aom PROPERTIES
  29. + PUBLIC_HEADER "${PUBLIC_HEADERS}")
  30. +
  31. +
  32. +target_include_directories(aom
  33. + PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  34. + $<INSTALL_INTERFACE:include>)
  35. +
  36. +install(TARGETS aom
  37. + EXPORT unofficial-aom-targets
  38. + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
  39. + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
  40. + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
  41. + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom")
  42. +
  43. +install(EXPORT unofficial-aom-targets
  44. + FILE unofficial-aom-targets.cmake
  45. + NAMESPACE unofficial::
  46. + DESTINATION lib/cmake/aom)
  47. +
  48. +configure_package_config_file(cmake/aom-config.cmake.in
  49. + ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
  50. + INSTALL_DESTINATION lib/cmake/aom
  51. + NO_SET_AND_CHECK_MACRO
  52. + NO_CHECK_REQUIRED_COMPONENTS_MACRO)
  53. +
  54. +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
  55. + VERSION ${SO_FILE_VERSION}
  56. + COMPATIBILITY SameMajorVersion)
  57. +
  58. +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
  59. + ${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
  60. + DESTINATION lib/cmake/aom)
  61. +
  62. # Setup dependencies.
  63. if(CONFIG_THREE_PASS)
  64. setup_ivf_dec_targets()
  65. diff --git a/cmake/aom-config.cmake.in b/cmake/aom-config.cmake.in
  66. new file mode 100644
  67. index 000000000..91cac3b5b
  68. --- /dev/null
  69. +++ b/cmake/aom-config.cmake.in
  70. @@ -0,0 +1,2 @@
  71. +@PACKAGE_INIT@
  72. +include(${CMAKE_CURRENT_LIST_DIR}/unofficial-aom-targets.cmake)