void MemCheckPlugin::CheckProject(const wxString& projectName) { if(m_terminal.IsRunning()) { ::wxMessageBox(_("Another instance is already running. Please stop it before executing another one"), "CodeLite", wxICON_WARNING | wxCENTER | wxOK); return; } wxString errMsg; ProjectPtr project = m_mgr->GetWorkspace()->FindProjectByName(projectName, errMsg); wxString path = project->GetFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); wxString wd; wxString command = m_mgr->GetProjectExecutionCommand(projectName, wd); DirSaver ds; EnvSetter envGuard(m_mgr->GetEnv()); wxSetWorkingDirectory(path); wxSetWorkingDirectory(wd); m_mgr->AppendOutputTabText(kOutputTab_Output, _("Launching MemCheck...\n")); m_mgr->AppendOutputTabText(kOutputTab_Output, wxString() << _("Working directory is set to: ") << ::wxGetCwd() << "\n"); m_mgr->AppendOutputTabText(kOutputTab_Output, wxString() << "MemCheck command: " << m_memcheckProcessor->GetExecutionCommand(command) << "\n"); wxString cmd = m_memcheckProcessor->GetExecutionCommand(command); m_terminal.ExecuteConsole(cmd, "", true, wxString::Format("MemCheck: %s", projectName)); }
void ExternalToolsPlugin::DoLaunchTool(const ToolInfo& ti) { wxString command, working_dir; command << wxT("\"") << ti.GetPath() << wxT("\" ") << ti.GetArguments(); working_dir = ti.GetWd(); if (m_mgr->IsWorkspaceOpen()) { command = m_mgr->GetMacrosManager()->Expand(command, m_mgr, m_mgr->GetSolution()->GetActiveProjectName()); working_dir = m_mgr->GetMacrosManager()->Expand(working_dir, m_mgr, m_mgr->GetSolution()->GetActiveProjectName()); } // check to see if we require to save all files before continuing if (ti.GetSaveAllFiles() && !m_mgr->SaveAll()) return; if (ti.GetCaptureOutput() == false) { // change the directory to the requested working directory DirSaver ds; wxSetWorkingDirectory(working_dir); // apply environment EnvSetter envGuard(m_mgr->GetEnv()); wxExecute(command); } else { // create a piped process if (m_pipedProcess && m_pipedProcess->IsBusy()) { // a process is already running return; } m_pipedProcess = new AsyncExeCmd(m_mgr->GetOutputWindow()); DirSaver ds; EnvSetter envGuard(m_mgr->GetEnv()); wxSetWorkingDirectory(working_dir); // hide console if any, // redirect output m_pipedProcess->Execute(command, true, true); if (m_pipedProcess->GetProcess()) { m_pipedProcess->GetProcess()->Connect(wxEVT_END_PROCESS, wxProcessEventHandler(ExternalToolsPlugin::OnProcessEnd), NULL, this); } } }
void QMakePlugin::OnExportMakefile(wxCommandEvent& event) { if(m_qmakeProcess) return; QmakePluginData::BuildConfPluginData bcpd; ProjectPtr pProj = m_mgr->GetSelectedProject(); CHECK_PTR_RET(pProj); BuildConfigPtr bldConf = pProj->GetBuildConfiguration(); CHECK_PTR_RET(bldConf); wxString project = pProj->GetName(); wxString config = bldConf->GetName(); if(!DoGetData(project, config, bcpd)) { event.Skip(); return; } if(bcpd.m_enabled) { // This project/configuration is qmake project QMakeProFileGenerator generator(m_mgr, project, config); // Regenerate the .pro file generator.Generate(); // run qmake wxString qmake_exe = m_conf->Read(wxString::Format(wxT("%s/qmake"), bcpd.m_qmakeConfig.c_str())); wxString qmakespec = m_conf->Read(wxString::Format(wxT("%s/qmakespec"), bcpd.m_qmakeConfig.c_str())); wxString qtdir = m_conf->Read(wxString::Format(wxT("%s/qtdir"), bcpd.m_qmakeConfig.c_str())); // Create qmake comand wxString qmake_exe_line; qmake_exe.Trim().Trim(false); qmakespec.Trim().Trim(false); // Set QTDIR DirSaver ds; { wxString errMsg; ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg); if(!p) { return; } qmake_exe_line << wxT("\"") << qmake_exe << wxT("\" -spec ") << qmakespec << wxT(" ") << generator.GetProFileName(); wxStringMap_t om; om.insert(std::make_pair("QTDIR", qtdir)); EnvSetter envGuard(NULL, &om, project, config); m_mgr->ClearOutputTab(kOutputTab_Build); m_mgr->AppendOutputTabText(kOutputTab_Build, wxString() << "-- " << qmake_exe_line << "\n"); m_qmakeProcess = ::CreateAsyncProcess(this, qmake_exe_line, IProcessCreateDefault, p->GetFileName().GetPath()); } } event.Skip(); }