diff --git a/recipes/opus/all/conandata.yml b/recipes/opus/all/conandata.yml index 5ac1b419900e1..a7288d00d394f 100644 --- a/recipes/opus/all/conandata.yml +++ b/recipes/opus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.2": + url: "https://gitlab.xiph.org/xiph/opus/-/archive/v1.5.2/opus-v1.5.2.tar.gz" + sha256: "5cf92b5b577d8ed203424f1e0f618f30bc6b6e42a26eae88bdb649ea63961cc9" "1.4": url: "https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz" sha256: "c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f" @@ -8,3 +11,5 @@ sources: patches: "1.3.1": - patch_file: "patches/1.3.1-add-opus_buildtype-cmake.patch" + patch_description: "Set a default build type if none was specified" + patch_type: "portability" diff --git a/recipes/opus/all/conanfile.py b/recipes/opus/all/conanfile.py index 2dfefae5f4332..f1ca41949ac83 100644 --- a/recipes/opus/all/conanfile.py +++ b/recipes/opus/all/conanfile.py @@ -1,7 +1,10 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir -from conan.tools.microsoft import check_min_vs +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -14,7 +17,7 @@ class OpusConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://opus-codec.org" license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,6 +32,10 @@ class OpusConan(ConanFile): "stack_protector": True, } + def build_requirements(self): + if Version(self.version) >= "1.5.2": + self.tool_requires("cmake/[>=3.16 <4]") + def export_sources(self): export_conandata_patches(self) @@ -47,15 +54,23 @@ def layout(self): def validate(self): check_min_vs(self, 190) + if Version(self.version) >= "1.5.2" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": + raise ConanInvalidConfiguration(f"{self.ref} GCC-{self.settings.compiler.version} not supported due to lack of AVX2 support. Use GCC >=8.") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + if Version(self.version) >= "1.5.2": + env = VirtualBuildEnv(self) + env.generate() tc = CMakeToolchain(self) - tc.variables["OPUS_FIXED_POINT"] = self.options.fixed_point - tc.variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector + tc.cache_variables["OPUS_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.cache_variables["OPUS_FIXED_POINT"] = self.options.fixed_point + tc.cache_variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector + if Version(self.version) >= "1.5.2" and is_msvc(self): + tc.cache_variables["OPUS_STATIC_RUNTIME"] = is_msvc_static_runtime(self) tc.generate() def build(self): diff --git a/recipes/opus/config.yml b/recipes/opus/config.yml index 3360afdd0ecab..e9cd861cf2166 100644 --- a/recipes/opus/config.yml +++ b/recipes/opus/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.2": + folder: all "1.4": folder: all "1.3.1":