本文整理汇总了C++中ProjectBuildTarget::AddLinkerOption方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectBuildTarget::AddLinkerOption方法的具体用法?C++ ProjectBuildTarget::AddLinkerOption怎么用?C++ ProjectBuildTarget::AddLinkerOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectBuildTarget
的用法示例。
在下文中一共展示了ProjectBuildTarget::AddLinkerOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/** get target specific stuff
* \param root : the root node of the XML project file (<Project >
**/
bool MSVC10Loader::GetTargetSpecific(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* idef = root->FirstChildElement("ItemDefinitionGroup");
while (idef)
{
const char* attr = idef->Attribute("Condition");
if (!attr) { idef = idef->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* comp = idef->FirstChildElement("ClCompile");
if (comp)
{
const TiXmlElement* pp = comp->FirstChildElement("PreprocessorDefinitions");
wxArrayString pps = GetPreprocessors(pp);
for (size_t j=0; j<pps.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddCompilerOption((m_ConvertSwitches ? _T("-D") : _T("/D")) + pps.Item(j));
}
const TiXmlElement* cinc = comp->FirstChildElement("AdditionalIncludeDirectories");
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* copt = comp->FirstChildElement("AdditionalOptions");
wxArrayString copts = GetOptions(copt);
for (size_t j=0; j<copts.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt && !m_ConvertSwitches) bt->AddCompilerOption(copts.Item(j));
}
}
const TiXmlElement* link = idef->FirstChildElement("Link");
if (link)
{
const TiXmlElement* llib = link->FirstChildElement("AdditionalDependencies");
wxArrayString libs = GetLibs(llib);
for (size_t j=0; j<libs.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddLinkLib(libs.Item(j));
}
const TiXmlElement* linc = link->FirstChildElement("AdditionalLibraryDirectories");
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));
}
const TiXmlElement* lopt = comp->FirstChildElement("AdditionalOptions");
wxArrayString lopts = GetOptions(lopt);
for (size_t j=0; j<lopts.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt && !m_ConvertSwitches) bt->AddLinkerOption(lopts.Item(j));
}
const TiXmlElement* debug = link->FirstChildElement("GenerateDebugInformation");
wxString sDebug = GetText(debug);
if (sDebug.MakeUpper().IsSameAs(_T("TRUE")))
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt && !m_ConvertSwitches) bt->AddLinkerOption(_T("/debug"));
}
}
const TiXmlElement* res = idef->FirstChildElement("ResourceCompile");
if (res)
{
const TiXmlElement* pp = res->FirstChildElement("PreprocessorDefinitions");
wxArrayString pps = GetPreprocessors(pp);
for (size_t j=0; j<pps.Count(); ++j)
{
ProjectBuildTarget* bt = m_pc[sName].bt;
if (bt) bt->AddCompilerOption((m_ConvertSwitches ? _T("-D") : _T("/D")) + pps.Item(j));
}
//.........这里部分代码省略.........
示例2: if
//.........这里部分代码省略.........
{
// 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)
{
bt->AddLinkerOption(wxString(_T("/NODEFAULTLIB:")) + arr[i]);
}
}
#if 0
// no need since "/nologo" appear on the invocation commands of compilers/linkers
if (!m_ConvertSwitches)
{
tmp = tool->Attribute("SuppressStartupBanner");
if (tmp.IsSameAs("TRUE"))
bt->AddLinkerOption("/nologo");
}
#endif
tmp = cbC2U(tool->Attribute("GenerateDebugInformation"));
if (tmp.IsSameAs(_T("TRUE")))
{
//bt->AddCompilerOption(m_ConvertSwitches ? "-g" : "/Zi"); // no !
if (!m_ConvertSwitches)
bt->AddLinkerOption(_T("/debug"));
}
// other options: /MACHINE:I386, /INCREMENTAL:YES, /STACK:10000000
if (!m_ConvertSwitches)
{
arr = GetArrayFromString(ReplaceMSVCMacros(cbC2U(tool->Attribute("AdditionalOptions"))), _T(" "));
for (unsigned int i = 0; i < arr.GetCount(); ++i) bt->AddLinkerOption(arr[i]);
}
// else ignore all options
tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("AdditionalDependencies")));
arr = GetArrayFromString(tmp, _T(" "));
for (unsigned int i = 0; i < arr.GetCount(); ++i)
示例3: ProcessLinkerOptions
void ProjectOptionsManipulator::ProcessLinkerOptions(cbProject* prj, const wxString& opt, const wxString& opt_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->GetLinkerOptions(), opt);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains linker option '%s'."),
prj->GetTitle().wx_str(), opt.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s': Does not contain linker option '%s'."),
prj->GetTitle().wx_str(), opt.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->GetLinkerOptions(), opt);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains linker option '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), opt.wx_str()));
}
else if (!has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearchNot)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Does not contain linker option '%s'."),
prj->GetTitle().wx_str(), tgt->GetTitle().wx_str(), opt.wx_str()));
}
}
}
}
}
break;
case ProjectOptionsManipulatorDlg::eRemove:
{
wxString full_opt;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLinkerOptions(), opt, full_opt) )
prj->RemoveLinkerOption(full_opt);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && HasOption(tgt->GetLinkerOptions(), opt, full_opt))
tgt->RemoveLinkerOption(opt);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( !HasOption(prj->GetLinkerOptions(), opt) )
prj->AddLinkerOption(opt);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && !HasOption(tgt->GetLinkerOptions(), opt))
tgt->AddLinkerOption(opt);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace:
{
wxString full_opt;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetLinkerOptions(), opt, full_opt) )
prj->ReplaceLinkerOption(full_opt, ManipulateOption(full_opt, opt, opt_new));
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
//.........这里部分代码省略.........
示例4: if
bool MSVC10Loader::GetTargetSpecific(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* idef = root->FirstChildElement("ItemDefinitionGroup");
for (; idef; idef=idef->NextSiblingElement("ItemDefinitionGroup"))
{
const char* attr = idef->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))
{
assert(m_pc[sName].bt);
if (!m_pc[sName].bt)
continue;
ProjectBuildTarget* bt = m_pc[sName].bt;
if (!m_ConvertSwitches && !m_pc[sName].Charset.IsEmpty())
{
if (m_pc[sName].Charset.IsSameAs(_T("NotSet"),false))
; // nop
else if (m_pc[sName].Charset.IsSameAs(_T("Unicode"),false))
bt->AddCompilerOption(_T("/D_UNICODE /DUNICODE"));
else if (m_pc[sName].Charset.IsSameAs(_T("MultiByte"),false))
bt->AddCompilerOption(_T("/D_MBCS"));
else
pMsg->DebugLog(_("Import; Unsupported CharacterSet: ") + m_pc[sName].Charset);
}
if (!m_pc[sName].sIntDir.IsEmpty())
bt->SetObjectOutput(m_pc[sName].sIntDir);
if (!m_pc[sName].sOutDir.IsEmpty())
{
bt->SetOutputFilename(m_pc[sName].sOutDir+m_pc[sName].sTargetName+m_pc[sName].sTargetExt);
bt->SetDepsOutput(m_pc[sName].sOutDir);
}
if (!m_pc[sName].sConf.IsEmpty())
{
if (m_pc[sName].sConf.IsSameAs(_T("Release"), false))
{
// nop
}
else if (m_pc[sName].sConf.IsSameAs(_T("Debug"),false))
bt->AddCompilerOption(!m_ConvertSwitches ? _T("/Zi") : _T("-g"));
else
pMsg->DebugLog(_("Import; Unsupported Configuration: ") + m_pc[sName].sConf);
}
if (m_pc[sName].bNoImportLib)
{
bt->SetCreateDefFile(false);
bt->SetCreateStaticLib(false);
}
const TiXmlElement* comp = idef->FirstChildElement("ClCompile");
if (comp)
{
const TiXmlElement* pp = comp->FirstChildElement("PreprocessorDefinitions");
wxArrayString pps = GetArray(pp);
for (size_t j=0; j<pps.Count(); ++j)
bt->AddCompilerOption((m_ConvertSwitches ? _T("-D") : _T("/D")) + pps.Item(j));
const TiXmlElement* cinc = comp->FirstChildElement("AdditionalIncludeDirectories");
wxArrayString cdirs = GetArrayPaths(cinc, m_pc[sName]);
for (size_t j=0; j<cdirs.Count(); ++j)
bt->AddIncludeDir(cdirs.Item(j));
const TiXmlElement* copt = comp->FirstChildElement("AdditionalOptions");
wxArrayString copts = GetArray(copt,_T(" "));
if (!m_ConvertSwitches)
{
for (size_t j=0; j<copts.Count(); ++j)
bt->AddCompilerOption(copts.Item(j));
}
if ((copt=comp->FirstChildElement("Optimization")))
{
wxString val = GetText(copt);
if (val.IsSameAs(_T("Disabled"),false))
bt->AddCompilerOption(!m_ConvertSwitches ? _T("/Od") : _T("-O0"));
else if (val.IsSameAs(_T("MinSpace"), false))
{
if (!m_ConvertSwitches) bt->AddCompilerOption(_T("/O1"));
else
{
bt->AddLinkerOption(_T("-s"));
bt->AddCompilerOption(_T("-Os"));
}
//.........这里部分代码省略.........