-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for plugins that are built as debug or as manualload debug #550
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,6 @@ | |
namespace osvr { | ||
namespace pluginhost { | ||
static const auto PLUGIN_HOST_LOGGER_NAME = "PluginHost"; | ||
#ifdef _MSC_VER | ||
static const auto PLUGIN_HOST_DEBUG_SUFFIX = ".debug"; | ||
#endif | ||
namespace fs = boost::filesystem; | ||
|
||
struct RegistrationContext::Impl : private boost::noncopyable { | ||
|
@@ -88,16 +85,11 @@ namespace pluginhost { | |
std::string const &name, | ||
OSVR_PluginRegContext ctx, | ||
bool shouldRethrow = false) { | ||
#if defined(_MSC_VER) && !defined(NDEBUG) | ||
// Visual C++ debug runtime: we append to the plugin name. | ||
const std::string decoratedPluginName = name + PLUGIN_HOST_DEBUG_SUFFIX; | ||
#else | ||
const std::string &decoratedPluginName = name; | ||
#endif | ||
|
||
log.debug() << "Trying to load a plugin with the name " | ||
<< decoratedPluginName; | ||
<< name; | ||
try { | ||
plugin = libfunc::loadPluginByName(decoratedPluginName, ctx); | ||
plugin = libfunc::loadPluginByName(name, ctx); | ||
return true; | ||
} catch (std::runtime_error const &e) { | ||
log.debug() << "Failed: " << e.what(); | ||
|
@@ -175,7 +167,7 @@ namespace pluginhost { | |
// Visual C++ debug runtime: we append to the plugin name. Must only | ||
// load debug plugins iff we're a debug server | ||
const auto isDebugRuntimePlugin = | ||
boost::iends_with(pluginBaseName, PLUGIN_HOST_DEBUG_SUFFIX); | ||
boost::iends_with(pluginBaseName, OSVR_PLUGIN_DEBUG_SUFFIX); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know the answer to this, but if we have two suffixes ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the latest OSVR Core snapshot, I'm seeing that plugins that are debug and manualload are named as follows: From osvrAddPlugin.cmake script I confirmed that
|
||
#if defined(NDEBUG) | ||
/// This is a non-debug build. | ||
if (isDebugRuntimePlugin) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,8 @@ | |
// limitations under the License. | ||
|
||
// Internal Includes | ||
#include <osvr/PluginHost/SearchPath.h> | ||
#include <osvr/PluginHost/PathConfig.h> | ||
#include <osvr/PluginHost/SearchPath.h> | ||
#include <osvr/Util/BinaryLocation.h> | ||
#include <osvr/Util/Verbosity.h> | ||
|
||
|
@@ -33,9 +33,9 @@ | |
#include <boost/range/iterator_range.hpp> | ||
|
||
// Standard includes | ||
#include <vector> | ||
#include <string> | ||
#include <algorithm> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace osvr { | ||
namespace pluginhost { | ||
|
@@ -172,11 +172,20 @@ namespace pluginhost { | |
} | ||
const auto pluginBaseName = | ||
pluginCandidate.filename().stem().generic_string(); | ||
|
||
#if defined(_MSC_VER) && !defined(NDEBUG) | ||
// Visual C++ debug runtime: we append to the plugin name. | ||
const std::string decoratedPluginName = | ||
pluginName + OSVR_PLUGIN_DEBUG_SUFFIX; | ||
#else | ||
const std::string &decoratedPluginName = pluginName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's probably because it's a copypasta from its original location. I moved this piece of code from RegistrationContext.cpp. Good catch! I'll change that |
||
#endif | ||
|
||
/// If the name is right or has the manual load suffix, this is | ||
/// a good one. | ||
if ((pluginBaseName == pluginName) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't |
||
(pluginBaseName == | ||
pluginName + OSVR_PLUGIN_IGNORE_SUFFIX)) { | ||
decoratedPluginName + OSVR_PLUGIN_IGNORE_SUFFIX)) { | ||
return pluginPathName.path().generic_string(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the
.debug
suffix is no longer MSVC-only, then you should also modifycmake-local/osvrAddPlugin.cmake
accordingly (lines 45–48).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See
src/osvr/PluginHost/RegistrationContext.cpp
, circa line 168 where we check to see if the.manualload
suffix appears at the end of the name.