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
3 changes: 3 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 Down
17 changes: 17 additions & 0 deletions recipes/opus/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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
Expand All @@ -21,14 +22,24 @@ class OpusConan(ConanFile):
"fPIC": [True, False],
"fixed_point": [True, False],
"stack_protector": [True, False],
"osce": [True, False],
"deep_plc": [True, False],
"dred": [True, False],
Copy link
Member

@uilianries uilianries Sep 10, 2024

Choose a reason for hiding this comment

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

Suggested change
"osce": [True, False],
"deep_plc": [True, False],
"dred": [True, False],

I would suggest removing these new options.

When any of them is enabled, it will require DNN support as well:

https://gitlab.xiph.org/xiph/opus/-/compare/v1.4...v1.5.2?from_project_id=36&straight=false#9a2aa4db38d3115ed60da621e012c0efc0172aae_368_401

Which results in the follow error:

-- Configuring done (14.7s)
CMake Error at cmake/OpusFunctions.cmake:180 (target_sources):
  Cannot find source file:

    dnn/fargan_data.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc
Call Stack (most recent call first):
  CMakeLists.txt:400 (add_sources_group)

The dnn/fargan_data.h is a generated file, resulted from the pre-training commands using Python command, this is a pre-step, before building, something hard to be managed: https://gitlab.xiph.org/xiph/opus/-/blob/v1.5.2/dnn/torch/fargan/README.md#L37

As those options are OFF by default, even in the project (https://gitlab.xiph.org/xiph/opus/-/blob/v1.5.2/CMakeLists.txt#L86) we don't see it, but it's the scenario that will result in new issues for CCI in the future.

}
default_options = {
"shared": False,
"fPIC": True,
"fixed_point": False,
"stack_protector": True,
"osce": False,
"deep_plc": False,
"dred": False,
}

def build_requirements(self):
if 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,6 +58,8 @@ def layout(self):

def validate(self):
check_min_vs(self, 190)
if self.version == "1.5.2" and self.settings.compiler == "gcc" and self.settings.compiler.version in ["5", "7"]:
raise ConanInvalidConfiguration(f"GCC {self.settings.compiler.version} not supported due to lack of AVX2 support")

def source(self):
get(self, **self.conan_data["sources"][self.version],
Expand All @@ -56,6 +69,10 @@ def generate(self):
tc = CMakeToolchain(self)
tc.variables["OPUS_FIXED_POINT"] = self.options.fixed_point
tc.variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector
tc.variables["OPUS_OSCE"] = self.options.osce
tc.variables["OPUS_DEEP_PLC"] = self.options.deep_plc
tc.variables["OPUS_DRED"] = self.options.dred
dmpriso marked this conversation as resolved.
Show resolved Hide resolved
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tc.variables["OPUS_FIXED_POINT"] = self.options.fixed_point
tc.variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector
tc.variables["OPUS_OSCE"] = self.options.osce
tc.variables["OPUS_DEEP_PLC"] = self.options.deep_plc
tc.variables["OPUS_DRED"] = self.options.dred
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
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)
  • Considering that those new options osce, deep_plc and dred are not exposed.
  • Using cache_variables avoids CMP0077 usage
  • Opus uses dynamic runtime library by default, matching with CCI always, but silently failing when is static/MT

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