-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
50 lines (41 loc) · 1.81 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
import os
from conans import ConanFile, CMake, tools
class GraylogloggerConan(ConanFile):
name = "graylog-logger"
version_number = "2.1.5"
version = f"{version_number}"
license = "BSD 2-Clause"
url = "https://bintray.com/ess-dmsc/graylog-logger"
build_requires = ("gtest/1.11.0",)
requires = ("nlohmann_json/3.10.5", "asio/1.22.1", "concurrentqueue/1.0.3", "fmt/8.1.1")
settings = "os", "compiler", "build_type", "arch"
generators = ("cmake_find_package")
description = "A simple logging library with support for pushing messages to a graylog-logger service."
def source(self):
self.run("git clone https://github.com/ess-dmsc/graylog-logger.git")
self.run(f"cd graylog-logger && git checkout v{self.version_number}")
def _configure_cmake(self):
cmake = CMake(self, parallel=True)
cmake.definitions["BUILD_EVERYTHING"] = "OFF"
cmake.definitions["CONAN"] = "DISABLE"
if tools.os_info.is_macos:
cmake.definitions["CMAKE_MACOSX_RPATH"] = "ON"
cmake.definitions["CMAKE_SHARED_LINKER_FLAGS"] = "-headerpad_max_install_names"
cmake.configure(source_dir=self.name, build_dir=".")
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
if tools.os_info.is_macos:
os.system("install_name_tool -id '@rpath/libgraylog_logger.dylib' "
"graylog_logger/libgraylog_logger.dylib")
os.rename(
"graylog-logger/LICENSE.md",
"graylog-logger/LICENSE.graylog-logger"
)
def package(self):
cmake = self._configure_cmake()
cmake.install()
self.copy("LICENSE.*", src="graylog-logger")
def package_info(self):
self.cpp_info.libs = ["graylog_logger"]