本文整理汇总了C++中CompilerPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CompilerPtr类的具体用法?C++ CompilerPtr怎么用?C++ CompilerPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompilerPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadCompilers
void CompilerMainPage::LoadCompilers()
{
// Populate the compilers list
m_listBoxCompilers->Clear();
wxString cmpType;
if(clCxxWorkspaceST::Get()->IsOpen() && clCxxWorkspaceST::Get()->GetActiveProject()) {
BuildConfigPtr bldConf = clCxxWorkspaceST::Get()->GetActiveProject()->GetBuildConfiguration();
if(bldConf) {
cmpType = bldConf->GetCompilerType();
}
}
BuildSettingsConfigCookie cookie;
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetFirstCompiler(cookie);
int sel(0);
while(cmp) {
int curidx = m_listBoxCompilers->Append(cmp->GetName());
if(!cmpType.IsEmpty() && (cmp->GetName() == cmpType)) {
sel = curidx;
}
cmp = BuildSettingsConfigST::Get()->GetNextCompiler(cookie);
}
if(!m_listBoxCompilers->IsEmpty()) {
m_listBoxCompilers->SetSelection(sel);
LoadCompiler(m_listBoxCompilers->GetStringSelection());
}
}
示例2: OnAddExistingCompiler
void AdvancedDlg::OnAddExistingCompiler()
{
wxString folder = ::wxDirSelector(_("Select the compiler folder"));
if(folder.IsEmpty()) {
return;
}
CompilerPtr cmp = m_compilersDetector.Locate(folder);
if(cmp) {
// We found new compiler
// Prompt the user to give it a name
while(true) {
wxString name =
::wxGetTextFromUser(_("Set a name to the compiler"), _("New compiler found!"), cmp->GetName());
if(name.IsEmpty()) {
return;
}
// Add the compiler
if(BuildSettingsConfigST::Get()->IsCompilerExist(name)) {
continue;
}
cmp->SetName(name);
break;
}
// Save the new compiler
BuildSettingsConfigST::Get()->SetCompiler(cmp);
// Reload the dialog
LoadCompilers();
}
}
示例3: DoCacheRegexes
void NewBuildTab::DoCacheRegexes()
{
m_cmpPatterns.clear();
// Loop over all known compilers and cache the regular expressions
BuildSettingsConfigCookie cookie;
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetFirstCompiler(cookie);
while( cmp ) {
CmpPatterns cmpPatterns;
const Compiler::CmpListInfoPattern& errPatterns = cmp->GetErrPatterns();
const Compiler::CmpListInfoPattern& warnPatterns = cmp->GetWarnPatterns();
Compiler::CmpListInfoPattern::const_iterator iter;
for (iter = errPatterns.begin(); iter != errPatterns.end(); iter++) {
CmpPatternPtr compiledPatternPtr(new CmpPattern(new wxRegEx(iter->pattern), iter->fileNameIndex, iter->lineNumberIndex, SV_ERROR));
if(compiledPatternPtr->GetRegex()->IsValid()) {
cmpPatterns.errorsPatterns.push_back( compiledPatternPtr );
}
}
for (iter = warnPatterns.begin(); iter != warnPatterns.end(); iter++) {
CmpPatternPtr compiledPatternPtr(new CmpPattern(new wxRegEx(iter->pattern), iter->fileNameIndex, iter->lineNumberIndex, SV_WARNING));
if(compiledPatternPtr->GetRegex()->IsValid()) {
cmpPatterns.warningPatterns.push_back( compiledPatternPtr );
}
}
m_cmpPatterns.insert(std::make_pair(cmp->GetName(), cmpPatterns));
cmp = BuildSettingsConfigST::Get()->GetNextCompiler(cookie);
}
}
示例4: CHECK_PTR_RET
void PSCompilerPage::OnCustomEditorClicked(wxCommandEvent& event)
{
wxPGProperty* prop = m_pgMgr->GetSelectedProperty();
CHECK_PTR_RET(prop);
m_dlg->SetIsDirty(true);
if ( prop == m_pgPropPreProcessors || prop == m_pgPropIncludePaths || prop == m_pgPropAssembler ) {
wxString value = prop->GetValueAsString();
if ( PopupAddOptionDlg(value) ) {
prop->SetValueFromString( value );
}
} else if ( prop == m_pgPropCppOpts || prop == m_pgPropCOpts ) {
wxString value = prop->GetValueAsString();
wxString cmpName = m_gp->GetCompiler();
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetCompiler(cmpName);
if (PopupAddOptionCheckDlg(value, _("Compiler options"), cmp->GetCompilerOptions())) {
prop->SetValueFromString( value );
}
} else if ( prop == m_pgPropPreCmpHeaderFile ) {
wxFileName curvalue = prop->GetValueAsString();
wxString program = ::wxFileSelector(_("Choose a file"), curvalue.GetPath());
if ( !program.IsEmpty() ) {
program.Replace("\\", "/");
prop->SetValue( program );
}
}
}
示例5: SetCompiler
void BuildSettingsConfig::SetCompiler(CompilerPtr cmp)
{
wxXmlNode *node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), wxT("Compilers"));
if(node) {
wxXmlNode *oldCmp = NULL;
wxXmlNode *child = node->GetChildren();
while(child) {
if(child->GetName() == wxT("Compiler") && XmlUtils::ReadString(child, wxT("Name")) == cmp->GetName()) {
oldCmp = child;
break;
}
child = child->GetNext();
}
if(oldCmp) {
node->RemoveChild(oldCmp);
delete oldCmp;
}
node->AddChild(cmp->ToXml());
} else {
wxXmlNode *node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Compilers"));
m_doc->GetRoot()->AddChild(node);
node->AddChild(cmp->ToXml());
}
m_doc->Save(m_fileName.GetFullPath());
}
示例6: FoundMinGWCompiler
bool CompilersDetectorManager::FoundMinGWCompiler() const
{
for(size_t i = 0; i < m_compilersFound.size(); ++i) {
CompilerPtr compiler = m_compilersFound.at(i);
if(compiler->GetCompilerFamily() == COMPILER_FAMILY_MINGW) {
// we found at least one MinGW compiler
return true;
}
}
return false;
}
示例7: GetCompiler
void CompilersFoundDlg::OnItemActivated(wxDataViewEvent& event)
{
CompilerPtr compiler = GetCompiler(event.GetItem());
if(compiler) {
m_defaultCompilers.erase(compiler->GetCompilerFamily());
compiler->SetIsDefault(true);
m_defaultCompilers.insert(std::make_pair(compiler->GetCompilerFamily(), compiler));
m_dataview->UnselectAll();
m_dataview->CallAfter(&wxDataViewCtrl::Refresh, true, (const wxRect*)NULL);
MSWUpdateToolchain(compiler);
}
}
示例8: if
void TagsOptionsDlg::DoSuggest(wxTextCtrl* textCtrl)
{
CompilerPtrVec_t allCompilers = BuildSettingsConfigST::Get()->GetAllCompilers();
// We only support auto retrieval of compilers from the GCC family
wxArrayString compilerNames;
std::for_each(allCompilers.begin(), allCompilers.end(), [&](CompilerPtr c) {
if(c->GetCompilerFamily() == COMPILER_FAMILY_CLANG || c->GetCompilerFamily() == COMPILER_FAMILY_MINGW ||
c->GetCompilerFamily() == COMPILER_FAMILY_GCC) {
compilerNames.Add(c->GetName());
} else if(::clIsCygwinEnvironment() && c->GetCompilerFamily() == COMPILER_FAMILY_CYGWIN) {
compilerNames.Add(c->GetName());
}
});
wxString selection;
if(compilerNames.size() > 1) {
// we have more than one compiler defined, ask the user which one to use
clSingleChoiceDialog dlg(this, compilerNames, 0);
dlg.SetTitle(_("Select the compiler to use:"));
if(dlg.ShowModal() != wxID_OK) return;
selection = dlg.GetSelection();
} else if(compilerNames.size() == 1) {
selection = compilerNames.Item(0);
}
if(selection.IsEmpty()) return;
CompilerPtr comp = BuildSettingsConfigST::Get()->GetCompiler(selection);
CHECK_PTR_RET(comp);
wxArrayString paths;
paths = comp->GetDefaultIncludePaths();
wxString suggestedPaths;
for(size_t i = 0; i < paths.GetCount(); i++) {
suggestedPaths << paths.Item(i) << wxT("\n");
}
suggestedPaths.Trim().Trim(false);
if(!suggestedPaths.IsEmpty()) {
if(::wxMessageBox(_("Accepting this suggestion will replace your old search paths with these paths\nContinue?"),
"CodeLite",
wxYES_NO | wxYES_DEFAULT | wxCANCEL | wxICON_QUESTION) != wxYES) {
return;
}
textCtrl->Clear();
textCtrl->ChangeValue(suggestedPaths);
}
}
示例9: NewCompilerDlgBase
NewCompilerDlg::NewCompilerDlg(wxWindow* parent)
: NewCompilerDlgBase(parent)
{
BuildSettingsConfigCookie cookie;
m_choiceCompilers->Append("<None>");
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetFirstCompiler(cookie);
while ( cmp ) {
m_choiceCompilers->Append(cmp->GetName());
cmp = BuildSettingsConfigST::Get()->GetNextCompiler(cookie);
}
m_choiceCompilers->SetStringSelection("<None>");
WindowAttrManager::Load(this, "NewCompilerDlg");
}
示例10: AddTools
void CompilerLocatorCrossGCC::AddTools(CompilerPtr compiler,
const wxString& binFolder,
const wxString& prefix,
const wxString& suffix)
{
compiler->SetName("Cross GCC ( " + prefix + " )");
compiler->SetInstallationPath(binFolder);
CL_DEBUG("Found CrossGCC compiler under: %s. \"%s\"", binFolder, compiler->GetName());
wxFileName toolFile(binFolder, "");
toolFile.SetFullName(prefix + "-g++");
toolFile.SetExt(suffix);
AddTool(compiler, "CXX", toolFile.GetFullPath(), suffix);
AddTool(compiler, "LinkerName", toolFile.GetFullPath());
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");
toolFile.SetFullName(prefix + "-gcc");
toolFile.SetExt(suffix);
AddTool(compiler, "CC", toolFile.GetFullPath());
toolFile.SetFullName(prefix + "-ar");
toolFile.SetExt(suffix);
AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");
toolFile.SetFullName(prefix + "-windres");
toolFile.SetExt(suffix);
if(toolFile.FileExists()) AddTool(compiler, "ResourceCompiler", toolFile.GetFullPath());
toolFile.SetFullName(prefix + "-as");
toolFile.SetExt(suffix);
AddTool(compiler, "AS", toolFile.GetFullPath());
toolFile.SetFullName(prefix + "-gdb");
toolFile.SetExt(suffix);
AddTool(compiler, "Debugger", toolFile.GetFullPath());
toolFile.SetFullName("make");
toolFile.SetExt(suffix);
wxString makeExtraArgs;
if(wxThread::GetCPUCount() > 1) {
makeExtraArgs << "-j" << wxThread::GetCPUCount();
}
// XXX Need this on Windows?
// makeExtraArgs << " SHELL=cmd.exe ";
// What to do if there's no make here? (on Windows)
if(toolFile.FileExists()) AddTool(compiler, "MAKE", toolFile.GetFullPath(), makeExtraArgs);
}
示例11: AddTools
void CompilerLocatorGCC::AddTools(CompilerPtr compiler,
const wxString& binFolder,
const wxString& suffix)
{
wxFileName masterPath(binFolder, "");
wxString defaultBinFolder = "/usr/bin";
compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
compiler->SetInstallationPath( binFolder );
CL_DEBUG("Found GNU GCC compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
wxFileName toolFile(binFolder, "");
// ++++-----------------------------------------------------------------
// With XCode installation, only
// g++, gcc, and make are installed under the Xcode installation folder
// the rest (mainly ar and as) are taken from /usr/bin
// ++++-----------------------------------------------------------------
toolFile.SetFullName("g++");
AddTool(compiler, "CXX", toolFile.GetFullPath(), suffix);
AddTool(compiler, "LinkerName", toolFile.GetFullPath(), suffix);
#ifndef __WXMAC__
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), suffix, "-shared -fPIC");
#else
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), suffix, "-dynamiclib -fPIC");
#endif
toolFile.SetFullName("gcc");
AddTool(compiler, "CC", toolFile.GetFullPath(), suffix);
toolFile.SetFullName("make");
wxString makeExtraArgs;
if ( wxThread::GetCPUCount() > 1 ) {
makeExtraArgs << "-j" << wxThread::GetCPUCount();
}
AddTool(compiler, "MAKE", toolFile.GetFullPath(), "", makeExtraArgs);
// ++++-----------------------------------------------------------------
// From this point on, we use /usr/bin only
// ++++-----------------------------------------------------------------
toolFile.AssignDir( defaultBinFolder );
toolFile.SetFullName("ar");
AddTool(compiler, "AR", toolFile.GetFullPath(), "", "rcu");
toolFile.SetFullName("windres");
AddTool(compiler, "ResourceCompiler", "", "");
toolFile.SetFullName("as");
AddTool(compiler, "AS", toolFile.GetFullPath(), "");
}
示例12: AddTools
void CompilerLocatorMinGW::AddTools(CompilerPtr compiler, const wxString& binFolder, const wxString& name)
{
wxFileName masterPath(binFolder, "");
masterPath.RemoveLastDir();
if ( m_locatedFolders.count(masterPath.GetPath()) ) {
return;
}
m_locatedFolders.insert( masterPath.GetPath() );
if ( name.IsEmpty() ) {
compiler->SetName("MinGW ( " + masterPath.GetDirs().Last() + " )");
} else {
compiler->SetName("MinGW ( " + name + " )");
}
CL_DEBUG("Found MinGW compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
wxFileName toolFile(binFolder, "");
toolFile.SetFullName("g++.exe");
AddTool(compiler, "CXX", toolFile.GetFullPath());
AddTool(compiler, "LinkerName", toolFile.GetFullPath());
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");
toolFile.SetFullName("gcc.exe");
AddTool(compiler, "CC", toolFile.GetFullPath());
toolFile.SetFullName("ar.exe");
AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");
toolFile.SetFullName("windres.exe");
AddTool(compiler, "ResourceCompiler", toolFile.GetFullPath());
toolFile.SetFullName("as.exe");
AddTool(compiler, "AS", toolFile.GetFullPath());
toolFile.SetFullName("make.exe");
if ( toolFile.FileExists() ) {
AddTool(compiler, "MAKE", toolFile.GetFullPath());
} else {
toolFile.SetFullName("mingw32-make.exe");
if ( toolFile.FileExists() ) {
AddTool(compiler, "MAKE", toolFile.GetFullPath());
}
}
}
示例13: AddTools
void CompilerLocatorCLANG::AddTools(CompilerPtr compiler, const wxString &installFolder)
{
compiler->SetInstallationPath( installFolder );
wxFileName toolFile(installFolder, "");
toolFile.AppendDir("bin");
#ifdef __WXMSW__
toolFile.SetExt("exe");
#endif
toolFile.SetName("clang++");
AddTool(compiler, "CXX", toolFile.GetFullPath());
AddTool(compiler, "LinkerName", toolFile.GetFullPath());
#ifdef __WXMAC__
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-dynamiclib -fPIC");
#else
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");
#endif
toolFile.SetName("clang");
AddTool(compiler, "CC", toolFile.GetFullPath());
// Add the archive tool
toolFile.SetName("llvm-ar");
if ( toolFile.FileExists() ) {
AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");
} else {
toolFile.SetName("ar");
AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");
}
#ifdef __WXMSW__
AddTool(compiler, "ResourceCompiler", "windres.exe");
#else
AddTool(compiler, "ResourceCompiler", "");
#endif
// Add the assembler tool
toolFile.SetName("llvm-as");
if ( toolFile.FileExists() ) {
AddTool(compiler, "AS", toolFile.GetFullPath());
} else {
toolFile.SetName("as");
AddTool(compiler, "AS", toolFile.GetFullPath());
}
wxString makeExtraArgs;
if ( wxThread::GetCPUCount() > 1 ) {
makeExtraArgs << "-j" << wxThread::GetCPUCount();
}
#ifdef __WXMSW__
AddTool(compiler, "MAKE", "mingw32-make.exe", makeExtraArgs);
#else
AddTool(compiler, "MAKE", "make", makeExtraArgs);
#endif
}
示例14: wxMessageBox
bool AdvancedDlg::CreateNewCompiler(const wxString& name, const wxString& copyFrom)
{
if(BuildSettingsConfigST::Get()->IsCompilerExist(name)) {
wxMessageBox(_("A compiler with this name already exists"), _("Error"), wxOK | wxICON_HAND);
return false;
}
CompilerPtr cmp;
if(!copyFrom.IsEmpty()) {
cmp = BuildSettingsConfigST::Get()->GetCompiler(copyFrom);
} else {
cmp = BuildSettingsConfigST::Get()->GetCompiler(name);
}
cmp->SetName(name);
BuildSettingsConfigST::Get()->SetCompiler(cmp);
return true;
}
示例15: clang
CompilerPtr CompilerLocatorCLANG::Locate(const wxString& folder)
{
m_compilers.clear();
wxFileName clang(folder, "clang");
#ifdef __WXMSW__
clang.SetExt("exe");
#endif
bool found = clang.FileExists();
if ( ! found ) {
// try to see if we have a bin folder here
clang.AppendDir("bin");
found = clang.FileExists();
}
if ( found ) {
CompilerPtr compiler( new Compiler(NULL) );
compiler->SetCompilerFamily(COMPILER_FAMILY_CLANG);
// get the compiler version
compiler->SetName( GetCompilerFullName(clang.GetFullPath() ) );
compiler->SetGenerateDependeciesFile(true);
m_compilers.push_back( compiler );
clang.RemoveLastDir();
AddTools(compiler, clang.GetPath());
// Update the toolchain (if Windows)
#ifdef __WXMSW__
CompilerPtr defaultMinGWCmp = BuildSettingsConfigST::Get()->GetDefaultCompiler(COMPILER_FAMILY_MINGW);
if ( defaultMinGWCmp ) {
compiler->SetTool("MAKE", defaultMinGWCmp->GetTool("MAKE"));
compiler->SetTool("ResourceCompiler", defaultMinGWCmp->GetTool("ResourceCompiler"));
// Update the include paths
IncludePathLocator locator(NULL);
wxArrayString includePaths, excludePaths;
locator.Locate(includePaths, excludePaths, false, defaultMinGWCmp->GetTool("CXX"));
// Convert the include paths to semi colon separated list
wxString mingwIncludePaths = wxJoin(includePaths, ';');
compiler->SetGlobalIncludePath( mingwIncludePaths );
}
#endif
return compiler;
}
return NULL;
}