-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
86 lines (73 loc) · 2.86 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import os
from conans import ConanFile, CMake, tools
class LibsquishConan(ConanFile):
name = "libsquish"
description = "The libSquish library compresses images with the DXT " \
"standard (also known as S3TC)."
license = "MIT"
topics = ("conan", "libsquish", "image", "compression", "dxt", "s3tc")
homepage = "https://sourceforge.net/projects/libsquish"
url = "https://github.com/conan-io/conan-center-index"
exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"openmp": [True, False],
"sse2_intrinsics": [True, False],
"altivec_intrinsics": [True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"openmp": False,
"sse2_intrinsics": False,
"altivec_intrinsics": False
}
_cmake = None
@property
def _source_subfolder(self):
return "source_subfolder"
@property
def _build_subfolder(self):
return "build_subfolder"
@property
def _sse2_compliant_archs(self):
return ["x86", "x86_64"]
@property
def _altivec_compliant_archs(self):
return ["ppc32be", "ppc32", "ppc64le", "ppc64"]
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.settings.arch not in self._sse2_compliant_archs:
del self.options.sse2_intrinsics
if self.settings.arch not in self._altivec_compliant_archs:
del self.options.altivec_intrinsics
def source(self):
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder)
def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["BUILD_SQUISH_WITH_OPENMP"] = self.options.openmp
self._cmake.definitions["BUILD_SQUISH_WITH_SSE2"] = self.options.get_safe("sse2_intrinsics", False)
self._cmake.definitions["BUILD_SQUISH_WITH_ALTIVEC"] = self.options.get_safe("altivec_intrinsics", False)
self._cmake.definitions["BUILD_SQUISH_EXTRA"] = False
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake
def package(self):
self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("m")