Repository navigation
Expand file tree
/
Copy pathconanfile.py
More file actions
153 lines (125 loc) · 5.36 KB
/
Copy pathconanfile.py
File metadata and controls
153 lines (125 loc) · 5.36 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
'''
MIT License
Copyright (c) 2020 Mikhail Milovidov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
import os
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.files import copy
from conan.tools.build import check_min_cppstd
from git_version import GitVersion
required_conan_version = ">=2.0"
class DaggyConan(ConanFile):
name = "daggy"
license = "MIT"
homepage = "https://daggy.dev"
url = "https://github.com/synacker/daggy"
description = "Data Aggregation Utility and C/C++ developer library for data streams catching."
settings = "os", "compiler", "build_type", "arch"
options = {
"apponly": [True, False],
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"apponly": False,
"shared": True,
"fPIC": True
}
generators = "CMakeDeps"
exports = ["src/*"]
_gv = GitVersion()
def set_version(self):
self.version = self._gv.full
def validate(self):
check_min_cppstd(self, "17")
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.options.apponly:
self.options.shared = False
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if self.options.apponly:
self.options.rm_safe("shared")
if not self.options.apponly:
self.options["qt/*"].shared = self.options.shared
self.options["libssh2/*"].shared = self.options.shared
self.options["yaml-cpp/*"].shared = self.options.shared
self.options["qt/*"].gui = False
self.options["qt/*"].widgets = False
self.options["qt/*"].with_libpng = False
self.options["qt/*"].with_libjpeg = False
self.options["qt/*"].with_freetype = False
self.options["qt/*"].with_harfbuzz = False
self.options["qt/*"].with_fontconfig = False
self.options["qt/*"].with_icu = False
# Completely disable SQL drivers
self.options["qt/*"].with_sqlite3 = False
self.options["qt/*"].with_mysql = False
self.options["qt/*"].with_pq = False
self.options["qt/*"].with_odbc = False
def build_requirements(self):
self.tool_requires("cmake/4.3.2")
self.tool_requires("gtest/1.17.0")
def requirements(self):
self.requires("qt/6.11.1")
self.requires("kainjow-mustache/4.1")
self.requires("yaml-cpp/0.9.0")
self.requires("libssh2/1.11.1")
def layout(self):
self.folders.source = "src"
self.cpp.libdirs = ["lib"]
self.cpp.bindirs = ["bin"]
cmake_layout(self, src_folder=self.folders.source)
def generate(self):
libdir = os.path.normpath(os.path.join(self.build_folder, self.cpp.libdirs[0], self.name))
bindir = os.path.normpath(os.path.join(self.build_folder, self.cpp.bindirs[0]))
for dep in self.dependencies.values():
if self.settings.os == "Windows":
if dep.cpp_info.bindirs:
copy(self, "*.dll", dep.cpp_info.bindirs[0], bindir)
if dep.cpp_info.libdirs:
copy(self, "*.dll", dep.cpp_info.libdirs[0], bindir)
elif self.settings.os == "Linux":
if dep.cpp_info.libdirs:
copy(self, "*.so.*", dep.cpp_info.libdirs[0], libdir)
else:
if dep.cpp_info.libdirs:
copy(self, "*.dylib", dep.cpp_info.libdirs[0], libdir)
tc = CMakeToolchain(self)
tc.cache_variables["SSH2_SUPPORT"] = True
tc.cache_variables["YAML_SUPPORT"] = True
tc.cache_variables["CONSOLE"] = True
tc.cache_variables["APPONLY_BUILD"] = self.options.apponly
tc.cache_variables["PCAPNG_SUPPORT"] = False
tc.cache_variables["PORTABLE_BUILD"] = not self.options.apponly
tc.cache_variables["BUILD_TESTING"] = True
tc.cache_variables["CONAN_BUILD"] = True
tc.cache_variables["VERSION"] = self._gv.version
tc.cache_variables["VERSION_EXTENDED"] = self._gv.extended
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.configure()
cmake.install()