feat: add conanfile.py for rabbitmq-c and remove redundant LICENSE file
This commit is contained in:
27
LICENSE
27
LICENSE
@@ -1,27 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2012-2021 Alan Antonuk
|
|
||||||
|
|
||||||
Copyright (c) 2007-2012 VMware, Inc.
|
|
||||||
|
|
||||||
Copyright (c) 2009-2010 VMware, Inc. and Tony Garnock-Jones
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use, copy,
|
|
||||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
89
conanfile.py
Normal file
89
conanfile.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
|
||||||
|
from conan.tools.files import copy
|
||||||
|
import os
|
||||||
|
|
||||||
|
class RabbitmqCConan(ConanFile):
|
||||||
|
name = "rabbitmq-c"
|
||||||
|
version = "0.11.0"
|
||||||
|
description = "C RabbitMQ AMQP client library"
|
||||||
|
url = "https://github.com/alanxz/rabbitmq-c"
|
||||||
|
license = "MIT"
|
||||||
|
author = "Alan Antonuk and the rabbitmq-c contributors"
|
||||||
|
topics = ("rabbitmq", "amqp", "client", "message-queue")
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
package_type = "library"
|
||||||
|
|
||||||
|
options = {
|
||||||
|
"shared": [True, False],
|
||||||
|
"fPIC": [True, False],
|
||||||
|
"ssl": [True, False],
|
||||||
|
"build_tools": [True, False],
|
||||||
|
"build_examples": [True, False]
|
||||||
|
}
|
||||||
|
default_options = {
|
||||||
|
"shared": False,
|
||||||
|
"fPIC": True,
|
||||||
|
"ssl": False,
|
||||||
|
"build_tools": False,
|
||||||
|
"build_examples": False
|
||||||
|
}
|
||||||
|
|
||||||
|
exports_sources = "CMakeLists.txt", "cmake/*", "librabbitmq/*", "fuzz/*", "tests/*", "tools/*", "examples/*", "docs/*"
|
||||||
|
|
||||||
|
def config_options(self):
|
||||||
|
if self.settings.os == "Windows":
|
||||||
|
del self.options.fPIC
|
||||||
|
|
||||||
|
def configure(self):
|
||||||
|
if self.options.shared:
|
||||||
|
self.options.rm_safe("fPIC")
|
||||||
|
# Pure C library
|
||||||
|
self.settings.rm_safe("compiler.libcxx")
|
||||||
|
self.settings.rm_safe("compiler.cppstd")
|
||||||
|
|
||||||
|
def layout(self):
|
||||||
|
cmake_layout(self)
|
||||||
|
|
||||||
|
def requirements(self):
|
||||||
|
if self.options.ssl:
|
||||||
|
self.requires("openssl/[>=1.1.1]")
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
tc = CMakeToolchain(self)
|
||||||
|
tc.variables["ENABLE_SSL_SUPPORT"] = self.options.ssl
|
||||||
|
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
|
||||||
|
tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared
|
||||||
|
tc.variables["BUILD_TOOLS"] = self.options.build_tools
|
||||||
|
tc.variables["BUILD_EXAMPLES"] = self.options.build_examples
|
||||||
|
tc.variables["BUILD_TESTING"] = False
|
||||||
|
tc.generate()
|
||||||
|
|
||||||
|
deps = CMakeDeps(self)
|
||||||
|
deps.generate()
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.configure()
|
||||||
|
cmake.build()
|
||||||
|
|
||||||
|
def package(self):
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.install()
|
||||||
|
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||||
|
|
||||||
|
def package_info(self):
|
||||||
|
self.cpp_info.set_property("cmake_file_name", "rabbitmq-c")
|
||||||
|
|
||||||
|
target = "rabbitmq" if self.options.shared else "rabbitmq-static"
|
||||||
|
self.cpp_info.set_property("cmake_target_name", f"rabbitmq::{target}")
|
||||||
|
|
||||||
|
self.cpp_info.libs = [target]
|
||||||
|
|
||||||
|
if self.settings.os == "Windows":
|
||||||
|
self.cpp_info.system_libs.extend(["ws2_32"])
|
||||||
|
elif self.settings.os in ["Linux", "FreeBSD"]:
|
||||||
|
self.cpp_info.system_libs.extend(["pthread", "rt"])
|
||||||
|
|
||||||
|
if self.options.ssl:
|
||||||
|
self.cpp_info.requires = ["openssl::ssl", "openssl::crypto"]
|
||||||
Reference in New Issue
Block a user