-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathconanfile.py
82 lines (73 loc) · 3.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
class Log4cplusConan(ConanFile):
name = "log4cplus"
description = "simple to use C++ logging API, modelled after the Java log4j API"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/log4cplus/log4cplus"
topics = ("conan", "log4cplus", "logging", "log", "logging-library")
license = ("BSD-2-Clause, Apache-2.0")
exports_sources = ["CMakeLists.txt"]
generators = 'cmake'
settings = 'os', 'compiler', 'build_type', 'arch'
options = {'shared': [True, False],
"fPIC": [True, False],
"single_threaded": [True, False],
"build_logging_server": [True, False],
"with_iconv": [True, False],
"working_locale": [True, False],
"working_c_locale": [True, False],
"decorated_name": [True, False],
"unicode": [True, False]}
default_options = {'shared': False,
'fPIC': True,
'single_threaded': False,
'build_logging_server': False,
'with_iconv': False,
'working_locale': False,
'working_c_locale': False,
'decorated_name': False,
'unicode': True}
short_paths = True
_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"
def requirements(self):
if self.options.with_iconv:
self.requires.add('libiconv/1.16')
def config_options(self):
if self.settings.os == 'Windows':
del self.options.fPIC
def source(self):
archive_name = self.name + "-" + self.version
tools.get(**self.conan_data["sources"][self.version])
os.rename(archive_name, self._source_subfolder)
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions['UNICODE'] = self.options.unicode
cmake.definitions['LOG4CPLUS_BUILD_TESTING'] = False
cmake.definitions['WITH_UNIT_TESTS'] = False
cmake.definitions["LOG4CPLUS_ENABLE_DECORATED_LIBRARY_NAME"] = self.options.decorated_name
cmake.definitions['LOG4CPLUS_QT4'] = False
cmake.definitions['LOG4CPLUS_QT5'] = False
cmake.definitions['LOG4CPLUS_SINGLE_THREADED'] = self.options.single_threaded
cmake.definitions['LOG4CPLUS_BUILD_LOGGINGSERVER'] = self.options.build_logging_server
cmake.definitions['WITH_ICONV'] = self.options.with_iconv
cmake.definitions['LOG4CPLUS_WORKING_LOCALE'] = self.options.working_locale
cmake.definitions['LOG4CPLUS_WORKING_C_LOCALE'] = self.options.working_c_locale
cmake.configure(build_dir=self._build_subfolder)
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["dl", "pthread"]
elif self.settings.os == "Windows":
self.cpp_info.system_libs = ['Ws2_32']