-
Notifications
You must be signed in to change notification settings - Fork 2k
add package qpid-proton 0.40.0 #26525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
8a36e05
97b9eac
d981db6
df11cef
32c2925
5e76b4e
6cc3b43
cf4d952
f2a844a
b2b008f
1a00aaf
82eae7a
7d735a8
0c27199
4191c6d
fb8bfd7
4175ee4
ea95ec3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"0.40.0": | ||
url: "https://github.com/apache/qpid-proton/archive/refs/tags/0.40.0.tar.gz" | ||
sha256: "f3dcd30e85626d8eff13a98009f0b75b2a4d0cbf91520830a67202157dc63d6d" |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,154 @@ | ||||
from conan import ConanFile | ||||
from conan.tools.build import check_min_cppstd | ||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||||
from conan.tools.files import copy, export_conandata_patches, get, rmdir | ||||
from conan.tools.microsoft import is_msvc | ||||
|
||||
import os | ||||
|
||||
required_conan_version = ">=2.1.0" | ||||
|
||||
class QpidProtonConan(ConanFile): | ||||
version = "0.40.0" | ||||
name = "qpid-proton" | ||||
description = "Qpid Proton is a high-performance, lightweight messaging library." | ||||
license = "Apache-2.0" | ||||
url = "https://github.com/conan-io/conan-center-index" | ||||
homepage = "https://qpid.apache.org/proton/" | ||||
topics = ("conan", "qpid", "proton", "messaging", "message", "queue", "topic", "mq", "amqp") | ||||
package_type = "library" | ||||
settings = "os", "arch", "compiler", "build_type" | ||||
options = { | ||||
"shared": [True, False], | ||||
"fPIC": [True, False], | ||||
"tools": [True, False], | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
"tls": [True, False], | ||||
"with_opentelemetry": [True, False], | ||||
} | ||||
default_options = { | ||||
"shared": False, | ||||
"fPIC": True, | ||||
"tools": False, | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
"tls": True, | ||||
"with_opentelemetry": True, | ||||
} | ||||
|
||||
@property | ||||
def _min_cppstd(self): | ||||
return "14" | ||||
|
||||
def export_sources(self): | ||||
export_conandata_patches(self) | ||||
|
||||
ErniGH marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
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") | ||||
|
||||
def layout(self): | ||||
cmake_layout(self, src_folder="src") | ||||
|
||||
def requirements(self): | ||||
self.requires("openssl/3.3.2") | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It also requires There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SWIG library is used only for ruby bindings which is not part of this package, its being built without SWIG just fine so I skipped it. Otherwise Conan is complaining that SWIG is not used by any components requires (which is correct, due to disabled ruby bindings).
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
self.requires("cyrus-sasl/2.1.28") | ||||
if self.options.with_opentelemetry: | ||||
self.requires("opentelemetry-cpp/1.14.2") | ||||
if self.settings.os == "Macos": | ||||
self.requires("libuv/1.49.2") | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
def validate(self): | ||||
if self.settings.compiler.get_safe("cppstd"): | ||||
check_min_cppstd(self, "14") | ||||
ErniGH marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
def build_requirements(self): | ||||
self.tool_requires("cmake/[>=3.16 <4]") | ||||
self.tool_requires("cpython/[>=3.9]") | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Please, avoid using cpython package, usually it result compatibility bugs in the future. Let users consume their system python instead. |
||||
if not self.conf.get("tools.gnu:pkg_config", check_type=str): | ||||
self.tool_requires("pkgconf/[>=1.7 <3]") | ||||
|
||||
def source(self): | ||||
get(self, **self.conan_data["sources"][self.version], filename=f"{self.version}.tar.gz", strip_root=True) | ||||
|
||||
def generate(self): | ||||
tc = CMakeToolchain(self) | ||||
|
||||
tc.variables["BUILD_PYTHON"] = False | ||||
tc.variables["BUILD_RUBY"] = False | ||||
tc.variables["BUILD_GO"] = False | ||||
|
||||
tc.variables["ENABLE_WARNING_ERROR"] = False | ||||
tc.variables["ENABLE_UNDEFINED_ERROR"] = False | ||||
tc.variables["ENABLE_LINKTIME_OPTIMIZATION"] = False | ||||
tc.variables["ENABLE_HIDE_UNEXPORTED_SYMBOLS"] = False | ||||
tc.variables["ENABLE_FUZZ_TESTING"] = False | ||||
tc.variables["ENABLE_BENCHMARKS"] = False | ||||
|
||||
tc.variables["BUILD_STATIC_LIBS"] = not bool(self.options["shared"]) | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
tc.variables["BUILD_TESTING"] = False | ||||
tc.variables["BUILD_TOOLS"] = bool(self.options["tools"]) | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
tc.variables["BUILD_EXAMPLES"] = False | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
if self.settings.os == "Macos": | ||||
tc.variables["BUILD_TLS"] = False | ||||
else: | ||||
tc.variables["BUILD_TLS"] = bool(self.options["tls"]) | ||||
ErniGH marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
tc.generate() | ||||
|
||||
deps = CMakeDeps(self) | ||||
deps.set_property("libuv", "cmake_file_name", "Libuv") | ||||
deps.set_property("libuv", "cmake_target_name", "Libuv::Libuv") | ||||
deps.generate() | ||||
|
||||
def build(self): | ||||
cmake = CMake(self) | ||||
cmake.configure() | ||||
cmake.build() | ||||
|
||||
def package(self): | ||||
copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||||
copy(self, pattern="NOTICE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||||
cmake = CMake(self) | ||||
cmake.install() | ||||
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||||
rmdir(self, os.path.join(self.package_folder, "share")) | ||||
|
||||
@property | ||||
def _module_subfolder(self): | ||||
return os.path.join("lib", "cmake") | ||||
|
||||
def package_info(self): | ||||
ErniGH marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
self.cpp_info.set_property("cmake_file_name", "QpidProton") | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
suffix = "-static" if is_msvc(self) and not self.options.shared else "" | ||||
|
||||
self.cpp_info.components["proton"].set_property("cmake_target_name", "Proton::proton") | ||||
self.cpp_info.components["proton"].libs = [f"qpid-proton{suffix}"] | ||||
self.cpp_info.components["proton"].requires = ["openssl::ssl", "cyrus-sasl::cyrus-sasl"] | ||||
|
||||
self.cpp_info.components["core"].set_property("cmake_target_name", "Proton::core") | ||||
self.cpp_info.components["core"].libs = [f"qpid-proton-core{suffix}"] | ||||
self.cpp_info.components["core"].requires = ["openssl::ssl", "cyrus-sasl::cyrus-sasl"] | ||||
|
||||
self.cpp_info.components["proactor"].set_property("cmake_target_name", "Proton::proactor") | ||||
self.cpp_info.components["proactor"].libs = [f"qpid-proton-proactor{suffix}"] | ||||
self.cpp_info.components["proactor"].requires = ["core"] | ||||
|
||||
self.cpp_info.components["cpp"].set_property("cmake_target_name", "Proton::cpp") | ||||
self.cpp_info.components["cpp"].libs = [f"qpid-proton-cpp{suffix}"] | ||||
self.cpp_info.components["cpp"].requires = ["core", "proactor"] | ||||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
if self.options["tls"] and self.settings.os != "Macos": | ||||
self.cpp_info.components["tls"].set_property("cmake_target_name", "Proton::tls") | ||||
self.cpp_info.components["tls"].libs = [f"qpid-proton-tls{suffix}"] | ||||
|
||||
if self.settings.os == "Macos": | ||||
self.cpp_info.components["core"].requires.append("libuv::libuv") | ||||
|
||||
if self.options["with_opentelemetry"]: | ||||
self.cpp_info.components["cpp"].requires.append("opentelemetry-cpp::opentelemetry-cpp") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(QpidProton REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE Proton::cpp) | ||
|
||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
*/ | ||
|
||
#include <proton/connection.hpp> | ||
#include <proton/container.hpp> | ||
#include <proton/delivery.hpp> | ||
#include <proton/message.hpp> | ||
#include <proton/messaging_handler.hpp> | ||
#include <proton/tracker.hpp> | ||
|
||
#include <iostream> | ||
|
||
|
||
class hello_world : public proton::messaging_handler { | ||
std::string conn_url_; | ||
std::string addr_; | ||
|
||
public: | ||
hello_world(const std::string& u, const std::string& a) : | ||
conn_url_(u), addr_(a) {} | ||
|
||
void on_container_start(proton::container& c) override { | ||
c.connect(conn_url_); | ||
} | ||
|
||
void on_connection_open(proton::connection& c) override { | ||
c.open_receiver(addr_); | ||
c.open_sender(addr_); | ||
} | ||
|
||
void on_sendable(proton::sender &s) override { | ||
proton::message m("Hello World!"); | ||
s.send(m); | ||
s.close(); | ||
} | ||
|
||
void on_message(proton::delivery &d, proton::message &m) override { | ||
std::cout << m.body() << std::endl; | ||
d.connection().close(); | ||
} | ||
}; | ||
|
||
int main(int argc, char **argv) { | ||
try { | ||
std::string conn_url = argc > 1 ? argv[1] : "//127.0.0.1:5672"; | ||
std::string addr = argc > 2 ? argv[2] : "examples"; | ||
|
||
hello_world hw(conn_url, addr); | ||
proton::container(hw).run(); | ||
|
||
} catch (const std::exception& e) { | ||
std::cerr << e.what() << std::endl; | ||
} | ||
Divix55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"0.40.0": | ||
folder: "all" |
Uh oh!
There was an error while loading. Please reload this page.