Skip to content

Commit

Permalink
Remove all of the QT plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed May 31, 2024
1 parent 95f7a83 commit ab186cb
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 153 deletions.
16 changes: 0 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ SET ( DEFAULT_SOUNDCAPMACOS OFF )
SET ( DEFAULT_CEC OFF )
SET ( DEFAULT_BONJOUR ON )
SET ( DEFAULT_MQTT ON )
SET ( DEFAULT_STATIC_QT_PLUGINS OFF )
SET ( DEFAULT_PRECOMPILED_HEADERS ON )
SET ( DEFAULT_XZ ON )
SET ( DEFAULT_POWER_MANAGEMENT ON )
Expand Down Expand Up @@ -432,9 +431,6 @@ colorMe("ENABLE_XZ = " ${ENABLE_XZ})

message( STATUS "\n${CyanColor}BUILD FEATURES${ColorReset}")

option(USE_STATIC_QT_PLUGINS "Enable static QT plugins" ${DEFAULT_STATIC_QT_PLUGINS})
colorMe("USE_STATIC_QT_PLUGINS = " ${USE_STATIC_QT_PLUGINS})

option(USE_PRECOMPILED_HEADERS "Enable precompiled headers (PCH)" ${DEFAULT_PRECOMPILED_HEADERS})
colorMe("USE_PRECOMPILED_HEADERS = " ${USE_PRECOMPILED_HEADERS})

Expand Down Expand Up @@ -580,18 +576,6 @@ find_package(TurboJPEG REQUIRED)
message( STATUS "TURBOJPEG_LIBRARY_DIRS=${TurboJPEG_LIBRARY}")
message( STATUS "TURBOJPEG_INCLUDE_DIRS=${TurboJPEG_INCLUDE_DIRS}")

# Embedded QT plugins
if (USE_STATIC_QT_PLUGINS)
foreach(sqlPlugin ${Qt${Qt_VERSION}Sql_PLUGINS} Qt${Qt_VERSION}::Sql)
message( STATUS "PLUGIN=${sqlPlugin}")
get_target_property(file ${sqlPlugin} LOCATION)
if (NOT IS_SYMLINK ${file})
message("Using static QT plugin: " ${file})
set(STATIC_QT_PLUGINS_LIBS ${STATIC_QT_PLUGINS_LIBS} ${file})
endif()
endforeach()
endif()

if (WIN32)
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
Expand Down
3 changes: 0 additions & 3 deletions HyperhdrConfig.h.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Generated config file

// support for static QT plugins
#cmakedefine USE_STATIC_QT_PLUGINS

// cec support
#cmakedefine ENABLE_CEC

Expand Down
120 changes: 9 additions & 111 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ macro(DeployApple TARGET)
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/3RD_PARTY_LICENSES" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")

if ( Qt5Core_FOUND )
get_target_property(MYQT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
else()
SET (MYQT_QMAKE_EXECUTABLE "${_qt_import_prefix}/../../../bin/qmake")
endif()

execute_process(
COMMAND ${MYQT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE MYQT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
install(CODE "set(MYQT_PLUGINS_DIR \"${MYQT_PLUGINS_DIR}\")" COMPONENT "HyperHDR")
install(CODE "set(MY_DEPENDENCY_PATHS \"${TARGET_FILE}\")" COMPONENT "HyperHDR")
install(CODE "set(MY_SYSTEM_LIBS_SKIP \"${SYSTEM_LIBS_SKIP}\")" COMPONENT "HyperHDR")
install(CODE "set(SCOPE_Qt_VERSION ${Qt_VERSION})" COMPONENT "HyperHDR")
Expand Down Expand Up @@ -128,40 +116,11 @@ macro(DeployApple TARGET)
list(LENGTH _u_deps _u_length)
if("${_u_length}" GREATER 0)
message(WARNING "Unresolved dependencies detected!")
endif()

foreach(PLUGIN "sqldrivers")
if(EXISTS ${MYQT_PLUGINS_DIR}/${PLUGIN})
file(GLOB files "${MYQT_PLUGINS_DIR}/${PLUGIN}/*")
foreach(file ${files})
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES ${file}
RESOLVED_DEPENDENCIES_VAR PLUGINS
UNRESOLVED_DEPENDENCIES_VAR _u_deps
)

foreach(DEPENDENCY ${PLUGINS})
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib"
TYPE SHARED_LIBRARY
FILES ${DEPENDENCY}
)
endforeach()

get_filename_component(singleQtLib ${file} NAME)
list(APPEND MYQT_PLUGINS "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/plugins/${PLUGIN}/${singleQtLib}")
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/plugins/${PLUGIN}"
TYPE SHARED_LIBRARY
FILES ${file}
)

