From 21e7664d115d13ee63469486065502f56a4af4d0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 11 May 2022 12:03:05 +0200 Subject: [PATCH] (#10716) libaom-av1: add 3.3.0 + download stable archives + relocatable shared lib on macOS * download official & stable archives stable archives are available in https://storage.googleapis.com/aom-releases/ * relocatable shared lib on macOS * improve patches * cache CMake configuration with functools.lru_cache * install dll into bin folder * use find_package in test package * add libaom-av1/3.3.0 --- recipes/libaom-av1/all/CMakeLists.txt | 4 +-- recipes/libaom-av1/all/conandata.yml | 27 ++++++++++----- recipes/libaom-av1/all/conanfile.py | 30 ++++++++-------- .../all/patches/0001-2.0.1-fix-install.patch | 34 +++++++++++++++++++ .../all/patches/0001-2.0.1-msvc-install.patch | 23 ------------- .../all/patches/0001-3.1.1-fix-install.patch | 34 +++++++++++++++++++ .../all/patches/0001-3.1.1-msvc-install.patch | 23 ------------- .../all/patches/0001-3.3.0-fix-install.patch | 21 ++++++++++++ .../all/test_package/CMakeLists.txt | 6 ++-- .../libaom-av1/all/test_package/conanfile.py | 4 +-- recipes/libaom-av1/config.yml | 2 ++ 11 files changed, 131 insertions(+), 77 deletions(-) create mode 100644 recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch delete mode 100644 recipes/libaom-av1/all/patches/0001-2.0.1-msvc-install.patch create mode 100644 recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch delete mode 100644 recipes/libaom-av1/all/patches/0001-3.1.1-msvc-install.patch create mode 100644 recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch diff --git a/recipes/libaom-av1/all/CMakeLists.txt b/recipes/libaom-av1/all/CMakeLists.txt index 68bfd75fb1882..7a91e5788197d 100644 --- a/recipes/libaom-av1/all/CMakeLists.txt +++ b/recipes/libaom-av1/all/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) include("conanbuildinfo.cmake") -conan_basic_setup() +conan_basic_setup(KEEP_RPATHS) add_subdirectory("source_subfolder") diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml index 046d69e151da8..3bd6ed7f5ae32 100644 --- a/recipes/libaom-av1/all/conandata.yml +++ b/recipes/libaom-av1/all/conandata.yml @@ -1,17 +1,26 @@ sources: + "3.3.0": + url: "https://storage.googleapis.com/aom-releases/libaom-3.3.0.tar.gz" + sha256: "1dafde32bc2237bf0570294661ae61db30e818840f77dc4e90d1ebf5a6286664" "3.1.2": - url: "https://aomedia.googlesource.com/aom/+archive/ae2be8030200925895fa6e98bd274ffdb595cbf6.tar.gz" + url: "https://storage.googleapis.com/aom-releases/libaom-3.1.2.tar.gz" + sha256: "a295eb3779657fad7d34217091ee4c6257d02580a82012231afef72792330075" "3.1.1": - url: "https://aomedia.googlesource.com/aom/+archive/7fadc0e77130efb05f52979b0deaba9b6a1bba6d.tar.gz" + url: "https://storage.googleapis.com/aom-releases/libaom-3.1.1.tar.gz" + sha256: "7cd5e8e469268c37241df93fe61557ea0dc46980ca21b37e786e92a3d0729276" "2.0.1": - url: "https://aomedia.googlesource.com/aom/+archive/b52ee6d44adaef8a08f6984390de050d64df9faa.tar.gz" + url: "https://storage.googleapis.com/aom-releases/libaom-2.0.1.tar.gz" + sha256: "a0cff299621e2ef885aba219c498fa39a7d9a7ddf47585a118fd66c64ad1b312" patches: + "3.3.0": + - patch_file: "patches/0001-3.3.0-fix-install.patch" + base_path: "source_subfolder" "3.1.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-3.1.1-msvc-install.patch" + - patch_file: "patches/0001-3.1.1-fix-install.patch" + base_path: "source_subfolder" "3.1.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-3.1.1-msvc-install.patch" + - patch_file: "patches/0001-3.1.1-fix-install.patch" + base_path: "source_subfolder" "2.0.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-2.0.1-msvc-install.patch" + - patch_file: "patches/0001-2.0.1-fix-install.patch" + base_path: "source_subfolder" diff --git a/recipes/libaom-av1/all/conanfile.py b/recipes/libaom-av1/all/conanfile.py index ec2a4f5c12d3d..34cbb96c69c33 100644 --- a/recipes/libaom-av1/all/conanfile.py +++ b/recipes/libaom-av1/all/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, tools, CMake from conans.errors import ConanInvalidConfiguration +import functools import os required_conan_version = ">=1.36.0" @@ -26,7 +27,6 @@ class LibaomAv1Conan(ConanFile): } generators = "cmake" - _cmake = None @property def _source_subfolder(self): @@ -82,27 +82,27 @@ def validate(self): def source(self): tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder) + destination=self._source_subfolder, + strip_root=tools.Version(self.version) >= "3.3.0") + @functools.lru_cache(1) def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_EXAMPLES"] = False - self._cmake.definitions["ENABLE_TESTS"] = False - self._cmake.definitions["ENABLE_DOCS"] = False - self._cmake.definitions["ENABLE_TOOLS"] = False + cmake = CMake(self) + cmake.definitions["ENABLE_EXAMPLES"] = False + cmake.definitions["ENABLE_TESTS"] = False + cmake.definitions["ENABLE_DOCS"] = False + cmake.definitions["ENABLE_TOOLS"] = False if not self.options.get_safe("assembly", False): # make non-assembly build - self._cmake.definitions["AOM_TARGET_CPU"] = "generic" + cmake.definitions["AOM_TARGET_CPU"] = "generic" # libyuv is used for examples, tests and non-essential 'dump_obu' tool so it is disabled # required to be 1/0 instead of False - self._cmake.definitions["CONFIG_LIBYUV"] = 0 + cmake.definitions["CONFIG_LIBYUV"] = 0 # webm is not yet packaged - self._cmake.definitions["CONFIG_WEBM_IO"] = 0 + cmake.definitions["CONFIG_WEBM_IO"] = 0 # required out-of-source build - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + cmake.configure(build_folder=self._build_subfolder) + return cmake def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): @@ -115,8 +115,6 @@ def package(self): cmake = self._configure_cmake() cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") def package_info(self): self.cpp_info.set_property("pkg_config_name", "aom") diff --git a/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch b/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch new file mode 100644 index 0000000000000..128bfeb7c4ea2 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch @@ -0,0 +1,34 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -27,7 +27,7 @@ endif() + # Note: aom.pc generation uses GNUInstallDirs: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html + macro(setup_aom_install_targets) +- if(NOT (MSVC OR XCODE)) ++ if(1) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + +@@ -73,7 +73,8 @@ macro(setup_aom_install_targets) + endif() + + if(BUILD_SHARED_LIBS) +- set(AOM_INSTALL_LIBS aom aom_static) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ set(AOM_INSTALL_LIBS aom) + else() + set(AOM_INSTALL_LIBS aom) + endif() +@@ -85,8 +86,10 @@ macro(setup_aom_install_targets) + install( + FILES "${AOM_PKG_CONFIG_FILE}" + DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") +- install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ++ install(TARGETS ${AOM_INSTALL_LIBS} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if(ENABLE_EXAMPLES) + install(TARGETS ${AOM_INSTALL_BINS} DESTINATION diff --git a/recipes/libaom-av1/all/patches/0001-2.0.1-msvc-install.patch b/recipes/libaom-av1/all/patches/0001-2.0.1-msvc-install.patch deleted file mode 100644 index 0987f6f1f0ae1..0000000000000 --- a/recipes/libaom-av1/all/patches/0001-2.0.1-msvc-install.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- build/cmake/aom_install.cmake -+++ build/cmake/aom_install.cmake -@@ -93,4 +93,20 @@ - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") - endif() - endif() -+ -+ if (MSVC) -+ if(BUILD_SHARED_LIBS) -+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) -+ endif() -+ set(AOM_INSTALL_LIBS aom) -+ install( -+ FILES ${AOM_INSTALL_INCS} -+ DESTINATION "include/aom") -+ install( -+ TARGETS ${AOM_INSTALL_LIBS} -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) -+ endif() -+ - endmacro() diff --git a/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch new file mode 100644 index 0000000000000..af10132d05fe7 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch @@ -0,0 +1,34 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -26,7 +26,7 @@ endif() + # Note: aom.pc generation uses GNUInstallDirs: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html + macro(setup_aom_install_targets) +- if(NOT (MSVC OR XCODE)) ++ if(1) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + +@@ -76,7 +76,8 @@ macro(setup_aom_install_targets) + endif() + + if(BUILD_SHARED_LIBS) +- set(AOM_INSTALL_LIBS aom aom_static) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ set(AOM_INSTALL_LIBS aom) + else() + set(AOM_INSTALL_LIBS aom) + endif() +@@ -88,8 +89,10 @@ macro(setup_aom_install_targets) + install( + FILES "${AOM_PKG_CONFIG_FILE}" + DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") +- install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ++ install(TARGETS ${AOM_INSTALL_LIBS} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if(ENABLE_EXAMPLES) + install(TARGETS ${AOM_INSTALL_BINS} DESTINATION diff --git a/recipes/libaom-av1/all/patches/0001-3.1.1-msvc-install.patch b/recipes/libaom-av1/all/patches/0001-3.1.1-msvc-install.patch deleted file mode 100644 index f8a40a597a500..0000000000000 --- a/recipes/libaom-av1/all/patches/0001-3.1.1-msvc-install.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- build/cmake/aom_install.cmake -+++ build/cmake/aom_install.cmake -@@ -96,4 +96,20 @@ - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") - endif() - endif() -+ -+ if (MSVC) -+ if(BUILD_SHARED_LIBS) -+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) -+ endif() -+ set(AOM_INSTALL_LIBS aom) -+ install( -+ FILES ${AOM_INSTALL_INCS} -+ DESTINATION "include/aom") -+ install( -+ TARGETS ${AOM_INSTALL_LIBS} -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) -+ endif() -+ - endmacro() diff --git a/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch new file mode 100644 index 0000000000000..0dc76d16fc7f5 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch @@ -0,0 +1,21 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -27,7 +27,7 @@ endif() + # Note: aom.pc generation uses GNUInstallDirs: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html + macro(setup_aom_install_targets) +- if(NOT XCODE) ++ if(1) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + +@@ -77,7 +77,8 @@ macro(setup_aom_install_targets) + endif() + + if(BUILD_SHARED_LIBS) +- set(AOM_INSTALL_LIBS aom aom_static) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ set(AOM_INSTALL_LIBS aom) + else() + set(AOM_INSTALL_LIBS aom) + endif() diff --git a/recipes/libaom-av1/all/test_package/CMakeLists.txt b/recipes/libaom-av1/all/test_package/CMakeLists.txt index 7b9b613cbb24a..23fdbf257623a 100644 --- a/recipes/libaom-av1/all/test_package/CMakeLists.txt +++ b/recipes/libaom-av1/all/test_package/CMakeLists.txt @@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) + +find_package(libaom-av1 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} libaom-av1::libaom-av1) diff --git a/recipes/libaom-av1/all/test_package/conanfile.py b/recipes/libaom-av1/all/test_package/conanfile.py index d4128b0450777..38f4483872d47 100644 --- a/recipes/libaom-av1/all/test_package/conanfile.py +++ b/recipes/libaom-av1/all/test_package/conanfile.py @@ -3,8 +3,8 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/libaom-av1/config.yml b/recipes/libaom-av1/config.yml index 3cf54cc7b2185..f8672e68656da 100644 --- a/recipes/libaom-av1/config.yml +++ b/recipes/libaom-av1/config.yml @@ -1,4 +1,6 @@ versions: + "3.3.0": + folder: all "3.1.2": folder: all "3.1.1":