-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathconanfile.py
109 lines (94 loc) · 3.62 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
104
105
106
107
108
109
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build.cppstd import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
import os
required_conan_version = ">=2.0"
class SparrowRecipe(ConanFile):
name = "sparrow"
description = "C++20 idiomatic APIs for the Apache Arrow Columnar Format"
license = "Apache-2.0"
author = "Man Group"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/man-group/sparrow"
topics = ("arrow", "apache arrow", "columnar format", "dataframe")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps"
exports_sources = "include/*", "LICENSE", "src/*", "cmake/*", "docs/*", "CMakeLists.txt", "sparrowConfig.cmake.in"
options = {
"shared": [True, False],
"fPIC": [True, False],
"use_date_polyfill": [True, False],
"build_tests": [True, False],
"generate_documentation": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"use_date_polyfill": False,
"build_tests": False,
"generate_documentation": False,
}
def requirements(self):
if self.options.get_safe("use_date_polyfill"):
self.requires("date/3.0.3")
if self.options.get_safe("build_tests"):
self.test_requires("doctest/2.4.11")
self.test_requires("catch2/3.7.0")
def build_requirements(self):
if self.options.get_safe("generate_documentation"):
self.tool_requires("doxygen/1.9.4", options={"enable_app": "True"})
@property
def _min_cppstd(self):
return 20
@property
def _compilers_minimum_version(self):
return {
"apple-clang": "16",
"clang": "18",
"gcc": "12",
"msvc": "194"
}
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
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 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=".")
def generate(self):
tc = CMakeToolchain(self)
tc.variables["USE_DATE_POLYFILL"] = self.options.get_safe(
"use_date_polyfill", False)
tc.variables["BUILD_TESTS"] = self.options.get_safe("build_tests", False)
if is_msvc(self):
tc.variables["USE_LARGE_INT_PLACEHOLDERS"] = True
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE",
dst=os.path.join(self.package_folder, "licenses"),
src=self.source_folder)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["sparrow"]
self.cpp_info.set_property("cmake_file_name", "sparrow")
self.cpp_info.set_property("cmake_target_name", "sparrow::sparrow")