mqtt_cpp icon indicating copy to clipboard operation
mqtt_cpp copied to clipboard

Can this package be added to vcpkg?

Open jmin911 opened this issue 7 years ago • 4 comments

vcpkg is now the preferred way to install open source packages in Microsoft Visual C++. Boost and Beast libraries are in there. Can this package also be added to vcpkg? (GitHub.com/Microsoft/vcpkg)

jmin911 avatar Mar 31 '17 15:03 jmin911

@jmin911 , thank you for the comments. I'm new to vcpkg. I think that it is good that mqtt_client_cpp supports vcpkg.

I just glanced GitHub.com/Microsoft/vcpkg. But I don't understand how to do, so far. Could you tell me the way?

redboltz avatar Apr 01 '17 11:04 redboltz

Now I've learned how to add mqtt_cpp to vcpkg. Currently, mqtt_cpp contains boost/beast as the submodule. boost.beast will be merged the next release of the boost libraries. I think that after the next boost release I will add mqtt_cpp to vcpkg. It can minimize the dependency confusion.

redboltz avatar Sep 27 '17 16:09 redboltz

I'm successfully using mqtt-cpp with my local vcpkg right now (no tls, tested only client so far). Below is the port file I created for it, maybe somebody finds it useful. I've skipped the files outside of "include/mqtt/" as I prefer to have everything under directory for library. One thing I'm worried about is include directory - it's named "mqtt" which is a name that could potentially clash with some other mqtt library. Could it be changed to e.g. mqtt_cpp?

 ports/mqtt-cpp/CONTROL        |  4 ++++
 ports/mqtt-cpp/portfile.cmake | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/ports/mqtt-cpp/CONTROL b/ports/mqtt-cpp/CONTROL
new file mode 100644
index 0000000..8223b1d
--- /dev/null
+++ b/ports/mqtt-cpp/CONTROL
@@ -0,0 +1,4 @@
+Source: mqtt-cpp
+Version: 1.0.7
+Description: MQTT client for based on Boost.Asio
+Build-Depends: boost
diff --git a/ports/mqtt-cpp/portfile.cmake b/ports/mqtt-cpp/portfile.cmake
new file mode 100644
index 0000000..ce0431f
--- /dev/null
+++ b/ports/mqtt-cpp/portfile.cmake
@@ -0,0 +1,17 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mqtt_cpp-1.0.7)
+message("SOURCE_PATH ${SOURCE_PATH}")
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/redboltz/mqtt_cpp/archive/v1.0.7.tar.gz"
+    FILENAME "mqtt_cpp-v_1.0.7.tar.gz"
+    SHA512 710bab22d53d344e9d7ceb099bc522a9ce65bdd684bde26af3c8e4af199e5d02356eb2602f121ef17147f0fade1eca319906cb85511c4c5bdab5cc241d4dbdff
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/mqtt-cpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/mqtt-cpp/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/mqtt-cpp/copyright)
+
+# Copy the cereal header files
+file(COPY ${SOURCE_PATH}/include/mqtt DESTINATION ${CURRENT_PACKAGES_DIR}/include)

stoperro avatar Oct 15 '17 14:10 stoperro

@jmin911 @stoperro

I've substantially changed the cmake configuration files in this project.

Did that make the situation better, or worse, for you?

jonesmz avatar Oct 17 '19 00:10 jonesmz