endforeach()
endif()
endif()
endforeach()

include(BundleUtilities)
fixup_bundle("${CMAKE_INSTALL_PREFIX}/hyperhdr.app" "${MYQT_PLUGINS}" "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib")
fixup_bundle("${CMAKE_INSTALL_PREFIX}/hyperhdr.app" "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib")

file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib")
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/share")
Expand All @@ -172,8 +131,6 @@ macro(DeployApple TARGET)
cmake_policy(SET CMP0009 NEW)
message( "Re-signing bundle's components...")
file(GLOB_RECURSE libSignFramework LIST_DIRECTORIES false "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/*")
file(GLOB_RECURSE libSignPlugins LIST_DIRECTORIES false "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/plugins/*")
list(APPEND libSignFramework ${libSignPlugins})
list(APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/MacOS/hyperhdr")
foreach(_fileToSign ${libSignFramework})
string(FIND ${_fileToSign} ".framework/Resources" isResources)
Expand Down Expand Up @@ -244,25 +201,6 @@ macro(DeployUnix TARGET)
message( WARNING "OpenSSL NOT found (https instance will not work)")
endif()

# Detect the Qt5 plugin directory, source: https://github.com/lxde/lxqt-qtplugin/blob/master/src/CMakeLists.txt
if ( Qt5Core_FOUND )
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
elseif ( TARGET Qt${QT_VERSION_MAJOR}::qmake )
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

message(STATUS "QT plugin path: ${QT_PLUGINS_DIR}")

# Copy CEC lib
if (CEC_FOUND)
find_library(XRANDR_LIBRARY NAMES Xrandr libXrandr libXrandr.so.2)
Expand Down Expand Up @@ -301,18 +239,9 @@ macro(DeployUnix TARGET)
endforeach()
endif()

# Create a qt.conf file in 'share/hyperhdr/bin' to override hard-coded search paths in Qt plugins
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/\n")
install(
FILES "${CMAKE_BINARY_DIR}/qt.conf"
DESTINATION "share/hyperhdr/bin"
COMPONENT "HyperHDR"
)

# install CODE
install(CODE "set(TARGET_FILE \"${TARGET_FILE}\")" COMPONENT "HyperHDR")
install(CODE "set(PREREQUISITE_LIBS \"${PREREQUISITE_LIBS}\")" COMPONENT "HyperHDR")
install(CODE "set(QT_PLUGINS_DIR \"${QT_PLUGINS_DIR}\")" COMPONENT "HyperHDR")

install(CODE [[

Expand Down Expand Up @@ -382,40 +311,16 @@ macro(DeployUnix TARGET)
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR SYS_DEPENDENCIES
EXECUTABLES $<TARGET_FILE:systray-widget>)
foreach(systraLib ${SYS_DEPENDENCIES})
string(FIND ${systraLib} "libayatana" _sysindex)
foreach(systrayLib ${SYS_DEPENDENCIES})
string(FIND ${systrayLib} "libayatana" _sysindex)
if (${_sysindex} GREATER -1)
list(APPEND DEPENDENCIES ${systraLib})
list(APPEND DEPENDENCIES ${systrayLib})
endif()
string(FIND ${systraLib} "libdbusmenu" _sysDBusindex)
string(FIND ${systrayLib} "libdbusmenu" _sysDBusindex)
if (${_sysDBusindex} GREATER -1)
list(APPEND DEPENDENCIES ${systraLib})
list(APPEND DEPENDENCIES ${systrayLib})
endif()
endforeach()


# Copy Qt plugins to 'share/hyperhdr/lib'
foreach(PLUGIN "sqldrivers")
#message(WARNING "Collecting Dependencies for QT plugin folder: ${PLUGIN}")
if(EXISTS ${QT_PLUGINS_DIR}/${PLUGIN})
file(GLOB files "${QT_PLUGINS_DIR}/${PLUGIN}/*")
foreach(file ${files})
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR QT_DEPENDENCIES
EXECUTABLES ${file}
)
#message(WARNING "${file} => ${DEPENDENCIES} <= ${QT_DEPENDENCIES}")
list(APPEND DEPENDENCIES ${QT_DEPENDENCIES})

file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib/${PLUGIN}"
TYPE SHARED_LIBRARY
FILES ${file}
)

endforeach()
endif()
endforeach()
endforeach()
endif()


Expand Down Expand Up @@ -483,6 +388,7 @@ macro(DeployWindows TARGET)
--dry-run
${WINDEPLOYQT_PARAMS}
--list mapping
--no-plugins
"${TARGET_FILE}"
OUTPUT_VARIABLE DEPS
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down Expand Up @@ -521,14 +427,6 @@ macro(DeployWindows TARGET)
# Copy MQTT
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:qmqtt> DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")

# 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(
FILES "${CMAKE_BINARY_DIR}/qt.conf"
DESTINATION "bin"
COMPONENT "HyperHDR"
)

