bool MSVC10Loader::Open(const wxString& filename) { LogManager* pMsg = Manager::Get()->GetLogManager(); if (!pMsg) return false; m_ConvertSwitches = m_pProject->GetCompilerID().IsSameAs(_T("gcc")); m_ProjectName = wxFileName(filename).GetName(); pMsg->DebugLog(F(_("Importing MSVC 10.xx project: %s"), filename.wx_str())); TiXmlDocument doc(filename.mb_str()); if (!doc.LoadFile()) return false; pMsg->DebugLog(_("Parsing project file...")); const TiXmlElement* root = doc.FirstChildElement("Project"); if (!root) { pMsg->DebugLog(_("Not a valid MS Visual Studio project file...")); return false; } // initialisation of the project m_pProject->ClearAllProperties(); m_pProject->SetModified(true); bool bResult = GetProjectGlobals(root) // get project name & type // get the project list of configuration => 1 configuration = 1 build target in CodeBlocks && GetProjectConfigurations(root); if (!bResult) { pMsg->DebugLog(_("Could not obtain project configurations.")); return false; } if ( !DoSelectConfigurations() ) return true; // user cancelled if ( !DoCreateConfigurations() ) { pMsg->DebugLog(_("Failed to create configurations in the project.")); return false; } // get the project list of files and add them to the targets bResult = GetProjectConfigurationFiles(root) // get the project/target list of includes and add them to the targets && GetProjectIncludes(root) // get the project/target specific settings && GetTargetSpecific(root); return bResult; }
bool MSVC10Loader::Open(const wxString& filename) { LogManager* pMsg = Manager::Get()->GetLogManager(); if (!pMsg) return false; m_ConvertSwitches = m_pProject->GetCompilerID().IsSameAs(_T("gcc")); m_ProjectName = wxFileName(filename).GetName(); if (!MSVC7WorkspaceLoader::g_WorkspacePath.IsEmpty()) { wxFileName tmp(MSVC7WorkspaceLoader::g_WorkspacePath); tmp.MakeRelativeTo(m_pProject->GetBasePath()); m_WorkspacePath = tmp.GetPathWithSep(); } pMsg->DebugLog(F(_("Importing MSVC 10+ project: %s"), filename.wx_str())); TiXmlDocument doc(filename.mb_str()); if (!doc.LoadFile()) return false; pMsg->DebugLog(_("Parsing project file...")); const TiXmlElement* root = doc.FirstChildElement("Project"); if (!root) { pMsg->DebugLog(_("Not a valid MS Visual Studio project file...")); return false; } // initialisation of the project m_pProject->ClearAllProperties(); m_pProject->SetModified(true); if (!m_ConvertSwitches) { // m_pProject->AddCompilerOption(_T("/EHsc")); // default, "/EHs /EHc" works as well m_pProject->AddLinkerOption(_T("/pdb:$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).pdb")); m_pProject->AddIncludeDir(_T(".")); // some projects require it. Implicit with Visual Studio m_pProject->AddResourceIncludeDir(_T(".")); } bool bResult = GetProjectGlobals(root) // get project name & type && GetProjectConfigurations(root); // get the project list of configuration => 1 configuration = 1 build target in CodeBlocks if (!bResult) { pMsg->DebugLog(_("Could not obtain project configurations.")); return false; } if ( !DoSelectConfigurations() ) return true; // user cancelled if ( !DoCreateConfigurations() ) { pMsg->DebugLog(_("Failed to create configurations in the project.")); return false; } bResult = GetProjectConfigurationFiles(root) // get the project list of files and add them to the targets && GetProjectIncludes(root) // get the project/target list of includes and add them to the targets && GetTargetSpecific(root); // get the project/target specific settings return bResult; }