本文整理汇总了C++中ProjectBuildTarget::AddIncludeDir方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectBuildTarget::AddIncludeDir方法的具体用法?C++ ProjectBuildTarget::AddIncludeDir怎么用?C++ ProjectBuildTarget::AddIncludeDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectBuildTarget
的用法示例。
在下文中一共展示了ProjectBuildTarget::AddIncludeDir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLaunch
void ClassWizard::OnLaunch(cb_unused wxCommandEvent& event)
{
ProjectManager* prjMan = Manager::Get()->GetProjectManager();
cbProject* prj = prjMan->GetActiveProject();
ClassWizardDlg dlg(Manager::Get()->GetAppWindow());
PlaceWindow(&dlg);
if (dlg.ShowModal() == wxID_OK)
{
if (!prj)
{
cbMessageBox( _("The new class has been created."),
_("Information"),
wxOK | wxICON_INFORMATION,
Manager::Get()->GetAppWindow());
}
else if( cbMessageBox( _("The new class has been created.\n"
"Do you want to add it to the current project?"),
_("Add to project?"),
wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION,
Manager::Get()->GetAppWindow()) == wxID_YES)
{
wxArrayInt targets;
prjMan->AddFileToProject(dlg.GetHeaderFilename(), prj, targets);
if ( (targets.GetCount() != 0) && (dlg.IsValidImplementationFilename()) )
prjMan->AddFileToProject(dlg.GetImplementationFilename(), prj, targets);
if (dlg.AddPathToProject())
{
// Add the include Path to the Build targets....
for (size_t i = 0; i < targets.GetCount(); ++i)
{
ProjectBuildTarget* buildTarget = prj->GetBuildTarget(targets[i]); // Get the top level build Target
if (buildTarget)
{
wxString include_dir = dlg.GetIncludeDir();
if (!include_dir.IsEmpty())
buildTarget->AddIncludeDir(include_dir);
}
else
{
wxString information;
information.Printf(_("Could not find build target ID = %i.\nThe include directory won't be added to this target. Please do it manually"), targets[i]);
cbMessageBox(information, _("Information"),
wxOK | wxICON_INFORMATION,
Manager::Get()->GetAppWindow());
}
}
}
prjMan->GetUI().RebuildTree();
}
}
}
示例2: 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;
}
示例3: 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;
}
示例4: ProcessCompilerPaths
void ProjectOptionsManipulator::ProcessCompilerPaths(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->GetIncludeDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s': Contains compiler 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 compiler 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->GetIncludeDirs(), path);
if (has_opt && scan_opt==ProjectOptionsManipulatorDlg::eSearch)
{
result.Add(wxString::Format(_("Project '%s', target '%s': Contains compiler 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 compiler 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->GetIncludeDirs(), path, full_path) )
prj->RemoveIncludeDir(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->GetIncludeDirs(), path, full_path))
tgt->RemoveIncludeDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eAdd:
{
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( !HasOption(prj->GetIncludeDirs(), path) )
prj->AddIncludeDir(path);
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
{
ProjectBuildTarget* tgt = prj->GetBuildTarget(i);
if (tgt && !HasOption(tgt->GetIncludeDirs(), path))
tgt->AddIncludeDir(path);
}
}
}
break;
case ProjectOptionsManipulatorDlg::eReplace:
{
wxString full_path;
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eProject) )
{
if ( HasOption(prj->GetIncludeDirs(), path, full_path) )
prj->ReplaceIncludeDir(full_path, ManipulateOption(full_path, path, path_new));
}
if ( m_Dlg->GetOptionActive(ProjectOptionsManipulatorDlg::eTarget) )
{
for (int i=0; i<prj->GetBuildTargetsCount(); ++i)
//.........这里部分代码省略.........
示例5: while
bool MSVC7Loader::DoImportFiles(TiXmlElement* root, int numConfigurations)
{
if (!root)
return false;
TiXmlElement* files = root->FirstChildElement("Files");
if (!files)
files = root; // might not have "Files" section
while (files)
{
TiXmlElement* file = files->FirstChildElement("File");
while (file)
{
wxString fname = ReplaceMSVCMacros(cbC2U(file->Attribute("RelativePath")));
TiXmlElement* conf = file->FirstChildElement("FileConfiguration");
for (; conf; conf=conf->NextSiblingElement("FileConfiguration"))
{
// find the target to which it applies
wxString sTargetName = cbC2U(conf->Attribute("Name"));
sTargetName.Replace(_T("|"), _T(" "), true);
ProjectBuildTarget* bt = m_pProject->GetBuildTarget(sTargetName);
TiXmlElement* tool = conf->FirstChildElement("Tool");
for (; tool; tool=tool->NextSiblingElement("Tool"))
{
// get additional include directories
wxString sAdditionalInclude;
sAdditionalInclude = cbC2U(tool->Attribute("AdditionalIncludeDirectories"));
if (sAdditionalInclude.Len() > 0)
{
// we have to add the additionnal include directories.
// parse the different include directories (comma separated)
int iStart;
int iCommaPosition;
iStart = 0;
iCommaPosition = sAdditionalInclude.Find(_T(","));
do
{
int iEnd;
if (iCommaPosition != wxNOT_FOUND)
{
iEnd = iCommaPosition - 1;
if (iEnd < iStart) iEnd = iStart;
}
else
iEnd = sAdditionalInclude.Len() - 1;
wxString sInclude = sAdditionalInclude.Mid(iStart, iEnd - iStart + 1);
if (bt)
bt->AddIncludeDir(sInclude);
// remove the directory from the include list
sAdditionalInclude = sAdditionalInclude.Mid(iEnd + 2);
iCommaPosition = sAdditionalInclude.Find(_T(","));
}
while (sAdditionalInclude.Len() > 0);
}
}
}
if ((!fname.IsEmpty()) && (fname != _T(".\\")))
{
if (fname.StartsWith(_T(".\\")))
fname.erase(0, 2);
if (!platform::windows)
fname.Replace(_T("\\"), _T("/"), true);
ProjectFile* pf = m_pProject->AddFile(0, fname);
if (pf)
{
// add it to all configurations, not just the first
for (int i = 1; i < numConfigurations; ++i)
{
pf->AddBuildTarget(m_pProject->GetBuildTarget(i)->GetTitle());
HandleFileConfiguration(file, pf); // We need to do this for all files
}
}
}
file = file->NextSiblingElement("File");
}
// recurse for nested filters
TiXmlElement* nested = files->FirstChildElement("Filter");
while (nested)
{
DoImportFiles(nested, numConfigurations);
nested = nested->NextSiblingElement("Filter");
}
files = files->NextSiblingElement("Files");
}
// recurse for nested filters
TiXmlElement* nested = root->FirstChildElement("Filter");
while (nested)
{
DoImportFiles(nested, numConfigurations);
//.........这里部分代码省略.........
示例6: if
//.........这里部分代码省略.........
tmp = cbC2U(tool->Attribute("LinkIncremental"));
if (tmp.IsSameAs(_T("1"))) // 1 -> no, default is yes
bt->AddLinkerOption(_T("/INCREMENTAL:NO"));
}
if (!m_ConvertSwitches)
{
tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("ProgramDatabaseFile")));
if (!tmp.IsEmpty())
bt->AddLinkerOption(wxString(_T("/pdb:")) + UnixFilename(tmp));
}
if (!m_ConvertSwitches)
{
tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("ModuleDefinitionFile")));
if (!tmp.IsEmpty())
bt->AddLinkerOption(_T("/DEF:\"") + tmp + _T("\""));
}
}
else if (strcmp(tool->Attribute("Name"), "VCCLCompilerTool") == 0)
{
unsigned int i;
wxString tmp;
wxArrayString arr;
// compiler
tmp = cbC2U(tool->Attribute("AdditionalIncludeDirectories"));
// vc70 uses ";" while vc71 uses "," separators
// NOTE (mandrav#1#): No, that is *not* the case (what were they thinking at MS?)
// try with comma (,) which is the newest I believe
ParseInputString(tmp, arr); // This will parse recursively
for (i = 0; i < arr.GetCount(); ++i)
{
bt->AddIncludeDir(ReplaceMSVCMacros(arr[i]));
bt->AddResourceIncludeDir(ReplaceMSVCMacros(arr[i]));
}
tmp = cbC2U(tool->Attribute("PreprocessorDefinitions"));
arr = GetArrayFromString(tmp, _T(","));
if (arr.GetCount() == 1) // if it fails, try with semicolon
arr = GetArrayFromString(tmp, _T(";"));
for (unsigned int j = 0; j < arr.GetCount(); ++j)
{
if (m_ConvertSwitches)
bt->AddCompilerOption(wxString(_T("-D")) + arr[j]);
else
bt->AddCompilerOption(wxString(_T("/D")) + arr[j]);
}
tmp = cbC2U(tool->Attribute("WarningLevel"));
if (m_ConvertSwitches)
{
if (tmp.IsSameAs(_T("0")))
bt->AddCompilerOption(_T("-w"));
else if (tmp.IsSameAs(_T("1")) || tmp.IsSameAs(_T("2")) || tmp.IsSameAs(_T("3")))
bt->AddCompilerOption(_T("-W"));
else if (tmp.IsSameAs(_T("4")))
bt->AddCompilerOption(_T("-Wall"));
}
else
{
bt->AddCompilerOption(wxString(_T("/W")) + tmp);
}
/* For more details on "DebugInformationFormat", please visit
http://msdn2.microsoft.com/en-us/library/aa652260(VS.71).aspx
示例7: 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"));
}
//.........这里部分代码省略.........