-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
56 lines (48 loc) · 1.99 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
import os
from conans import ConanFile, CMake, tools
class RpclibConan(ConanFile):
name = "rpclib"
version = "dev"
license = "MIT"
url = "https://github.com/rpclib/rpclib-conan"
description = "RPC for modern C++"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
def source(self):
archive = "rpclib.zip"
tools.download(
"https://github.com/rpclib/rpclib/archive/"
"{v}.zip".format(v=self.version),
archive)
tools.unzip(archive)
os.unlink(archive)
def config_options(self):
compiler = self.settings.compiler
version = float(str(compiler.version))
if compiler == "gcc" and version < 4.8:
raise ValueError("The minimum supported GCC version is 4.8")
elif compiler == "clang" and version < 3.7:
raise ValueError("The minimum supported clang version is 3.7")
elif compiler == "apple-clang" and version < 8.0:
raise ValueError(
"The minimum supported Apple Clang version is 8.0")
def build(self):
self.cmake = CMake(self, parallel=True)
compiler = self.settings.compiler
if compiler == "Visual Studio" and "MT" in str(compiler.runtime):
self.cmake.definitions["RPCLIB_MSVC_STATIC_RUNTIME"] = "ON"
elif str(compiler) in ("gcc", "clang", "apple-clang"):
if self.settings.arch == 'x86':
self.cmake.definitions["CMAKE_C_FLAGS"] = "-m32"
self.cmake.definitions["CMAKE_CXX_FLAGS"] = "-m32"
else:
self.cmake.definitions["CMAKE_C_FLAGS"] = "-m64"
self.cmake.definitions["CMAKE_CXX_FLAGS"] = "-m64"
self.cmake.configure(source_dir="rpclib-{0}".format(self.version))
self.cmake.build()
def package(self):
self.cmake.install()
def package_info(self):
self.cpp_info.libs = ["rpc"]