Skip to content

Commit

Permalink
(#23234) added opus 1.5.1
Browse files Browse the repository at this point in the history
* [config] Add some conan v2 ready refenrences to the list

* added opus 1.5.1

* Added CMP0077 as suggested

Co-authored-by: Martin Valgur <martin.valgur@gmail.com>

* Change sources url

* add cmake 3.16 or higher br

* gcc5 invalid

* gcc7 invalid

* Update cmake variables

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Remove new options due dnn

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add Virtualbuildenv for cmake

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add missing Version

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Apply lint suggestiongs

Signed-off-by: Uilian Ries <uilianries@gmail.com>

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: danimtb <danimanzaneque@gmail.com>
Co-authored-by: danimtb <danimanzanequem@gmail.com>
Co-authored-by: Martin Valgur <martin.valgur@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
5 people authored Sep 13, 2024
1 parent 17f3c60 commit a2f63da
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
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]")

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

0 comments on commit a2f63da

Please sign in to comment.