Skip to content

Commit

Permalink
(#4096) Update to paho-mqtt-c 1.3.8 and paho-mqtt-cpp 1.2.0
Browse files Browse the repository at this point in the history
* Update to paho-mqtt-c 1.3.8 and paho-mqtt-cpp 1.2.0

* Fix config.yml add version 1.2.0

* Fix FindPahMqttC.cmake for static on WIN32

* Fix patch.

* Add final newline to patch.

* some newlines.

* bind upstream version requirements on deps

Co-authored-by: Chris McArthur <[email protected]>
  • Loading branch information
bowb and prince-chrismc authored Jan 21, 2021
1 parent 93b463c commit 1f521e3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
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"

0 comments on commit 1f521e3

Please sign in to comment.