portfile.cmake 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # NASM is required to build AOM
  2. vcpkg_find_acquire_program(NASM)
  3. get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
  4. vcpkg_add_to_path(${NASM_EXE_PATH})
  5. # Perl is required to build AOM
  6. vcpkg_find_acquire_program(PERL)
  7. get_filename_component(PERL_PATH ${PERL} DIRECTORY)
  8. vcpkg_add_to_path(${PERL_PATH})
  9. if(DEFINED ENV{USE_AOM_391})
  10. vcpkg_from_git(
  11. OUT_SOURCE_PATH SOURCE_PATH
  12. URL "https://aomedia.googlesource.com/aom"
  13. REF 8ad484f8a18ed1853c094e7d3a4e023b2a92df28 # 3.9.1
  14. PATCHES
  15. aom-uninitialized-pointer.diff
  16. aom-avx2.diff
  17. aom-install.diff
  18. )
  19. else()
  20. vcpkg_from_git(
  21. OUT_SOURCE_PATH SOURCE_PATH
  22. URL "https://aomedia.googlesource.com/aom"
  23. REF d6f30ae474dd6c358f26de0a0fc26a0d7340a84c # 3.11.0
  24. PATCHES
  25. aom-uninitialized-pointer.diff
  26. # aom-avx2.diff
  27. # Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream
  28. aom-install.diff
  29. )
  30. endif()
  31. set(aom_target_cpu "")
  32. if(VCPKG_TARGET_IS_UWP OR (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm"))
  33. # UWP + aom's assembler files result in weirdness and build failures
  34. # Also, disable assembly on ARM and ARM64 Windows to fix compilation issues.
  35. set(aom_target_cpu "-DAOM_TARGET_CPU=generic")
  36. endif()
  37. if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_TARGET_IS_LINUX)
  38. set(aom_target_cpu "-DENABLE_NEON=OFF")
  39. endif()
  40. vcpkg_cmake_configure(
  41. SOURCE_PATH ${SOURCE_PATH}
  42. OPTIONS
  43. ${aom_target_cpu}
  44. -DENABLE_DOCS=OFF
  45. -DENABLE_EXAMPLES=OFF
  46. -DENABLE_TESTDATA=OFF
  47. -DENABLE_TESTS=OFF
  48. -DENABLE_TOOLS=OFF
  49. )
  50. vcpkg_cmake_install()
  51. vcpkg_copy_pdbs()
  52. vcpkg_fixup_pkgconfig()
  53. if(VCPKG_TARGET_IS_WINDOWS)
  54. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/aom.pc" " -lm" "")
  55. if(NOT VCPKG_BUILD_TYPE)
  56. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/aom.pc" " -lm" "")
  57. endif()
  58. endif()
  59. # Move cmake configs
  60. vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
  61. # Remove duplicate files
  62. file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
  63. ${CURRENT_PACKAGES_DIR}/debug/share)
  64. # Handle copyright
  65. file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
  66. vcpkg_fixup_pkgconfig()