-
Notifications
You must be signed in to change notification settings - Fork 26
/
conanfile.py
59 lines (48 loc) · 1.88 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
from conans import ConanFile, tools
import os
import json
import platform
import subprocess
class QuickPromiseConan(ConanFile):
name = "quickpromise"
version = "1.0.8"
license = "Apache 2.0"
url = "https://github.com/benlau/quickpromise"
description = "Promise library for QML"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
exports = "qconanextra.json"
exports_sources = "*.pro", "*.pri", "*.js", "*.h" , "*.cpp", "*.qml", "!tests/*", "*/qmldir", "*.qrc"
def package_id(self):
version_info = subprocess.check_output(['qmake', '--version'])
self.info.settings.compiler.qmake_version = version_info
def make(self, args=[]):
if platform.system() == "Windows":
self.run("nmake %s" % " ".join(args))
else:
self.run("make %s" % " ".join(args))
def qmake(self, args=[]):
cmd = "qmake %s" % (" ".join(args))
self.run(cmd)
def build(self):
args = ["%s/qml/qml.pro" % self.source_folder,
"INSTALL_ROOT=%s" % self.package_folder]
if self.options.shared:
args.append("SHARED=true")
self.qmake(args)
self.make()
def package(self):
self.make(["install"])
self.copy("*", src="qml/QuickPromise", dst="qml/QuickPromise", keep_path=True)
qconanextra_json = {}
if not self.options.shared:
qconanextra_json["resource"] = "quickpromise"
qconanextra_json["qml_import_path"] = "qml"
with open(os.path.join(self.package_folder, "qconanextra.json"), "w") as file:
file.write(json.dumps(qconanextra_json))
file.close()
def package_info(self):
if not self.options.shared:
self.cpp_info.libs = ["quickpromise"]
self.cpp_info.libdirs = [""]