Skip to content

Commit

Permalink
Switch MQTT to shared library on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jun 3, 2022
1 parent 87f5b8a commit 22ba66c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ option(ENABLE_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_WS281XPWM} )
message(STATUS "ENABLE_WS281XPWM = ${ENABLE_WS281XPWM}")

option(ENABLE_BONJOUR "Enable the network discovery service" ${DEFAULT_BONJOUR} )
message(STATUS "ENABLE_BONJOUR = ${ENABLE_BONJOUR}")

option(ENABLE_MF "Enable Windows Media Foundation grabber" ${DEFAULT_MF})
message(STATUS "ENABLE_MF = ${ENABLE_MF}")
Expand Down
24 changes: 24 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,30 @@ macro(DeployWindows TARGET)
)
endif()

# Copy MQTT Libs
if (ENABLE_MQTT)
set (MQTT_TARGET_LIB_FOLDER ${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
message(${MQTT_TARGET_LIB_FOLDER})
find_file(MQTT_DLL
NAMES "qmqtt.dll"
PATHS "${MQTT_TARGET_LIB_FOLDER}"
NO_DEFAULT_PATH
REQUIRED
)
message(${MQTT_DLL})
if(NOT CMAKE_GITHUB_ACTION)
get_filename_component(MQTT_RUNTIME_TARGET ${TARGET_FILE} DIRECTORY)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MQTT_DLL} ${MQTT_RUNTIME_TARGET})
endif()

install(
FILES ${MQTT_DLL}
DESTINATION "bin"
COMPONENT "HyperHDR"
)
endif()


# Create a qt.conf file in 'bin' to override hard-coded search paths in Qt plugins
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/\n")
install(
Expand Down
7 changes: 5 additions & 2 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ if ( ENABLE_MQTT )
string(REPLACE "Qt5" "Qt${Qt_VERSION}" FILE_CONTENTS "${FILE_CONTENTS}")
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/external/qmqtt/CMakeLists.txt" "${FILE_CONTENTS}")

set(qmqtt_SHARED OFF)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
if (NOT WIN32)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(qmqtt_SHARED OFF)
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/qmqtt)
ENDIF()

0 comments on commit 22ba66c

Please sign in to comment.