feat: add CMake build configuration and unit tests for XRabbitMQClient
This commit is contained in:
17
conanfile.py
17
conanfile.py
@@ -9,11 +9,12 @@ class XRabbitMQClientConan(ConanFile):
|
||||
author = "XDL"
|
||||
topics = ("rabbitmq", "amqp", "message-queue")
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
package_type = "library"
|
||||
|
||||
options = {"shared": [True, False], "fPIC": [True, False]}
|
||||
default_options = {"shared": False, "fPIC": True}
|
||||
options = {"shared": [True, False], "fPIC": [True, False], "with_test": [True, False]}
|
||||
default_options = {"shared": False, "fPIC": True, "with_test": True}
|
||||
|
||||
exports_sources = "CMakeLists.txt", "src/*", "include/*"
|
||||
exports_sources = "CMakeLists.txt", "src/*", "include/*", "test/*"
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
@@ -28,10 +29,14 @@ class XRabbitMQClientConan(ConanFile):
|
||||
|
||||
def requirements(self):
|
||||
self.requires("simpleamqpclient/2.5.1", transitive_headers=True, transitive_libs=True)
|
||||
self.requires("boost/1.78.0")
|
||||
|
||||
def build_requirements(self):
|
||||
if self.options.with_test:
|
||||
self.test_requires("xgoogletest/1.17.1")
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["BUILD_TESTING"] = self.options.with_test
|
||||
tc.generate()
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
@@ -40,6 +45,8 @@ class XRabbitMQClientConan(ConanFile):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
if self.options.with_test:
|
||||
cmake.test()
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
@@ -47,4 +54,4 @@ class XRabbitMQClientConan(ConanFile):
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["xrabbitmqclient"]
|
||||
self.cpp_info.requires = ["simpleamqpclient::simpleamqpclient", "boost::boost"]
|
||||
self.cpp_info.requires = ["simpleamqpclient::simpleamqpclient"]
|
||||
|
||||
Reference in New Issue
Block a user