Skip to content
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

Update to paho-mqtt-c 1.3.8 and paho-mqtt-cpp 1.2.0 #4096

Merged
merged 8 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions recipes/paho-mqtt-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
sources:
"1.2.0":
sha256: 435e97e4d5b1da13daa26cadd3e83fe9d154930abaa78b8ff1b8c854b5345d8b
url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.2.0.tar.gz
"1.1":
sha256: cb0343349ed91ef51d0e76ae860d19435a730d3d355e57886bb090014cb70bbe
url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.1.tar.gz
url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.1.tar.gz
"1.0.1":
sha256: e97386d159b811e534b98d21e3f6881ab2b43678ec026da7525d5c21ebc292ff
url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.0.1.tar.gz

patches:
"1.1":
- patch_file: "patches/1.1/0001-deadlock_and_remlog-for-1-1.patch"
base_path: "source_subfolder"
- patch_file: "patches/1.1/0002-ios_fix.patch"
base_path: "source_subfolder"

base_path: "source_subfolder"
"1.0.1":
- patch_file: "patches/1.0.1/0001-fix-cmake-module-path.patch"
base_path: "source_subfolder"
- patch_file: "patches/1.0.1/0002-fix-cmake-find-paho-mqtt-c-static.patch"
base_path: "source_subfolder"
- patch_file: "patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch"
base_path: "source_subfolder"

28 changes: 21 additions & 7 deletions recipes/paho-mqtt-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class PahoMqttCppConan(ConanFile):
name = "paho-mqtt-cpp"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/eclipse/paho.mqtt.cpp"
topics = ("MQTT", "IoT", "eclipse", "SSL", "paho", "Cpp")
topics = ("mqtt", "iot", "eclipse", "ssl", "paho", "cpp")
license = "EPL-1.0"
description = """The open-source client implementations of MQTT and MQTT-SN"""
exports_sources = ["CMakeLists.txt", "patches/*"]
description = "The open-source client implementations of MQTT and MQTT-SN"
exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake", "cmake_find_package"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False],
Expand Down Expand Up @@ -38,15 +38,22 @@ def configure(self):
tools.check_min_cppstd(self, minimal_cpp_standard)

if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration(
"Paho cpp can not be built as shared on Windows.")
raise ConanInvalidConfiguration("{} can not be built as shared on Windows.".format(self.name))

self.options["paho-mqtt-c"].shared = self.options.shared
self.options["paho-mqtt-c"].ssl = self.options.ssl

def validate(self):
if self.options["paho-mqtt-c"].shared != self.options.shared:
raise ConanInvalidConfiguration("{} requires paho-mqtt-c to have a matching 'shared' option.".format(self.name))
if self.options["paho-mqtt-c"].ssl != self.options.ssl:
raise ConanInvalidConfiguration("{} requires paho-mqtt-c to have a matching 'ssl' option.".format(self.name))

def requirements(self):
self.requires("paho-mqtt-c/1.3.5")
if tools.Version(self.version) >= "1.2.0":
self.requires("paho-mqtt-c/1.3.8")
else:
self.requires("paho-mqtt-c/1.3.1") # https://github.com/eclipse/paho.mqtt.cpp/releases/tag/v1.1

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand All @@ -66,7 +73,14 @@ def _configure_cmake(self):
return self._cmake

def build(self):
for patch in self.conan_data["patches"][self.version]:
# See this conversation https://github.com/conan-io/conan-center-index/pull/4096#discussion_r556119143
# Changed by https://github.com/eclipse/paho.mqtt.c/commit/f875768984574fede6065c8ede0a7eac890a6e09
# and https://github.com/eclipse/paho.mqtt.c/commit/c116b725fff631180414a6e99701977715a4a690
# FIXME: after https://github.com/conan-io/conan/pull/8053#pullrequestreview-541120387
if tools.Version(self.version) < "1.2.0" and tools.Version(self.deps_cpp_info["paho-mqtt-c"].version) >= "1.3.2":
raise ConanInvalidConfiguration("{}/{} requires paho-mqtt-c =< 1.3.1".format(self.name, self.version))

for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()
Expand Down
2 changes: 2 additions & 0 deletions recipes/paho-mqtt-cpp/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ versions:
folder: "all"
"1.1":
folder: "all"
"1.2.0":
folder: "all"