-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
60 lines (50 loc) · 2.27 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
from conans import ConanFile, CMake, tools
class TrantorConan(ConanFile):
name = "trantor"
version = "1.5.0"
license = "BSD"
author = "an-tao"
url = "https://github.com/an-tao/trantor"
description = "a non-blocking I/O tcp network lib based on c++14/17"
topics = ("trantor", "tcp-server", "linux", "non-blocking-io", "asynchronous-programming")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "cmake", "cmake_find_package", "cmake_paths"
requires = ["openssl/1.1.1i", "c-ares/1.17.1"]
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def source(self):
self.run("git clone https://github.com/an-tao/trantor")
# This small hack might be useful to guarantee proper /MT /MD linkage
# in MSVC if the packaged project doesn't have variables to set it
# properly
tools.replace_in_file("trantor/CMakeLists.txt", "project(trantor)",
'''project(trantor)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})''')
tools.replace_in_file("trantor/CMakeLists.txt", "c-ares_lib", '''cares''')
def build(self):
cmake = CMake(self)
if self.options.shared:
cmake.definitions["BUILD_TRANTOR_SHARED"] = "On"
pass
cmake.configure(source_folder="trantor")
cmake.build()
# Explicit way:
# self.run('cmake %s/trantor %s'
# % (self.source_folder, cmake.command_line))
# self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*.h", dst="include", src="trantor")
self.copy("*.h", dst="include", src="exports")
self.copy("*trantor.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so*", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["trantor"]