execute_process(
COMMAND ${SEVENZIP_BIN} e ${PROJECT_SOURCE_DIR}/resources/lut/lut_lin_tables.tar.xz -o${CMAKE_CURRENT_BINARY_DIR} -aoa -y
RESULT_VARIABLE STATUS
Expand Down
4 changes: 0 additions & 4 deletions sources/db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ target_link_libraries(database
Qt${Qt_VERSION}::Sql
)

if (USE_STATIC_QT_PLUGINS)
target_link_libraries(database ${STATIC_QT_PLUGINS_LIBS})
endif()

if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(database REUSE_FROM precompiled_hyperhdr_headers)
endif()
Expand Down
5 changes: 0 additions & 5 deletions sources/db/DBManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@

#include <HyperhdrConfig.h> // Required to determine the cmake options

#ifdef USE_STATIC_QT_PLUGINS
#include <QtPlugin>
Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
#endif

QFileInfo DBManager::_databaseName;
QThreadStorage<QSqlDatabase> DBManager::_databasePool;

Expand Down
4 changes: 0 additions & 4 deletions sources/hyperhdr-remote/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ if(NOT WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE -s)
endif()

if (USE_STATIC_QT_PLUGINS)
target_link_libraries(${PROJECT_NAME} ${STATIC_QT_PLUGINS_LIBS})
endif()

target_link_libraries(${PROJECT_NAME}
effectengine
commandline
Expand Down
4 changes: 0 additions & 4 deletions sources/hyperhdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ else()
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()

if (USE_STATIC_QT_PLUGINS)
target_link_libraries(hyperhdr ${STATIC_QT_PLUGINS_LIBS})
endif()

if(ENABLE_XZ)
if (LIBLZMA_FOUND)
target_link_libraries(hyperhdr LibLZMA::LibLZMA)
Expand Down
6 changes: 0 additions & 6 deletions sources/hyperhdr/HyperHdrDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#include <base/GrabberHelper.h>
#include <base/NetworkForwarder.h>

#ifdef USE_STATIC_QT_PLUGINS
#include <QtPlugin>
Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
#endif

#include <jsonserver/JsonServer.h>
#include <webserver/WebServer.h>

Expand Down

0 comments on commit ab186cb

Please sign in to comment.