mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-14 10:38:14 +00:00

* giflib: modernize + install binaries * gitlib: reformat test_package.c * giflib: add BUNDLE for iOS Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * giflib: set explicit libs in `package_info` Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * giflib: add getopt-for-visual-studio build requirement Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
82 lines
2.5 KiB
Python
82 lines
2.5 KiB
Python
from conans import CMake, ConanFile, tools
|
|
import os
|
|
|
|
required_conan_version = ">=1.33.0"
|
|
|
|
|
|
class GiflibConan(ConanFile):
|
|
name = "giflib"
|
|
description = "A library and utilities for reading and writing GIF images."
|
|
url = "https://github.com/conan-io/conan-center-index"
|
|
license = "MIT"
|
|
homepage = "http://giflib.sourceforge.net"
|
|
topics = ("giflib", "image", "multimedia", "format", "graphics")
|
|
settings = "os", "arch", "compiler", "build_type"
|
|
options = {
|
|
"shared": [True, False],
|
|
"fPIC": [True, False],
|
|
}
|
|
default_options = {
|
|
"shared": False,
|
|
"fPIC": True,
|
|
}
|
|
|
|
exports_sources = "CMakeLists.txt", "patches/*"
|
|
generators = "cmake"
|
|
|
|
_cmake = None
|
|
|
|
@property
|
|
def _source_subfolder(self):
|
|
return "source_subfolder"
|
|
|
|
def config_options(self):
|
|
if self.settings.os == "Windows":
|
|
del self.options.fPIC
|
|
|
|
def configure(self):
|
|
if self.options.shared:
|
|
del self.options.fPIC
|
|
del self.settings.compiler.libcxx
|
|
del self.settings.compiler.cppstd
|
|
|
|
def requirements(self):
|
|
if self.settings.compiler == "Visual Studio":
|
|
self.requires("getopt-for-visual-studio/20200201")
|
|
|
|
def source(self):
|
|
tools.get(**self.conan_data["sources"][self.version],
|
|
destination=self._source_subfolder, strip_root=True)
|
|
|
|
def _configure_cmake(self):
|
|
if self._cmake:
|
|
return self._cmake
|
|
self._cmake = CMake(self)
|
|
self._cmake.configure()
|
|
return self._cmake
|
|
|
|
def _patch_sources(self):
|
|
for patch in self.conan_data.get("patches", {}).get(self.version, []):
|
|
tools.patch(**patch)
|
|
|
|
def build(self):
|
|
self._patch_sources()
|
|
cmake = self._configure_cmake()
|
|
cmake.build()
|
|
|
|
def package(self):
|
|
self.copy("COPYING", src=self._source_subfolder, dst="licenses")
|
|
cmake = self._configure_cmake()
|
|
cmake.install()
|
|
|
|
def package_info(self):
|
|
self.cpp_info.names["cmake_find_package"] = "GIF"
|
|
self.cpp_info.names["cmake_find_package_multi"] = "GIF"
|
|
self.cpp_info.libs = ["gif"]
|
|
if self.settings.compiler == "Visual Studio":
|
|
self.cpp_info.defines.append("USE_GIF_DLL" if self.options.shared else "USE_GIF_LIB")
|
|
|
|
bin_path = os.path.join(self.package_folder, "bin")
|
|
self.output.info("Appending PATH environment variable: {}".format(bin_path))
|
|
self.env_info.PATH.append(bin_path)
|