-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
69 lines (58 loc) · 2.21 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
import textwrap
from conans import ConanFile, CMake, tools
class XxhashConan(ConanFile):
name = "xxhash"
description = (
"xxHash is an extremely fast non-cryptographic hash "
"algorithm, working at speeds close to RAM limits"
)
version = "0.6.5"
license = "BSD"
url = "https://cyan4973.github.io/xxHash/"
repo_url = "https://github.com/Cyan4973/xxHash"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = "shared=False", "fPIC=True"
generators = "cmake"
no_copy_sources = True
def source(self):
tools.get("%s/archive/v%s.zip" % (self.repo_url, self.version))
tools.replace_in_file(
"xxHash-%s/cmake_unofficial/CMakeLists.txt" % self.version,
"cmake_minimum_required (VERSION 2.8.12)",
textwrap.dedent(
"""\
cmake_minimum_required (VERSION 2.8.12)
cmake_policy(SET CMP0063 NEW) # Symbol visibility
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup()
"""
).rstrip(),
)
tools.replace_in_file(
"xxHash-%s/cmake_unofficial/CMakeLists.txt" % self.version,
"install(TARGETS xxhash",
textwrap.dedent(
"""\
install(TARGETS xxhash
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
"""
).rstrip(),
)
def configure_cmake(self):
cmake = CMake(self)
cmake.verbose = True
if not self.options.shared:
cmake.definitions["CMAKE_C_VISIBILITY_PRESET"] = "hidden"
if self.settings.compiler == "Visual Studio" and self.options.shared:
cmake.definitions["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
cmake.configure(source_folder="xxHash-%s/cmake_unofficial" % self.version)
return cmake
def build(self):
self.configure_cmake().build()
def package(self):
self.configure_cmake().install()
def package_info(self):
self.cpp_info.libs = ["xxhash"]
def configure(self):
del self.settings.compiler.libcxx