-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
conanfile.py
100 lines (83 loc) · 3.07 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.microsoft import is_msvc, check_min_vs
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.files import get, copy
from conan.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.50.0"
class RuntimeQml(ConanFile):
name = "runtimeqml"
homepage = "https://github.com/GIPdA/runtimeqml"
description = "Enables hot-reloading qml files"
topics = ("qt", "hot-reload", "qml", "gui")
url = "https://github.com/conan-io/conan-center-index"
license = "BSD-3-Clause"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"shared": False,
"fPIC": True
}
@property
def _minimum_cpp_standard(self):
return 17
@property
def _compilers_minimum_version(self):
return {
"gcc": "7",
"clang": "7",
"apple-clang": "10",
}
def export_sources(self):
copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src"))
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 requirements(self):
if Version(self.version) <= "cci.20211220":
self.requires("qt/5.15.13")
else:
self.requires("qt/6.6.2")
def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, self._minimum_cpp_standard)
check_min_vs(self, 191)
if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(
str(self.info.settings.compiler), False)
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support."
)
qt = self.dependencies["qt"]
if not qt.options.qtdeclarative:
raise ConanInvalidConfiguration(
f"{self.ref} requires option qt:qtdeclarative=True")
def source(self):
get(self, **self.conan_data["sources"][str(self.version)], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
tc = CMakeDeps(self)
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, pattern="LICENSE", src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"), keep_path=False)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["runtimeqml"]