Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added opus 1.5.1 #23234

Merged
merged 14 commits into from
Sep 13, 2024
5 changes: 5 additions & 0 deletions recipes/opus/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
23 changes: 19 additions & 4 deletions recipes/opus/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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],
Expand All @@ -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]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was required by the original cmakelist of the library


def export_sources(self):
export_conandata_patches(self)

Expand All @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions recipes/opus/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.5.2":
folder: all
"1.4":
folder: all
"1.3.1":
Expand Down
Loading