Skip to content

Commit a2f63da

Browse files
dmprisodanimtbdanimtbMartin Valguruilianries
authored
(#23234) added opus 1.5.1
* [config] Add some conan v2 ready refenrences to the list * added opus 1.5.1 * Added CMP0077 as suggested Co-authored-by: Martin Valgur <[email protected]> * Change sources url * add cmake 3.16 or higher br * gcc5 invalid * gcc7 invalid * Update cmake variables Signed-off-by: Uilian Ries <[email protected]> * Remove new options due dnn Signed-off-by: Uilian Ries <[email protected]> * Add Virtualbuildenv for cmake Signed-off-by: Uilian Ries <[email protected]> * Add missing Version Signed-off-by: Uilian Ries <[email protected]> * Apply lint suggestiongs Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: danimtb <[email protected]> Co-authored-by: danimtb <[email protected]> Co-authored-by: Martin Valgur <[email protected]> Co-authored-by: Uilian Ries <[email protected]>
1 parent 17f3c60 commit a2f63da

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

recipes/opus/all/conandata.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
sources:
2+
"1.5.2":
3+
url: "https://gitlab.xiph.org/xiph/opus/-/archive/v1.5.2/opus-v1.5.2.tar.gz"
4+
sha256: "5cf92b5b577d8ed203424f1e0f618f30bc6b6e42a26eae88bdb649ea63961cc9"
25
"1.4":
36
url: "https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz"
47
sha256: "c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f"
@@ -8,3 +11,5 @@ sources:
811
patches:
912
"1.3.1":
1013
- patch_file: "patches/1.3.1-add-opus_buildtype-cmake.patch"
14+
patch_description: "Set a default build type if none was specified"
15+
patch_type: "portability"

recipes/opus/all/conanfile.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from conan import ConanFile
2+
from conan.errors import ConanInvalidConfiguration
23
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
34
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
4-
from conan.tools.microsoft import check_min_vs
5+
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
6+
from conan.tools.env import VirtualBuildEnv
7+
from conan.tools.scm import Version
58
import os
69

710
required_conan_version = ">=1.53.0"
@@ -14,7 +17,7 @@ class OpusConan(ConanFile):
1417
url = "https://github.com/conan-io/conan-center-index"
1518
homepage = "https://opus-codec.org"
1619
license = "BSD-3-Clause"
17-
20+
package_type = "library"
1821
settings = "os", "arch", "compiler", "build_type"
1922
options = {
2023
"shared": [True, False],
@@ -29,6 +32,10 @@ class OpusConan(ConanFile):
2932
"stack_protector": True,
3033
}
3134

35+
def build_requirements(self):
36+
if Version(self.version) >= "1.5.2":
37+
self.tool_requires("cmake/[>=3.16 <4]")
38+
3239
def export_sources(self):
3340
export_conandata_patches(self)
3441

@@ -47,15 +54,23 @@ def layout(self):
4754

4855
def validate(self):
4956
check_min_vs(self, 190)
57+
if Version(self.version) >= "1.5.2" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8":
58+
raise ConanInvalidConfiguration(f"{self.ref} GCC-{self.settings.compiler.version} not supported due to lack of AVX2 support. Use GCC >=8.")
5059

5160
def source(self):
5261
get(self, **self.conan_data["sources"][self.version],
5362
destination=self.source_folder, strip_root=True)
5463

5564
def generate(self):
65+
if Version(self.version) >= "1.5.2":
66+
env = VirtualBuildEnv(self)
67+
env.generate()
5668
tc = CMakeToolchain(self)
57-
tc.variables["OPUS_FIXED_POINT"] = self.options.fixed_point
58-
tc.variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector
69+
tc.cache_variables["OPUS_BUILD_SHARED_LIBRARY"] = self.options.shared
70+
tc.cache_variables["OPUS_FIXED_POINT"] = self.options.fixed_point
71+
tc.cache_variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector
72+
if Version(self.version) >= "1.5.2" and is_msvc(self):
73+
tc.cache_variables["OPUS_STATIC_RUNTIME"] = is_msvc_static_runtime(self)
5974
tc.generate()
6075

6176
def build(self):

recipes/opus/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
versions:
2+
"1.5.2":
3+
folder: all
24
"1.4":
35
folder: all
46
"1.3.1":

0 commit comments

Comments
 (0)