From 835f1613b5d785eed9cfc6c0b76d6ac2aa0a61ba Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Tue, 1 Jun 2021 22:20:31 +0300 Subject: [aom] Add new port (#18083) * [aom] Add new port * [aom] vcpkg x-add-version --all * [aom] Added versions/a-/aom.json * [aom] Fixes after review * [aom] vcpkg x-add-version --all --overwrite-version * [aom] Remove usage * [aom] vcpkg x-add-version --all --overwrite-version * [aom] Update ports/aom/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [aom] vcpkg x-add-version --all --overwrite-version Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/aom/aom-install.diff | 75 ++++++++++++++++++++++++++++++++++++++++ ports/aom/aom-rename-static.diff | 12 +++++++ ports/aom/portfile.cmake | 46 ++++++++++++++++++++++++ ports/aom/vcpkg.json | 17 +++++++++ versions/a-/aom.json | 9 +++++ versions/baseline.json | 4 +++ 6 files changed, 163 insertions(+) create mode 100644 ports/aom/aom-install.diff create mode 100644 ports/aom/aom-rename-static.diff create mode 100644 ports/aom/portfile.cmake create mode 100644 ports/aom/vcpkg.json create mode 100644 versions/a-/aom.json diff --git a/ports/aom/aom-install.diff b/ports/aom/aom-install.diff new file mode 100644 index 000000000..64c45df54 --- /dev/null +++ b/ports/aom/aom-install.diff @@ -0,0 +1,75 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 18190f647..f4b1b359d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,6 +23,9 @@ endif() + + project(AOM C CXX) + ++include(GNUInstallDirs) ++include(CMakePackageConfigHelpers) ++ + if(NOT EMSCRIPTEN) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE +@@ -289,6 +292,52 @@ if(BUILD_SHARED_LIBS) + set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static) + endif() + ++set(PUBLIC_HEADERS ++ aom/aom.h ++ aom/aom_codec.h ++ aom/aom_decoder.h ++ aom/aom_encoder.h ++ aom/aom_frame_buffer.h ++ aom/aom_image.h ++ aom/aom_integer.h ++ aom/aomcx.h ++ aom/aomdx.h ++) ++ ++set_target_properties(aom PROPERTIES ++ PUBLIC_HEADER "${PUBLIC_HEADERS}") ++ ++ ++target_include_directories(aom ++ PUBLIC $ ++ $) ++ ++install(TARGETS aom ++ EXPORT unofficial-aom-targets ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom") ++ ++install(EXPORT unofficial-aom-targets ++ FILE unofficial-aom-targets.cmake ++ NAMESPACE unofficial:: ++ DESTINATION lib/cmake/aom) ++ ++configure_package_config_file(cmake/aom-config.cmake.in ++ ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake ++ INSTALL_DESTINATION lib/cmake/aom ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO) ++ ++write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake ++ VERSION ${SO_FILE_VERSION} ++ COMPATIBILITY SameMajorVersion) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake ++ DESTINATION lib/cmake/aom) ++ + # Setup dependencies. + setup_aom_dsp_targets() + setup_aom_mem_targets() +diff --git a/cmake/aom-config.cmake.in b/cmake/aom-config.cmake.in +new file mode 100644 +index 000000000..91cac3b5b +--- /dev/null ++++ b/cmake/aom-config.cmake.in +@@ -0,0 +1,2 @@ ++@PACKAGE_INIT@ ++include(${CMAKE_CURRENT_LIST_DIR}/unofficial-aom-targets.cmake) diff --git a/ports/aom/aom-rename-static.diff b/ports/aom/aom-rename-static.diff new file mode 100644 index 000000000..e38c73fb1 --- /dev/null +++ b/ports/aom/aom-rename-static.diff @@ -0,0 +1,12 @@ +diff -pruN aom-3.0.0.o/CMakeLists.txt aom-3.0.0/CMakeLists.txt +--- aom-3.0.0.o/CMakeLists.txt 2021-04-15 20:05:52.695181200 +0300 ++++ aom-3.0.0/CMakeLists.txt 2021-04-15 22:34:16.147522600 +0300 +@@ -249,7 +249,7 @@ endif() + add_library(aom ${AOM_SOURCES} $) + if(BUILD_SHARED_LIBS) + add_library(aom_static STATIC ${AOM_SOURCES} $) +- set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) + + if(NOT MSVC) + # Extract version string and set VERSION/SOVERSION for the aom target. diff --git a/ports/aom/portfile.cmake b/ports/aom/portfile.cmake new file mode 100644 index 000000000..651936642 --- /dev/null +++ b/ports/aom/portfile.cmake @@ -0,0 +1,46 @@ +vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "UWP") + +# NASM is required to build AOM +vcpkg_find_acquire_program(NASM) +get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) +vcpkg_add_to_path(${NASM_EXE_PATH}) + +# Perl is required to build AOM +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path(${PERL_PATH}) + +vcpkg_from_git( + OUT_SOURCE_PATH SOURCE_PATH + URL "https://aomedia.googlesource.com/aom" + REF 33aff8586e35ffe385637f6aa2c991858c0fb58e + TAG v3.1.0 + PATCHES + aom-rename-static.diff + # Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream + aom-install.diff +) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DENABLE_DOCS=OFF + -DENABLE_EXAMPLES=OFF + -DENABLE_TESTDATA=OFF + -DENABLE_TESTS=OFF + -DENABLE_TOOLS=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +# Move cmake configs +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) + +# Remove duplicate files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aom/vcpkg.json b/ports/aom/vcpkg.json new file mode 100644 index 000000000..d3743ba17 --- /dev/null +++ b/ports/aom/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "aom", + "version-semver": "3.1.0", + "description": "AV1 codec library", + "homepage": "https://aomedia.googlesource.com/aom", + "supports": "!uwp & !arm", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/a-/aom.json b/versions/a-/aom.json new file mode 100644 index 000000000..075bb35c3 --- /dev/null +++ b/versions/a-/aom.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "b465c1a32eeac8dfe55239134d800c309b16b33f", + "version-semver": "3.1.0", + "port-version": 0 + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 75f980555..ccd80a017 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -92,6 +92,10 @@ "baseline": "2020-01-13", "port-version": 2 }, + "aom": { + "baseline": "3.1.0", + "port-version": 0 + }, "apr": { "baseline": "1.7.0", "port-version": 3 -- cgit v1.2.3