conanfile.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from conans import ConanFile, CMake, tools
  2. import os
  3. class LibFlacConan(ConanFile):
  4. name = "libflac"
  5. version = "1.3.2"
  6. license = "BSD-2-Clause"
  7. author = "Shawn Morford <DarkMorford@Gmail.com>"
  8. url = "https://code.darkmorford.net/conan-pkg/libflac"
  9. description = ("FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3, "
  10. "but lossless, meaning that audio is compressed in FLAC without any loss in quality.")
  11. homepage = "https://xiph.org/flac/"
  12. topics = ("media", "audio", "lossless", "xiph.org")
  13. requires = [("libogg/1.3.4@darkmorford/stable", "private")]
  14. settings = "os", "compiler", "build_type", "arch"
  15. options = {"shared": [True, False], "fPIC": [True, False]}
  16. default_options = {"shared": True, "fPIC": True}
  17. @property
  18. def subfolder(self):
  19. return os.path.join(self.source_folder, f"flac-{self.version}")
  20. def config_options(self):
  21. if self.settings.os == "Windows":
  22. self.options.remove("fPIC")
  23. def configure(self):
  24. del self.settings.compiler.cppstd
  25. del self.settings.compiler.libcxx
  26. def source(self):
  27. tools.get(**self.conan_data["sources"][self.version])
  28. def build(self):
  29. cmake = CMake(self)
  30. cmake.configure(source_folder="hello")
  31. cmake.build()
  32. # Explicit way:
  33. # self.run('cmake %s/hello %s'
  34. # % (self.source_folder, cmake.command_line))
  35. # self.run("cmake --build . %s" % cmake.build_config)
  36. def package(self):
  37. self.copy("*.h", dst="include", src="hello")
  38. self.copy("*hello.lib", dst="lib", keep_path=False)
  39. self.copy("*.dll", dst="bin", keep_path=False)
  40. self.copy("*.so", dst="lib", keep_path=False)
  41. self.copy("*.dylib", dst="lib", keep_path=False)
  42. self.copy("*.a", dst="lib", keep_path=False)
  43. def package_info(self):
  44. self.cpp_info.libs = ["hello"]