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
6e32b402
Commit
6e32b402
authored
Nov 24, 2015
by
Hans-Christian Ebke
Browse files
Enable optional static plugin linkage.
parent
1cfeb1b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Core/PluginLoader.cc
View file @
6e32b402
...
...
@@ -122,6 +122,8 @@
*/
static
const
int
PRELOAD_THREADS_COUNT
=
(
QThread
::
idealThreadCount
()
!=
-
1
)
?
QThread
::
idealThreadCount
()
:
8
;
namespace
cmake
{
extern
const
char
*
static_plugins
;
};
class
PreloadAggregator
{
public:
PreloadAggregator
()
:
expectedLoaders_
(
0
)
{}
...
...
@@ -342,6 +344,22 @@ void Core::loadPlugins()
// Prepend the additional Plugins to the plugin list
pluginlist
=
additionalPlugins
<<
pluginlist
;
/*
* Get list of static plugins.
*/
QSet
<
QString
>
staticPlugins
=
QSet
<
QString
>::
fromList
(
QString
::
fromUtf8
(
cmake
::
static_plugins
).
split
(
"
\n
"
));
for
(
int
i
=
0
;
i
<
pluginlist
.
size
();
)
{
const
QString
bn
=
QFileInfo
(
pluginlist
[
i
]).
fileName
();
if
(
staticPlugins
.
contains
(
bn
))
{
emit
log
(
LOGOUT
,
trUtf8
(
"Not loading dynamic %1 as it is statically "
"linked against OpenFlipper."
).
arg
(
bn
));
pluginlist
.
removeAt
(
i
);
}
else
{
++
i
;
}
}
/*
* Note: This call is not necessary, anymore. Initialization order
* is determined later.
...
...
CoreApp/CMakeLists.txt
View file @
6e32b402
...
...
@@ -100,6 +100,14 @@ if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/branding.qrc )
endif
()
endif
()
file
(
WRITE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/static_plugins.cc"
"namespace cmake {
\n
const char *static_plugins =
\"\"\n
"
)
foreach
(
plugin
${
OPENFLIPPER_STATIC_PLUGIN_FILES
}
)
file
(
APPEND
"
${
CMAKE_CURRENT_BINARY_DIR
}
/static_plugins.cc"
"
\"
${
plugin
}
\\
n
\"\n
"
)
endforeach
()
file
(
APPEND
"
${
CMAKE_CURRENT_BINARY_DIR
}
/static_plugins.cc"
";
\n
} /* namespace cmake */
\n
"
)
list
(
APPEND RC_SRC
"
${
CMAKE_CURRENT_BINARY_DIR
}
/static_plugins.cc"
)
if
(
WIN32
)
# add app icon rc file to windows build
acg_add_executable
(
${
OPENFLIPPER_PRODUCT_STRING
}
WIN32
${
CMAKE_CURRENT_SOURCE_DIR
}
/CoreApp.rc
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_targets
}
${
RC_SRC
}
)
...
...
@@ -206,6 +214,7 @@ target_link_libraries (${OPENFLIPPER_PRODUCT_STRING}
${
GLEW_LIBRARY
}
${
GLUT_LIBRARIES
}
${
COREAPP_ADDITIONAL_LINK_LIBRARIES
}
${
OPENFLIPPER_STATIC_PLUGINS
}
)
if
(
APPLE
)
...
...
cmake/plugin.cmake
View file @
6e32b402
...
...
@@ -595,11 +595,18 @@ function (_build_openflipper_plugin plugin)
add_library
(
Plugin-
${
plugin
}
MODULE
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_targets
}
${
qrc_targets
}
${${
_PLUGIN
}
_ADDSRC
}
)
# add this plugin to build plugin list for dependency tracking
acg_set
(
OPENFLIPPER_PLUGINS
"
${
OPENFLIPPER_PLUGINS
}
;Plugin-
${
plugin
}
"
)
acg_set
(
OPENFLIPPER_
${
_PLUGIN
}
_BUILD
"1"
)
if
(
STATIC_PLUGIN_
${
_PLUGIN
}
)
add_library
(
Plugin-Static-
${
plugin
}
STATIC
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_targets
}
${
qrc_targets
}
${${
_PLUGIN
}
_ADDSRC
}
)
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_FILES
"
${
OPENFLIPPER_STATIC_PLUGIN_FILES
}
;
${
PLUGIN_OUTPUT_FILENAME
}
"
)
endif
()
# append compiler and linker flags from plugin dependencies
list
(
APPEND
${
_PLUGIN
}
_DEPS_COMPILE_DEFINITIONS
${${
_PLUGIN
}
_CDEFINITIONSADD
}
)
...
...
@@ -771,6 +778,12 @@ macro (openflipper_plugin)
OFF
)
option
(
STATIC_PLUGIN_
${
_PLUGIN
}
"Link plugin
\"
${
_plugin
}
\"
statically into the OpenFlipper binary."
OFF
)
if
(
NOT DISABLE_PLUGIN_
${
_PLUGIN
}
)
_build_openflipper_plugin
(
${
_plugin
}
${
ARGN
}
)
set
(
LOADED_PACKAGES
${
LOADED_PACKAGES
}
PARENT_SCOPE
)
...
...
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