Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
2a44c39a
Commit
2a44c39a
authored
May 27, 2020
by
Jan
Browse files
Make static plugins work again
parent
82a04570
Changes
3
Hide whitespace changes
Inline
Side-by-side
Core/PluginLoader.cc
View file @
2a44c39a
...
...
@@ -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
]).
fil
eName
();
const
QString
bn
=
QFileInfo
(
pluginlist
[
i
]).
bas
eName
()
.
remove
(
"lib"
)
;
if
(
staticPlugins
.
contains
(
bn
))
{
emit
log
(
LOG
OUT
,
tr
(
"Not loading dynamic %1 as it is statically "
emit
log
(
LOG
WARN
,
tr
(
"Not loading dynamic %1 as it is statically "
"linked against OpenFlipper."
).
arg
(
bn
));
pluginlist
.
removeAt
(
i
);
}
else
{
...
...
CoreApp/CMakeLists.txt
View file @
2a44c39a
...
...
@@ -23,7 +23,7 @@ if( APPLE )
)
# include all cmake files fou
u
nd 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"
"
\n
namespace cmake {
\n
"
)
file
(
APPEND
"
${
CMAKE_CURRENT_BINARY_DIR
}
/static_plugins.cc"
"
\n
const 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
# ====================================================================================
...
...
cmake/plugin.cmake
View file @
2a44c39a
...
...
@@ -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
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment