diff --git a/recipes/paho-mqtt-cpp/all/conandata.yml b/recipes/paho-mqtt-cpp/all/conandata.yml index d957900ce0bc5..9f0236641e7c1 100644 --- a/recipes/paho-mqtt-cpp/all/conandata.yml +++ b/recipes/paho-mqtt-cpp/all/conandata.yml @@ -1,18 +1,19 @@ 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" @@ -20,4 +21,3 @@ patches: base_path: "source_subfolder" - patch_file: "patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch" base_path: "source_subfolder" - diff --git a/recipes/paho-mqtt-cpp/all/conanfile.py b/recipes/paho-mqtt-cpp/all/conanfile.py index f684b55171443..c8668dd8a0232 100644 --- a/recipes/paho-mqtt-cpp/all/conanfile.py +++ b/recipes/paho-mqtt-cpp/all/conanfile.py @@ -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], @@ -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]) @@ -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() diff --git a/recipes/paho-mqtt-cpp/config.yml b/recipes/paho-mqtt-cpp/config.yml index 59f223359dda8..1970391ed5cca 100644 --- a/recipes/paho-mqtt-cpp/config.yml +++ b/recipes/paho-mqtt-cpp/config.yml @@ -3,3 +3,5 @@ versions: folder: "all" "1.1": folder: "all" + "1.2.0": + folder: "all"