本文整理汇总了C++中ProjectBuildTarget::AddLibDir方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectBuildTarget::AddLibDir方法的具体用法?C++ ProjectBuildTarget::AddLibDir怎么用?C++ ProjectBuildTarget::AddLibDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectBuildTarget
的用法示例。
在下文中一共展示了ProjectBuildTarget::AddLibDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/** get project includes
* \param root : the root node of the XML project file (<Project >
**/
bool MSVC10Loader::GetProjectIncludes(const TiXmlElement* root)
{
if (!root) return false;
LogManager* pMsg = Manager::Get()->GetLogManager();
if (!pMsg) return false;
bool bResult = false;
// parse all global parameters
const TiXmlElement* prop = root->FirstChildElement("PropertyGroup");
while (prop)
{
const char* attr = prop->Attribute("Condition");
if (!attr) { prop = prop->NextSiblingElement(); continue; }
wxString conf = cbC2U(attr);
for (size_t i=0; i<m_pcNames.Count(); ++i)
{
wxString sName = m_pcNames.Item(i);
wxString sConf = SubstituteConfigMacros(conf);
if (sConf.IsSameAs(sName))
{
const TiXmlElement* cinc = prop->FirstChildElement("IncludePath");
wxArrayString cdirs = GetDirectories(cinc);
for (size_t j=0; j<cdirs.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddIncludeDir(cdirs.Item(j));
}
const TiXmlElement* linc = prop->FirstChildElement("LibraryPath");
wxArrayString ldirs = GetDirectories(linc);
for (size_t j=0; j<ldirs.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddLibDir(ldirs.Item(j));
}
bResult = true; // got something
}
}
prop = prop->NextSiblingElement();
}
if (!bResult)
pMsg->DebugLog(_("Failed to find any includes in the project...?!"));
return bResult;
}
示例2: SubstituteConfigMacros
bool MSVC10Loader::GetProjectIncludes(const TiXmlElement* root)
{
if (!root) return false;
LogManager* pMsg = Manager::Get()->GetLogManager();
if (!pMsg) return false;
bool bResult = false;
// parse all global parameters
const TiXmlElement* prop = root->FirstChildElement("PropertyGroup");
for (; prop; prop=prop->NextSiblingElement("PropertyGroup"))
{
const char* attr = prop->Attribute("Condition");
if (!attr) continue;
wxString conf = cbC2U(attr);
for (HashProjectsConfs::iterator it=m_pc.begin(); it!=m_pc.end(); ++it)
{
wxString sName = it->second.sName;
wxString sConf = SubstituteConfigMacros(conf);
if (sConf.IsSameAs(sName))
{
// $(VCInstallDir)include , $(VCInstallDir)atlmfc\include , $(WindowsSdkDir)include , $(FrameworkSDKDir)\include
const TiXmlElement* cinc = prop->FirstChildElement("IncludePath");
wxArrayString cdirs = GetArrayPaths(cinc, m_pc[sName]);
for (size_t j=0; j<cdirs.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddIncludeDir(cdirs.Item(j));
}
// $(VCInstallDir)lib , $(VCInstallDir)atlmfc\lib , $(WindowsSdkDir)lib , $(FrameworkSDKDir)\lib
const TiXmlElement* linc = prop->FirstChildElement("LibraryPath");
wxArrayString ldirs = GetArrayPaths(linc, m_pc[sName]);
for (size_t j=0; j<ldirs.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddLibDir(ldirs.Item(j));
}
bResult = true; // got something
}
}
}
if (!bResult)
pMsg->DebugLog(_("Failed to find any includes in the project...?!"));
return bResult;
}
示例3: ProcessLinkerPaths
void ProjectOptionsManipulator::ProcessLinkerPaths(cbProject* prj, const wxString& path, const wxString& path_new, wxArrayString& result)
{
ProjectOptionsManipulatorDlg::EProjectScanOption scan_opt = m_Dlg->GetScanOption();
switch (scan_opt)
{
case ProjectOptionsManipulatorDlg::eSearch:
case ProjectOptionsManipulatorDlg::eSearchNot:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
bool has_opt = HasOption(prj->GetLibDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains linker path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not contain linker path '%s'."),
prj->GetTitle().wx_str(), path.wx_str()));
}
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt)
{
bool has_opt = HasOption(tgt->GetLibDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains linker path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not contain linker path '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), path.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
wxString full_path;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLibDirs(), path, full_path) )
prj->RemoveLibDir(full_path);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && HasOption(tgt->GetLibDirs(), path, full_path))
tgt->RemoveLibDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( !HasOption(prj->GetLibDirs(), path) )
prj->AddLibDir(path);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && !HasOption(tgt->GetLibDirs(), path))
tgt->AddLibDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace:
{
wxString full_path;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLibDirs(), path, full_path) )
prj->ReplaceLibDir(full_path, ManipulateOption(full_path, path, path_new));
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
//.........这里部分代码省略.........
示例4: if
bool MSVC7Loader::DoImport(TiXmlElement* conf)
{
ProjectBuildTarget* bt = m_pProject->GetBuildTarget(m_ConfigurationName);
if (!bt)
bt = m_pProject->AddBuildTarget(m_ConfigurationName);
bt->SetCompilerID(m_pProject->GetCompilerID());
// See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcext/html/vxlrfvcprojectenginelibraryruntimelibraryoption.asp
m_OutDir = ReplaceMSVCMacros(cbC2U(conf->Attribute("OutputDirectory")));
m_IntDir = ReplaceMSVCMacros(cbC2U(conf->Attribute("IntermediateDirectory")));
if (m_IntDir.StartsWith(_T(".\\"))) m_IntDir.Remove(0,2);
bt->SetObjectOutput(m_IntDir);
// see MSDN: ConfigurationTypes Enumeration
wxString conftype = cbC2U(conf->Attribute("ConfigurationType"));
if (conftype.IsSameAs(_T("1"))) // typeApplication 1, no difference between console or gui here, we must check the subsystem property of the linker
bt->SetTargetType(ttExecutable);
else if (conftype.IsSameAs(_T("2"))) // typeDynamicLibrary 2
bt->SetTargetType(ttDynamicLib);
else if (conftype.IsSameAs(_T("4"))) // typeStaticLibrary 4
bt->SetTargetType(ttStaticLib);
else if (conftype.IsSameAs(_T("-1"))) // typeNative -1, check subsystem property of the linker to make sure
bt->SetTargetType(ttNative);
else if (conftype.IsSameAs(_T("10"))) // typeGeneric 10
bt->SetTargetType(ttCommandsOnly);
else // typeUnknown 0
{
bt->SetTargetType(ttCommandsOnly);
Manager::Get()->GetLogManager()->DebugLog(_T("unrecognized project type"));
}
TiXmlElement* tool = conf->FirstChildElement("Tool");
if (!tool)
{
Manager::Get()->GetLogManager()->DebugLog(_T("No 'Tool' node..."));
return false;
}
for (; tool; tool=tool->NextSiblingElement("Tool"))
{
if (strcmp(tool->Attribute("Name"), "VCLinkerTool") == 0 ||
strcmp(tool->Attribute("Name"), "VCLibrarianTool") == 0)
{
// linker
wxString tmp;
if ((bt->GetTargetType()==ttExecutable) || (bt->GetTargetType()==ttNative))
{
tmp = cbC2U(tool->Attribute("SubSystem"));
//subSystemNotSet 0
//subSystemConsole 1
//subSystemWindows 2
if (tmp.IsSameAs(_T("1")))
{
bt->SetTargetType(ttConsoleOnly);
//bt->AddLinkerOption("/SUBSYSTEM:CONSOLE"); // don't know if it is necessary
}
else if (tmp.IsSameAs(_T("3")))
bt->SetTargetType(ttNative);
} // else we keep executable
tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("OutputFile")));
tmp = UnixFilename(tmp);
if (tmp.Last() == _T('.')) tmp.RemoveLast();
if (bt->GetTargetType() == ttStaticLib)
{
// convert the lib name
Compiler* compiler = CompilerFactory::GetCompiler(m_pProject->GetCompilerID());
if (compiler)
{
wxString prefix = compiler->GetSwitches().libPrefix;
wxString suffix = compiler->GetSwitches().libExtension;
wxFileName fname = tmp;
if (!fname.GetName().StartsWith(prefix))
fname.SetName(prefix + fname.GetName());
fname.SetExt(suffix);
tmp = fname.GetFullPath();
}
}
bt->SetOutputFilename(tmp);
m_TargetPath = wxFileName(tmp).GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
m_TargetFilename = wxFileName(tmp).GetFullName();
tmp = cbC2U(tool->Attribute("AdditionalLibraryDirectories"));
wxArrayString arr;
ParseInputString(tmp, arr);
for (unsigned int i = 0; i < arr.GetCount(); ++i)
{
bt->AddLibDir(ReplaceMSVCMacros(arr[i]));
}
if (!m_ConvertSwitches) // no point importing this option, if converting to GCC
{
tmp = cbC2U(tool->Attribute("IgnoreDefaultLibraryNames"));
arr = GetArrayFromString(tmp, _T(";"));
if (arr.GetCount()==1) arr = GetArrayFromString(tmp, _T(","));
for (unsigned int i = 0; i < arr.GetCount(); ++i)
{
//.........这里部分代码省略.........
示例5: if
//.........这里部分代码省略.........
const TiXmlElement* cinc = res->FirstChildElement("AdditionalIncludeDirectories");
wxArrayString cdirs = GetArrayPaths(cinc,m_pc[sName]);
for (size_t j=0; j<cdirs.Count(); ++j)
bt->AddResourceIncludeDir(cdirs.Item(j));
const TiXmlElement* copt = res->FirstChildElement("AdditionalOptions");
wxArrayString copts = GetArray(copt,_T(" "));
if (!m_ConvertSwitches)
{
for (size_t j=0; j<copts.Count(); ++j)
bt->AddCompilerOption(copts.Item(j));
}
}
const TiXmlElement* link = idef->FirstChildElement("Link");
if (link)
{
const TiXmlElement* copt;
if ((copt=link->FirstChildElement("OutputFile")))
{
wxString val = GetText(copt);
ReplaceConfigMacros(m_pc[sName],val);
if (!val.IsEmpty())
bt->SetOutputFilename(val);
}
if ((copt=link->FirstChildElement("ModuleDefinitionFile")))
{
wxString val = GetText(copt);
ReplaceConfigMacros(m_pc[sName],val);
if (!val.IsEmpty())
bt->SetDefinitionFileFilename(val);
}
if ((copt=link->FirstChildElement("ImportLibrary")))
{
wxString val=GetText(copt);
ReplaceConfigMacros(m_pc[sName],val);
if (!val.IsEmpty())
bt->SetImportLibraryFilename(val);
}
copt = link->FirstChildElement("AdditionalDependencies");
wxArrayString libs = GetLibs(copt);
for (size_t j=0; j<libs.Count(); ++j)
bt->AddLinkLib(libs.Item(j));
copt = link->FirstChildElement("AdditionalLibraryDirectories"); /// @note : maybe use loops on all elements
for (; copt; copt=copt->NextSiblingElement("AdditionalLibraryDirectories"))
{
wxArrayString ldirs = GetArrayPaths(copt,m_pc[sName]);
for (size_t j=0; j<ldirs.Count(); ++j)
bt->AddLibDir(ldirs.Item(j));
}
if (!m_ConvertSwitches)
{
copt = link->FirstChildElement("AdditionalOptions");
wxArrayString lopts = GetArray(copt,_T(" "));
for (size_t j=0; j<lopts.Count(); ++j)
bt->AddLinkerOption(lopts.Item(j));
copt = link->FirstChildElement("GenerateDebugInformation");
wxString sDebug = GetText(copt);
if (sDebug.IsSameAs(_T("true"),false))
bt->AddLinkerOption(_T("/debug"));
}
}
const TiXmlElement* event;
if ((event=idef->FirstChildElement("PreBuildEvent")))
{
const TiXmlElement* copt=event->FirstChildElement("Command");
for (; copt; copt=copt->NextSiblingElement("Command"))
{
wxString cmd = UnixFilename(GetText(copt));
ReplaceConfigMacros(m_pc[sName],cmd);
if (!cmd.IsEmpty()) bt->AddCommandsBeforeBuild(cmd);
}
}
if ((event=idef->FirstChildElement("PostBuildEvent")))
{
const TiXmlElement* copt = event->FirstChildElement("Command");
for (; copt; copt=copt->NextSiblingElement("Command"))
{
wxString cmd=UnixFilename(GetText(copt));
ReplaceConfigMacros(m_pc[sName],cmd);
if (!cmd.IsEmpty()) bt->AddCommandsAfterBuild(cmd);
}
}
bResult = true; // got something
}
}
}
if (!bResult)
pMsg->DebugLog(_("Failed to find any includes in the project...?!"));
return bResult;
}