Skip to content

Commit

Permalink
(#2739) paho-mqtt-cpp: update paho-mqtt-c dep to 1.3.5 + add components
Browse files Browse the repository at this point in the history
* paho-mqtt-cpp: update paho-mqtt-c dep to 1.3.4

* Fix paho-mqtt-c hooks

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* paho-mqtt-cpp: update to 1.3.5

* paho-mqtt-cpp: enable SSL by default

Upstream enables SSL by default on all platform except Windows.

However, paho-mqtt-c enables SSL by default. In order, that we can use the default binaries build for it and pass CI, we enable SSL by default for paho-mqtt-cpp on all platforms.

* paho-mqtt-cpp: add cmake_find_package generator

* Add components for paho-mqtt-cpp

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add components for paho-mqtt-cpp

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Remove cmake folder

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* paho-mqtt-cpp: fix components

Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
Croydon and uilianries committed Oct 12, 2020
1 parent 0353bba commit a79d9f7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
3 changes: 1 addition & 2 deletions recipes/paho-mqtt-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ patches:
base_path: "source_subfolder"
- patch_file: "patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch"
base_path: "source_subfolder"



18 changes: 11 additions & 7 deletions recipes/paho-mqtt-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class PahoMqttCppConan(ConanFile):
license = "EPL-1.0"
description = """The open-source client implementations of MQTT and MQTT-SN"""
exports_sources = ["CMakeLists.txt", "patches/*"]
generators = "cmake"
generators = "cmake", "cmake_find_package"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False],
"fPIC": [True, False],
"ssl": [True, False],
}
default_options = {"shared": False,
"fPIC": True,
"ssl": False
"ssl": True
}

_cmake = None
Expand All @@ -46,10 +46,7 @@ def configure(self):


def requirements(self):
if tools.Version(self.version) >= "1.1":
self.requires("paho-mqtt-c/1.3.1")
else:
self.requires("paho-mqtt-c/1.3.0")
self.requires("paho-mqtt-c/1.3.5")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand Down Expand Up @@ -83,6 +80,13 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.names["cmake_find_package"] = "PahoMqttCpp"
self.cpp_info.names["cmake_find_package_multi"] = "PahoMqttCpp"
target = "paho-mqttpp3" if self.options.shared else "paho-mqttpp3-static"
self.cpp_info.components["paho-mqttpp"].names["cmake_find_package"] = target
self.cpp_info.components["paho-mqttpp"].names["cmake_find_package_multi"] = target
self.cpp_info.components["paho-mqttpp"].requires = ["paho-mqtt-c::paho-mqtt-c"]
if self.settings.os == "Windows":
self.cpp_info.components["paho-mqttpp"].libs = [target]
else:
self.cpp_info.components["paho-mqttpp"].libs = ["paho-mqttpp3"]
12 changes: 8 additions & 4 deletions recipes/paho-mqtt-cpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project(test_package)

set(CMAKE_VERBOSE_MAKEFILE TRUE)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(PahoMqttCpp REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
if(PAHO_MQTT_CPP_SHARED)
target_link_libraries(${PROJECT_NAME} PahoMqttCpp::paho-mqttpp3)
else()
target_link_libraries(${PROJECT_NAME} PahoMqttCpp::paho-mqttpp3-static)
endif()
5 changes: 3 additions & 2 deletions recipes/paho-mqtt-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.definitions["PAHO_MQTT_CPP_SHARED"] = self.options["paho-mqtt-cpp"].shared
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
self.run(bin_path, run_environment=True)
3 changes: 2 additions & 1 deletion recipes/paho-mqtt-cpp/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ int main(int argc, char* argv[])
mqtt::client cli(SERVER_ADDRESS, CLIENT_ID);

return 0;
}
}

1 change: 0 additions & 1 deletion recipes/paho-mqtt-cpp/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
versions:
"1.0.1":
folder: "all"
Expand Down

0 comments on commit a79d9f7

Please sign in to comment.