Skip to content

Commit

Permalink
pixman/0.40.0: enable shared MSVC build
Browse files Browse the repository at this point in the history
  • Loading branch information
db4 committed Aug 17, 2023
1 parent f07a6e9 commit 1a48c07
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions recipes/pixman/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from conan.tools.layout import basic_layout
from conan.tools.meson import Meson, MesonToolchain
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"

Expand Down Expand Up @@ -50,8 +51,8 @@ def layout(self):
basic_layout(self, src_folder="src")

def validate(self):
if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration("pixman can only be built as a static library on Windows")
if self.settings.os == "Windows" and self.options.shared and Version(self.version) < "0.40.0":
raise ConanInvalidConfiguration(f"pixman/{self.version} can only be built as a static library on Windows")

def build_requirements(self):
self.tool_requires("meson/1.1.1")
Expand Down Expand Up @@ -84,16 +85,17 @@ def package(self):
copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses"))
meson = Meson(self)
meson.install()
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
lib_folder = os.path.join(self.package_folder, "lib")
rmdir(self, os.path.join(lib_folder, "pkgconfig"))
rm(self, "*.la", lib_folder)
fix_apple_shared_install_name(self)
if is_msvc(self):
if is_msvc(self) and not self.options.shared:
prefix = "libpixman-1"
rename(self, os.path.join(lib_folder, f"{prefix}.a"), os.path.join(lib_folder, f"{prefix}.lib"))

def package_info(self):
self.cpp_info.libs = ['libpixman-1'] if self.settings.os == "Windows" else ['pixman-1']
self.cpp_info.libs = ['libpixman-1'] if self.settings.os == "Windows" and not self.options.shared else ['pixman-1']
self.cpp_info.includedirs.append(os.path.join("include", "pixman-1"))
self.cpp_info.set_property("pkg_config_name", "pixman-1")
if self.settings.os in ("FreeBSD", "Linux"):
Expand Down

0 comments on commit 1a48c07

Please sign in to comment.