2017-06-01 14:25:40 -07:00
|
|
|
include(vcpkg_common_functions)
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
2017-09-03 14:16:09 -07:00
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO eclipse/paho.mqtt.c
|
2018-07-04 05:23:42 +01:00
|
|
|
REF v1.2.1
|
|
|
|
SHA512 98828852ecd127445591df31416adaebebd30848c027361ae62af6b14b84e3cf2a4b90cab692b983148cbf93f710a9e2dd722a3da8c4fd17eb2149e4227a8860
|
2017-09-03 14:16:09 -07:00
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PAHO_BUILD_STATIC)
|
|
|
|
|
|
|
|
|
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES
|
2018-07-04 05:23:42 +01:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/remove_compiler_options.patch"
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
vcpkg_configure_cmake(
|
2017-09-03 14:16:09 -07:00
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2017-09-20 20:00:57 -07:00
|
|
|
PREFER_NINJA
|
2018-07-04 05:23:42 +01:00
|
|
|
OPTIONS -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_STATIC=${PAHO_BUILD_STATIC} -DPAHO_ENABLE_TESTING=FALSE
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
vcpkg_build_cmake()
|
|
|
|
|
|
|
|
file(GLOB DLLS
|
2017-09-20 20:00:57 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/src/*.dll"
|
2017-09-03 14:16:09 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.dll"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.dll"
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
file(GLOB LIBS
|
2017-09-20 20:00:57 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/src/*.lib"
|
2017-09-03 14:16:09 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.lib"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.lib"
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
file(GLOB DEBUG_DLLS
|
2017-09-20 20:00:57 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/src/*.dll"
|
2017-09-03 14:16:09 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.dll"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.dll"
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
file(GLOB DEBUG_LIBS
|
2017-09-20 20:00:57 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/src/*.lib"
|
2017-09-03 14:16:09 -07:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.lib"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.lib"
|
2017-06-01 14:25:40 -07:00
|
|
|
)
|
|
|
|
if(DLLS)
|
2017-09-03 14:16:09 -07:00
|
|
|
file(INSTALL ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
2017-06-01 14:25:40 -07:00
|
|
|
endif()
|
2018-03-19 16:26:36 -04:00
|
|
|
if(LIBS)
|
|
|
|
file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
endif()
|
2017-06-01 14:25:40 -07:00
|
|
|
if(DEBUG_DLLS)
|
2017-09-03 14:16:09 -07:00
|
|
|
file(INSTALL ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
2017-06-01 14:25:40 -07:00
|
|
|
endif()
|
2018-03-19 16:26:36 -04:00
|
|
|
if(DEBUG_LIBS)
|
|
|
|
file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
|
|
|
endif()
|
2018-03-23 06:53:43 -07:00
|
|
|
file(COPY ${SOURCE_PATH}/src/MQTTAsync.h ${SOURCE_PATH}/src/MQTTClient.h ${SOURCE_PATH}/src/MQTTClientPersistence.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
2017-06-01 14:25:40 -07:00
|
|
|
|
2017-09-03 14:16:09 -07:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
|
|
|
foreach(libname paho-mqtt3as-static paho-mqtt3cs-static paho-mqtt3a-static paho-mqtt3c-static)
|
|
|
|
foreach(foldername "lib" "debug/lib")
|
|
|
|
string(REPLACE "-static" "" outlibname ${libname})
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/${foldername}/${libname}.lib ${CURRENT_PACKAGES_DIR}/${foldername}/${outlibname}.lib)
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2017-06-01 14:25:40 -07:00
|
|
|
|
2017-09-20 20:00:57 -07:00
|
|
|
foreach(libname paho-mqtt3a paho-mqtt3c)
|
|
|
|
foreach(root "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}/debug")
|
|
|
|
file(REMOVE
|
|
|
|
${root}/lib/${libname}.lib
|
|
|
|
${root}/bin/${libname}.dll
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
2017-06-01 14:25:40 -07:00
|
|
|
|
2017-09-03 14:16:09 -07:00
|
|
|
file(INSTALL ${SOURCE_PATH}/about.html DESTINATION ${CURRENT_PACKAGES_DIR}/share/paho-mqtt RENAME copyright)
|