Skip to content

Commit

Permalink
(conan-io#13124) libalsa: set cpp_info.resdirs & minor improvements
Browse files Browse the repository at this point in the history
* set resdirs

* cleanup imports

* use export_conandata_patches

* explicit test_type in test_package
  • Loading branch information
SpaceIm authored and kayoub5 committed Sep 29, 2022
1 parent 3e7730d commit 0551d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
15 changes: 7 additions & 8 deletions recipes/libalsa/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, chdir, copy, get, rm, rmdir
from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import unix_path
import os

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.52.0"


class LibalsaConan(ConanFile):
Expand All @@ -32,8 +31,7 @@ class LibalsaConan(ConanFile):
}

def export_sources(self):
for p in self.conan_data.get("patches", {}).get(self.version, []):
copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder)
export_conandata_patches(self)

def configure(self):
if self.options.shared:
Expand All @@ -47,16 +45,16 @@ def configure(self):
except Exception:
pass

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

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("Only Linux supported")

def build_requirements(self):
self.tool_requires("libtool/2.4.7")

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

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
Expand Down Expand Up @@ -95,6 +93,7 @@ def package_info(self):
self.cpp_info.set_property("cmake_target_name", "ALSA::ALSA")
self.cpp_info.set_property("pkg_config_name", "alsa")
self.cpp_info.libs = ["asound"]
self.cpp_info.resdirs = ["res"]
self.cpp_info.system_libs = ["dl", "m", "rt", "pthread"]
alsa_config_dir = os.path.join(self.package_folder, "res", "alsa")
self.runenv_info.define_path("ALSA_CONFIG_DIR", alsa_config_dir)
Expand Down
7 changes: 4 additions & 3 deletions recipes/libalsa/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"

def requirements(self):
self.requires(self.tested_reference_str)
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down

0 comments on commit 0551d41

Please sign in to comment.