aboutsummaryrefslogtreecommitdiff
path: root/ports/paraview/qt_plugin.patch
blob: 2f4763c4908e00bcc89ea8c657482fb5ec0bbcda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/Qt/Widgets/CMakeLists.txt b/Qt/Widgets/CMakeLists.txt
index 93000c493..5f2a06752 100644
--- a/Qt/Widgets/CMakeLists.txt
+++ b/Qt/Widgets/CMakeLists.txt
@@ -139,17 +139,43 @@ set(CMAKE_AUTORCC 1)
 set(CMAKE_AUTOUIC 1)
 set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Resources/UI")
 
+##
+if(NOT PARAVIEW_BUILD_SHARED_LIBS) # Should be a check if Qt is built statically and not ParaView
+    list(APPEND qt_components Svg Sql) # added due to svg rescources, sql due to VTK::GUISupportQtSQL 
+    set(qt_plugin_list)
+    foreach(qt_component ${qt_components})
+        list(APPEND qt_plugin_list ${Qt5${qt_component}_PLUGINS})
+        message(STATUS "QtPlugin List: ${qt_plugin_list}")
+    endforeach()
+    set(qt_plugin_source "${CMAKE_CURRENT_BINARY_DIR}/qt_static_plugins.cxx")
+    if(EXISTS "${qt_plugin_source}")
+        file(REMOVE "${qt_plugin_source}")
+    endif()
+    set(qt_source_text "#include <QtPlugin>\n")
+    set(qt_source_text "#ifdef QT_STATIC\n")
+    foreach(qt_plugin ${qt_plugin_list})
+        STRING(REGEX REPLACE "[^:]+::" "" qt_plugin_name "${qt_plugin}")
+        message(STATUS "RAW PLUGIN NAME: ${qt_plugin_name}")
+        string(APPEND qt_source_text "  Q_IMPORT_PLUGIN(${qt_plugin_name})\n")
+    endforeach()
+    string(APPEND qt_source_text "#endif\n")
+    file(WRITE "${qt_plugin_source}" "${qt_source_text}")
+endif()
+##
+
 vtk_module_add_module(ParaView::pqWidgets
   CLASSES ${classes}
   SOURCES ${ui_files}
-          ${resource_files})
+          ${resource_files}
+          ${qt_plugin_source})
 vtk_module_link(ParaView::pqWidgets
   PUBLIC
     Qt5::Core
     Qt5::Gui
     Qt5::Widgets
   PRIVATE
-    Qt5::Network)
+    Qt5::Network
+    ${qt_plugin_list})
 
 if (APPLE)
   vtk_module_link(ParaView::pqWidgets