-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathconanfile.py
64 lines (55 loc) · 2.39 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, shutil
from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild
from conans.errors import ConanException
MSDEV_PLATFORM_SHORT_NAMES = {
'x86': 'x86',
'x86_64': 'x64'
}
class RecklessConan(ConanFile):
name = 'reckless'
license = 'MIT'
version = '3.0.1'
url = 'https://github.com/mattiasflodin/reckless'
description = """Reckless is an extremely low-latency, high-throughput logging library."""
settings = 'arch', 'compiler', 'build_type'
exports_sources = (
"reckless/src/*",
"reckless/include/*",
"Makefile.conan",
"reckless.sln",
"common.props",
"*.vcxproj"
)
def configure(self):
if self._gcc_compatible() and self.settings.compiler.libcxx == "libstdc++":
raise ConanException("This package is only compatible with libstdc++11. "
"Please run with -s compiler.libcxx=libstdc++11.")
def build(self):
if self.settings.compiler == "Visual Studio":
env = MSBuild(self)
env.build('reckless.sln', use_env=False, targets=['reckless:Rebuild'])
else:
env = AutoToolsBuildEnvironment(self)
env.make(args=['-f', 'Makefile.conan'], target="clean")
# Why doesn't Conan set CXX?
vars = env.vars
vars['CXX'] = str(self.settings.compiler)
env.make(args=['-f', 'Makefile.conan'], vars=vars)
def package(self):
if self._gcc_compatible():
self.copy('*.a', src='reckless/lib', dst='lib', keep_path=False)
else:
platform_short_name = MSDEV_PLATFORM_SHORT_NAMES[str(self.settings.arch)]
configuration_name = str(self.settings.build_type).lower()
build_directory = os.path.join('build', '%s-%s' % (platform_short_name, configuration_name))
self.copy('*.lib', src=build_directory, dst='lib', keep_path=False)
self.copy('*.pdb', src=build_directory, dst='lib', keep_path=False)
self.copy('*.hpp', src='reckless/include', dst='include', keep_path=True)
self.copy('*.cpp', src='reckless/src', dst='src', keep_path=True)
self.copy('LICENSE.txt', src='src')
def package_info(self):
self.cpp_info.libs = ["reckless"]
def _gcc_compatible(self):
return str(self.settings.compiler) in ['gcc', 'clang', 'apple-clang']