void QMakePlugin::OnBuildStarting(clBuildEvent& event) { // call Skip() to allow the standard compilation to take place event.Skip(); QmakePluginData::BuildConfPluginData bcpd; wxString project = event.GetProjectName(); wxString config = event.GetConfigurationName(); if(!DoGetData(project, config, bcpd)) { return; } if(!bcpd.m_enabled) { return; } // OK this is a qmake project event.Skip(false); wxString errMsg; ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg); if(!p) { return; } QMakeProFileGenerator generator(m_mgr, project, config); if(!wxFileName::Exists(generator.GetProFileName())) { // alert and return ::wxMessageBox(_("Could not locate pro file.\nDid you remember to run qmake? (right click on the project"), "QMake", wxICON_WARNING | wxCENTER); return; } else { event.Skip(); } }
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(); }
void QMakePlugin::OnBuildStarting(clBuildEvent& event) { // call Skip() to allow the standard compilation to take place event.Skip(); QmakePluginData::BuildConfPluginData bcpd; wxString project = event.GetProjectName(); wxString config = event.GetConfigurationName(); if ( !DoGetData(project, config, bcpd) ) { return; } if ( !bcpd.m_enabled ) { return; } wxString errMsg; ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg); if ( !p ) { return; } QMakeProFileGenerator generator(m_mgr, project, config); // regenrate the .pro file bool needRegeneration = generator.Generate(); 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; { wxSetWorkingDirectory ( p->GetFileName().GetPath(wxPATH_GET_SEPARATOR|wxPATH_GET_VOLUME) ); wxSetEnv(wxT("QTDIR"), qtdir); qmake_exe_line << wxT("\"") << qmake_exe << wxT("\" -spec ") << qmakespec << wxT(" ") << generator.GetProFileName(); if ( needRegeneration ) { wxArrayString output; ProcUtils::SafeExecuteCommand(qmake_exe_line, output); } } }
void QMakePlugin::OnGetIsPluginMakefile(clBuildEvent& event) { QmakePluginData::BuildConfPluginData bcpd; wxString project = event.GetProjectName(); wxString config = event.GetConfigurationName(); if ( !DoGetData(project, config, bcpd) ) { event.Skip(); return; } if ( bcpd.m_enabled ) { // return without calling event.Skip() return; } event.Skip(); }
void QMakePlugin::OnGetCleanCommand(clBuildEvent& event) { QmakePluginData::BuildConfPluginData bcpd; wxString project = event.GetProjectName(); wxString config = event.GetConfigurationName(); if ( !DoGetData(project, config, bcpd) ) { event.Skip(); return; } if ( !bcpd.m_enabled ) { event.Skip(); return; } event.SetCommand( DoGetBuildCommand(project, config, event.IsProjectOnly()) + wxT(" clean") ); }
void QMakePlugin::OnGetBuildCommand(clBuildEvent& event) { QmakePluginData::BuildConfPluginData bcpd; wxString project = event.GetProjectName(); wxString config = event.GetConfigurationName(); if ( !DoGetData(project, config, bcpd) ) { event.Skip(); return; } if ( !bcpd.m_enabled ) { event.Skip(); return; } // we avoid calling event.Skip() to override the default build system by this one event.SetCommand( DoGetBuildCommand(project, config, event.IsProjectOnly()) ); }