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

Updates libsndfile to use conan-provided libsndio #23150

Merged
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions recipes/libsndfile/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, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
Expand Down Expand Up @@ -34,7 +35,7 @@ class LibsndfileConan(ConanFile):
"fPIC": True,
"programs": True,
"experimental": False,
"with_alsa": False,
"with_alsa": True,
"with_external_libs": True,
"with_mpeg": True,
}
Expand All @@ -55,10 +56,17 @@ def configure(self):
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

def validate(self):
if self.options.get_safe("with_alsa") != self.dependencies["libsndio"].options.get_safe("with_alsa"):
raise ConanInvalidConfiguration(f"{self.ref} with_alsa ({self.options.get_safe('with_alsa')}) option "\
f"should be equal to the libsndio with_alsa ({self.dependencies['libsndio'].options.get_safe('with_alsa')}) one")

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("libsndio/1.9.0",
options={"with_alsa": self.options.get_safe("with_alsa")})
if self.options.get_safe("with_alsa"):
self.requires("libalsa/1.2.10")
if self.options.with_external_libs:
Expand All @@ -75,8 +83,7 @@ def source(self):

def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Sndio"] = True # FIXME: missing sndio cci recipe (check whether it is really required)
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing sndio cci recipe (check whether it is really required)
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing speex cci recipe (check whether it is really required)
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SQLite3"] = True # only used for regtest
tc.variables["ENABLE_EXTERNAL_LIBS"] = self.options.with_external_libs
if not self.options.with_external_libs:
Expand Down Expand Up @@ -124,6 +131,7 @@ def package_info(self):
self.cpp_info.set_property("pkg_config_name", "sndfile")
# TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
self.cpp_info.components["sndfile"].libs = ["sndfile"]
self.cpp_info.components["sndfile"].requires.append("libsndio::libsndio")
if self.options.with_external_libs:
self.cpp_info.components["sndfile"].requires.extend([
"ogg::ogg", "vorbis::vorbismain", "vorbis::vorbisenc",
Expand Down