Skip to content

Commit

Permalink
(#10716) libaom-av1: add 3.3.0 + download stable archives + relocatab…
Browse files Browse the repository at this point in the history
…le 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
  • Loading branch information
SpaceIm authored May 11, 2022
1 parent 86d39a8 commit 21e7664
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 77 deletions.
4 changes: 2 additions & 2 deletions recipes/libaom-av1/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
27 changes: 18 additions & 9 deletions recipes/libaom-av1/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
30 changes: 14 additions & 16 deletions recipes/libaom-av1/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -26,7 +27,6 @@ class LibaomAv1Conan(ConanFile):
}

generators = "cmake"
_cmake = None

@property
def _source_subfolder(self):
Expand Down Expand Up @@ -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, []):
Expand All @@ -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")
Expand Down
34 changes: 34 additions & 0 deletions recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch
Original file line number Diff line number Diff line change
@@ -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
23 changes: 0 additions & 23 deletions recipes/libaom-av1/all/patches/0001-2.0.1-msvc-install.patch

This file was deleted.

34 changes: 34 additions & 0 deletions recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch
Original file line number Diff line number Diff line change
@@ -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
23 changes: 0 additions & 23 deletions recipes/libaom-av1/all/patches/0001-3.1.1-msvc-install.patch

This file was deleted.

21 changes: 21 additions & 0 deletions recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 4 additions & 2 deletions recipes/libaom-av1/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions recipes/libaom-av1/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions recipes/libaom-av1/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.3.0":
folder: all
"3.1.2":
folder: all
"3.1.1":
Expand Down

0 comments on commit 21e7664

Please sign in to comment.