diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index 0065582b94835..fa3461e28d629 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -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 @@ -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, } @@ -55,10 +56,16 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + def validate(self): + if self.dependencies["libsndio"].options.get_safe("with_alsa") and not self.options.get_safe("with_alsa"): + raise ConanInvalidConfiguration(f"{self.ref} 'with_alsa' option should be True when the libsndio 'with_alsa' one is True") + 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: @@ -75,8 +82,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: @@ -124,6 +130,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",