在windows 下使用visual studio 调试比较容易。设置dll的输出路径是和cloudcompare相同或者位于cloudcompare/plugins 下。
cc应用层序会自动搜索该路径。
那么在ubuntu下使用vscode 如何方便的调试呢?
在ccpluginManager下 205行增加如下代码(斜体)
以pcl插件为例,设置的搜索相对路径。
#elif defined(Q_OS_LINUX)
// Shaders & plugins are relative to the bin directory where the executable is found
QDir theDir = appDir;
if (theDir.dirName() == "bin")
{
theDir.cdUp();
m_PluginPaths << (theDir.absolutePath() + "/lib/cloudcompare/plugins");
m_ShaderPath = (theDir.absolutePath() + "/share/cloudcompare/shaders");
m_TranslationPath = (theDir.absolutePath() + "/share/cloudcompare/translations");
}
else
{
// Choose a reasonable default to look in
m_PluginPaths << "/usr/lib/cloudcompare/plugins";
#ifdef QT_DEBUG
m_PluginPaths << "../plugins/core/Standard/qPCL/PclIO";
m_PluginPaths << "../plugins/core/Standard/qPCL";
#endif
m_ShaderPath = "/usr/share/cloudcompare/shaders";
m_TranslationPath = "/usr/share/cloudcompare/translations";
}
#else
除了这种方式,如果程序更加复杂,我更喜欢让程序读取一个.env 文件,在.env 文件中解析相应的路径。