Commit 2a44c39a authored by Jan's avatar Jan

Make static plugins work again

parent 82a04570
......@@ -323,9 +323,9 @@ void Core::loadPlugins()
QSet<QString> staticPlugins = QSet<QString>::fromList(list);
#endif
for (int i = 0; i < pluginlist.size(); ) {
const QString bn = QFileInfo(pluginlist[i]).fileName();
const QString bn = QFileInfo(pluginlist[i]).baseName().remove("lib");
if (staticPlugins.contains(bn)) {
emit log(LOGOUT, tr("Not loading dynamic %1 as it is statically "
emit log(LOGWARN, tr("Not loading dynamic %1 as it is statically "
"linked against OpenFlipper.").arg(bn));
pluginlist.removeAt(i);
} else {
......
......@@ -23,7 +23,7 @@ if( APPLE )
)
# include all cmake files fouund for objecttypes here
# include all cmake files found for objecttypes here
foreach ( _buildInfo ${_plugin_buildinfos})
include ("${CMAKE_SOURCE_DIR}/${_buildInfo}")
endforeach ()
......@@ -221,12 +221,18 @@ if ( EXISTS ${BRANDING_DIRECTORY}/branding.qrc )
endif()
endif()
# =======================================================
# Generate import file for static plugins
# =======================================================
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" "#include <QtPlugin>\n\n")
foreach (plugin ${OPENFLIPPER_STATIC_PLUGIN_NAMES})
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" "Q_IMPORT_PLUGIN(${plugin});\n")
endforeach()
# Create a static variable containing plugin filenames to skip the dynamic version while loading plugins.
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" "\nnamespace cmake {\n")
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" "\nconst char *static_plugins = \"\"\n")
......@@ -239,8 +245,17 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" ";\n} /* namespace c
list(APPEND RC_SRC "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc")
# =======================================================
# Sort files into one OpenFLipper Tree in the IDE
# =======================================================
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${sources} ${headers} ${uifiles} )
# =======================================================
# Create Executable file
# =======================================================
if (WIN32)
# add app icon rc file to windows build
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${sources} ${headers} ${RC_SRC})
......@@ -253,6 +268,7 @@ else ()
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} ${sources} ${headers} ${RC_SRC} )
endif ()
if ( PYTHON3_FOUND)
target_link_libraries(${OPENFLIPPER_PRODUCT_STRING} ${PYTHON_LIBRARY} pybind11::module pybind11::embed Python3::Python )
endif()
......@@ -284,7 +300,7 @@ endif()
# ====================================================================================
# Get list of ll plugin dependencies and handle special ones
# Get list of plugin dependencies and handle special ones
# where we need to link the library directly into the core to prevent
# linker problems
# ====================================================================================
......
......@@ -666,11 +666,9 @@ function (_build_openflipper_plugin plugin)
if (STATIC_PLUGIN_${_PLUGIN})
add_library (Plugin-Static-${plugin} STATIC ${ui-files} ${sources} ${headers} ${qrc} ${${_PLUGIN}_ADDSRC})
set_target_properties(Plugin-Static-${plugin} PROPERTIES COMPILE_DEFINITIONS "QT_STATICPLUGIN")
get_target_property(PLUGIN_OUTPUT_FILENAME Plugin-${plugin} LOCATION)
get_filename_component(PLUGIN_OUTPUT_FILENAME "${PLUGIN_OUTPUT_FILENAME}" NAME)
acg_set (OPENFLIPPER_STATIC_PLUGINS "${OPENFLIPPER_STATIC_PLUGINS};Plugin-Static-${plugin}")
acg_set (OPENFLIPPER_STATIC_PLUGIN_NAMES "${OPENFLIPPER_STATIC_PLUGIN_NAMES};${STATIC_PLUGIN_${_PLUGIN}}")
acg_set (OPENFLIPPER_STATIC_PLUGIN_FILES "${OPENFLIPPER_STATIC_PLUGIN_FILES};${PLUGIN_OUTPUT_FILENAME}")
acg_set (OPENFLIPPER_STATIC_PLUGIN_FILES "${OPENFLIPPER_STATIC_PLUGIN_FILES};Plugin-${plugin}")
endif ()
# Link plugin against python if possible
......@@ -743,6 +741,14 @@ function (_build_openflipper_plugin plugin)
)
endif ()
if (STATIC_PLUGIN_${_PLUGIN})
target_link_libraries (Plugin-Static-${plugin}
${${_PLUGIN}_DEPS_LIBRARIES}
${${_PLUGIN}_LIBRARIES}
${${_PLUGIN}_TYPE_DEPENDENCIES}
)
endif()
target_link_libraries (Plugin-${plugin}
${${_PLUGIN}_DEPS_LIBRARIES}
${${_PLUGIN}_LIBRARIES}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment