Initial commit
This commit is contained in:
77
pixelmatch-cpp17/all/conanfile.py
Normal file
77
pixelmatch-cpp17/all/conanfile.py
Normal file
@@ -0,0 +1,77 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.build import check_min_cppstd, valid_min_cppstd
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
|
||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.52.0"
|
||||
|
||||
|
||||
class PixelMatchCPP17Conan(ConanFile):
|
||||
name = "pixelmatch-cpp17"
|
||||
description = "A C++17 port of the JavaScript pixelmatch library, providing a small pixel-level image comparison library."
|
||||
license = "Apache-2.0"
|
||||
topics = ("image", "comparison")
|
||||
homepage = "https://github.com/jwmcglynn/pixelmatch-cpp17"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
@property
|
||||
def _source_subfolder(self):
|
||||
return "source_subfolder"
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
apply_conandata_patches(self)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.generate()
|
||||
CMakeDeps(self).generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(
|
||||
self,
|
||||
"LICENSE",
|
||||
src=self._source_subfolder,
|
||||
dst=os.path.join(self.package_folder, "licenses"),
|
||||
)
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["pixelmatch-cpp17"]
|
||||
|
||||
def requirements(self):
|
||||
if(Version(self.version) == "1.0.3"):
|
||||
self.requires("stb/cci.20240531", transitive_headers=True)
|
||||
Reference in New Issue
Block a user