-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
103 lines (85 loc) · 3.23 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
101
102
103
import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import copy, rmdir, rm
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.build import check_min_cppstd
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version
required_conan_version = ">=2.7.0"
class ScriptaConan(ConanFile):
name = "scripta"
license = ""
author = "UltiMaker"
user = "ultimaker"
url = "https://github.com/Ultimaker/Scripta"
description = "A visual debugger for CuraEngine called after the moth species Habrosyne scripta"
topics = ("cura", "c++", "curaengine", "vtu", "gcode-generation", "3d-printing")
exports = "LICENSE*"
settings = "os", "compiler", "build_type", "arch"
no_copy_source = True
package_type = "header-library"
options = {
"enable_testing": [True, False],
"enable_extensive_warnings": [True, False]
}
default_options = {
"enable_testing": False,
"enable_extensive_warnings": False,
}
@property
def _min_cppstd(self):
return 20
@property
def _compilers_minimum_version(self):
return {
"gcc": "10",
"clang": "7",
"apple-clang": "13",
"msvc": "192",
"visual_studio": "17"
}
def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
copy(self, "*", os.path.join(self.recipe_folder, "include"), os.path.join(self.export_sources_folder, "include"))
def layout(self):
cmake_layout(self)
def package_id(self):
self.info.clear()
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/stable")
def generate(self):
tc = CMakeToolchain(self)
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()
tc = CMakeDeps(self)
tc.generate()
tc = VirtualBuildEnv(self)
tc.generate(scope="build")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(
self,
pattern="*.h",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"),
)
def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
self.conf_info.define("user.scripta:visual_debug", False)