Skip to content

Commit

Permalink
[paho-mqttpp3] Cleanup (microsoft#39971)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Jul 23, 2024
1 parent 9d0213c commit e832b2a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 39 deletions.
45 changes: 7 additions & 38 deletions ports/paho-mqttpp3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,26 @@ vcpkg_from_github(
HEAD_REF master
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PAHO_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PAHO_BUILD_SHARED)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"ssl" PAHO_WITH_SSL
)

# Link with 'paho-mqtt3as' library
set(PAHO_C_LIBNAME paho-mqtt3as)

# Setting the library path
if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(PAHO_C_LIBRARY_PATH "${CURRENT_INSTALLED_DIR}/lib")
else()
set(PAHO_C_LIBRARY_PATH "${CURRENT_INSTALLED_DIR}/debug/lib")
endif()

# Setting the include path where MqttClient.h is present
set(PAHO_C_INC "${CURRENT_INSTALLED_DIR}/include")


# NOTE: the Paho C++ cmake files on Github are problematic.
# It uses two different options PAHO_BUILD_STATIC and PAHO_BUILD_SHARED instead of just using one variable.
# Unless the open source community cleans up the cmake files, we are stuck with setting both of them.
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(PAHO_MQTTPP3_STATIC ON)
set(PAHO_MQTTPP3_SHARED OFF)
set(PAHO_C_LIB "${PAHO_C_LIBRARY_PATH}/${PAHO_C_LIBNAME}")
set(PAHO_OPTIONS -DPAHO_MQTT_C_LIBRARIES=${PAHO_C_LIB})
else()
set(PAHO_MQTTPP3_STATIC OFF)
set(PAHO_MQTTPP3_SHARED ON)
set(PAHO_OPTIONS)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPAHO_BUILD_STATIC=${PAHO_MQTTPP3_STATIC}
-DPAHO_BUILD_SHARED=${PAHO_MQTTPP3_SHARED}
-DPAHO_MQTT_C_INCLUDE_DIRS=${PAHO_C_INC}
-DPAHO_BUILD_STATIC=${PAHO_BUILD_STATIC}
-DPAHO_BUILD_SHARED=${PAHO_BUILD_SHARED}
${FEATURE_OPTIONS}
${PAHO_OPTIONS}
)

# Run the build, copy pdbs and fixup the cmake targets
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME PahoMqttCpp CONFIG_PATH "lib/cmake/PahoMqttCpp")
vcpkg_cmake_config_fixup(PACKAGE_NAME pahomqttcpp CONFIG_PATH "lib/cmake/PahoMqttCpp")

# Remove the include and share folders in debug folder
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

# Add copyright
file(INSTALL "${SOURCE_PATH}/about.html" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/about.html")
1 change: 1 addition & 0 deletions ports/paho-mqttpp3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "paho-mqttpp3",
"version": "1.4.1",
"port-version": 1,
"description": "Paho project provides open-source C++ wrapper for Paho C library",
"homepage": "https://github.com/eclipse/paho.mqtt.cpp",
"license": "EPL-1.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6718,7 +6718,7 @@
},
"paho-mqttpp3": {
"baseline": "1.4.1",
"port-version": 0
"port-version": 1
},
"palsigslot": {
"baseline": "1.2.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/paho-mqttpp3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c617983064fd61825e4fee55377bfc30d2442649",
"version": "1.4.1",
"port-version": 1
},
{
"git-tree": "f8623e2eb93ba34257f2dde7e2add778b4937029",
"version": "1.4.1",
Expand Down

0 comments on commit e832b2a

Please sign in to comment.