📄 msvc_prj_utils.cpp
字号:
{{ CRef< CFilter_Base::C_FF::C_E > ce(new CFilter_Base::C_FF::C_E()); ce->SetFilter(*(filters_item.m_InlineFiles)); hosted_lib_filter->SetFF().SetFF().push_back(ce); }} {{ CRef< CFilter_Base::C_FF::C_E > ce(new CFilter_Base::C_FF::C_E()); ce->SetFilter(*hosted_lib_filter); m_HostedLibrariesRootFilter->SetFF().SetFF().push_back(ce); }} } m_Vcproj->SetFiles().SetFilter().push_back(m_HostedLibrariesRootFilter);}//-----------------------------------------------------------------------------void AddCustomBuildFileToFilter(CRef<CFilter>& filter, const list<SConfigInfo> configs, const string& project_dir, const SCustomBuildInfo& build_info){ CRef<CFFile> file(new CFFile()); file->SetAttlist().SetRelativePath (CDirEntry::CreateRelativePath(project_dir, build_info.m_SourceFile)); ITERATE(list<SConfigInfo>, n , configs) { // Iterate all configurations const string& config = (*n).m_Name; CRef<CFileConfiguration> file_config(new CFileConfiguration()); file_config->SetAttlist().SetName(ConfigName(config)); CRef<CTool> custom_build(new CTool("")); custom_build->SetAttlist().SetName("VCCustomBuildTool"); custom_build->SetAttlist().SetDescription(build_info.m_Description); custom_build->SetAttlist().SetCommandLine(build_info.m_CommandLine); custom_build->SetAttlist().SetOutputs(build_info.m_Outputs); custom_build->SetAttlist().SetAdditionalDependencies (build_info.m_AdditionalDependencies); file_config->SetTool(*custom_build); file->SetFileConfiguration().push_back(file_config); } CRef< CFilter_Base::C_FF::C_E > ce(new CFilter_Base::C_FF::C_E()); ce->SetFile(*file); filter->SetFF().SetFF().push_back(ce);}bool SameRootDirs(const string& dir1, const string& dir2){ if ( dir1.empty() ) return false; if ( dir2.empty() ) return false; return dir1[0] == dir2[0];}void CreateUtilityProject(const string& name, const list<SConfigInfo>& configs, CVisualStudioProject* project){ {{ //Attributes: project->SetAttlist().SetProjectType (MSVC_PROJECT_PROJECT_TYPE); project->SetAttlist().SetVersion (MSVC_PROJECT_VERSION); project->SetAttlist().SetName (name); project->SetAttlist().SetRootNamespace (MSVC_MASTERPROJECT_ROOT_NAMESPACE); project->SetAttlist().SetKeyword (MSVC_MASTERPROJECT_KEYWORD); }} {{ //Platforms CRef<CPlatform> platform(new CPlatform("")); platform->SetAttlist().SetName(MSVC_PROJECT_PLATFORM); project->SetPlatforms().SetPlatform().push_back(platform); }} ITERATE(list<SConfigInfo>, p , configs) { // Iterate all configurations const string& config = (*p).m_Name; CRef<CConfiguration> conf(new CConfiguration());#define SET_ATTRIBUTE( node, X, val ) node->SetAttlist().Set##X(val) {{ //Configuration SET_ATTRIBUTE(conf, Name, ConfigName(config)); SET_ATTRIBUTE(conf, OutputDirectory, "$(SolutionDir)$(ConfigurationName)"); SET_ATTRIBUTE(conf, IntermediateDirectory, "$(ConfigurationName)"); SET_ATTRIBUTE(conf, ConfigurationType, "10"); SET_ATTRIBUTE(conf, CharacterSet, "2"); SET_ATTRIBUTE(conf, ManagedExtensions, "TRUE"); }} {{ //VCCustomBuildTool CRef<CTool> tool(new CTool("")); SET_ATTRIBUTE(tool, Name, "VCCustomBuildTool" ); conf->SetTool().push_back(tool); }} {{ //VCMIDLTool CRef<CTool> tool(new CTool("")); SET_ATTRIBUTE(tool, Name, "VCMIDLTool" ); conf->SetTool().push_back(tool); }} {{ //VCPostBuildEventTool CRef<CTool> tool(new CTool("")); SET_ATTRIBUTE(tool, Name, "VCPostBuildEventTool" ); conf->SetTool().push_back(tool); }} {{ //VCPreBuildEventTool CRef<CTool> tool(new CTool("")); SET_ATTRIBUTE(tool, Name, "VCPreBuildEventTool" ); conf->SetTool().push_back(tool); }} project->SetConfigurations().SetConfiguration().push_back(conf); } {{ //References project->SetReferences(""); }} {{ //Globals project->SetGlobals(""); }}}string CreateProjectName(const CProjKey& project_id){ switch (project_id.Type()) { case CProjKey::eApp: return project_id.Id() + ".exe"; case CProjKey::eLib: return project_id.Id() + ".lib"; case CProjKey::eDll: return project_id.Id() + ".dll"; case CProjKey::eMsvc: return project_id.Id() + ".vcproj"; default: NCBI_THROW(CProjBulderAppException, eProjectType, project_id.Id()); return ""; }}//-----------------------------------------------------------------------------CBuildType::CBuildType(bool dll_flag) :m_Type(dll_flag? eDll: eStatic){ }CBuildType::EBuildType CBuildType::GetType(void) const{ return m_Type;} string CBuildType::GetTypeStr(void) const{ switch (m_Type) { case eStatic: return "static"; case eDll: return "dll"; } NCBI_THROW(CProjBulderAppException, eProjectType, NStr::IntToString(m_Type)); return "";}//-----------------------------------------------------------------------------CDllSrcFilesDistr::CDllSrcFilesDistr(void){}void CDllSrcFilesDistr::RegisterSource(const string& src_file_path, const CProjKey& dll_project_id, const CProjKey& lib_project_id){ m_SourcesMap[ TDllSrcKey(src_file_path,dll_project_id) ] = lib_project_id;}void CDllSrcFilesDistr::RegisterHeader(const string& hdr_file_path, const CProjKey& dll_project_id, const CProjKey& lib_project_id){ m_HeadersMap[ TDllSrcKey(hdr_file_path,dll_project_id) ] = lib_project_id;}void CDllSrcFilesDistr::RegisterInline(const string& inl_file_path, const CProjKey& dll_project_id, const CProjKey& lib_project_id){ m_InlinesMap[ TDllSrcKey(inl_file_path,dll_project_id) ] = lib_project_id;}CProjKey CDllSrcFilesDistr::GetSourceLib(const string& src_file_path, const CProjKey& dll_project_id) const{ TDllSrcKey key(src_file_path, dll_project_id); TDistrMap::const_iterator p = m_SourcesMap.find(key); if (p != m_SourcesMap.end()) { const CProjKey& lib_id = p->second; return lib_id; } return CProjKey();}CProjKey CDllSrcFilesDistr::GetHeaderLib(const string& hdr_file_path, const CProjKey& dll_project_id) const{ TDllSrcKey key(hdr_file_path, dll_project_id); TDistrMap::const_iterator p = m_HeadersMap.find(key); if (p != m_HeadersMap.end()) { const CProjKey& lib_id = p->second; return lib_id; } return CProjKey();}CProjKey CDllSrcFilesDistr::GetInlineLib(const string& inl_file_path, const CProjKey& dll_project_id) const{ TDllSrcKey key(inl_file_path, dll_project_id); TDistrMap::const_iterator p = m_InlinesMap.find(key); if (p != m_InlinesMap.end()) { const CProjKey& lib_id = p->second; return lib_id; } return CProjKey();}END_NCBI_SCOPE/* * =========================================================================== * $Log: msvc_prj_utils.cpp,v $ * Revision 1000.3 2004/06/16 17:02:32 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.31 * * Revision 1.31 2004/06/15 19:01:08 gorelenk * Changed CGuidGenerator::Generate12Chars to fix compilation errors on * GCC 2.95. * * Revision 1.30 2004/06/14 20:59:23 gorelenk * Added *correct* conversion from streampos to size_t . * * Revision 1.29 2004/06/14 20:41:20 gorelenk * Changed PromoteIfDifferent : added conversion state to avoid compilation * errors on GCC 3.3.3 . * * Revision 1.28 2004/06/14 19:19:08 gorelenk * Changed definition of enum in CBuildType . * * Revision 1.27 2004/06/14 18:02:29 gorelenk * Changed size_t to streampos in PromoteIfDifferent . * * Revision 1.26 2004/06/08 16:32:25 gorelenk * Added static functions s_IsPrivateHeader and s_IsImplHeader. * Changed imlementation of SFiltersItem ( to take into account * new struct members ). Changed implementation of classes * CBasicProjectsFilesInserter and CDllProjectFilesInserter. * * Revision 1.25 2004/05/26 17:59:07 gorelenk * Old inserter -> CSrcToFilterInserterWithPch. * Implemented CBasicProjectsFilesInserter and CDllProjectFilesInserter . * * Revision 1.24 2004/05/21 21:41:41 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.23 2004/05/17 16:14:17 gorelenk * Implemented class CDllSrcFilesDistr . * * Revision 1.22 2004/05/17 14:40:30 gorelenk * Changed implementation of CSourceFileToProjectInserter::operator(): * get rid of hard-coded define for PCH usage. * * Revision 1.21 2004/05/13 16:15:24 gorelenk * Changed CSourceFileToProjectInserter::operator() . * * Revision 1.20 2004/05/10 19:53:43 gorelenk * Changed CreateProjectName . * * Revision 1.19 2004/05/10 14:29:03 gorelenk * Implemented CSourceFileToProjectInserter . * * Revision 1.18 2004/04/22 18:15:38 gorelenk * Changed implementation of SourceFileExt . * * Revision 1.17 2004/03/10 16:42:44 gorelenk * Changed implementation of class CMsvc7RegSettings. * * Revision 1.16 2004/03/02 23:32:54 gorelenk * Added implemetation of class CBuildType member-functions. * * Revision 1.15 2004/02/20 22:53:26 gorelenk * Added analysis of ASN projects depends. * * Revision 1.14 2004/02/13 20:39:51 gorelenk * Minor cosmetic changes. * * Revision 1.13 2004/02/12 23:15:29 gorelenk * Implemented utility projects creation and configure re-build of the app. * * Revision 1.12 2004/02/12 16:27:57 gorelenk * Changed generation of command line for datatool. * * Revision 1.11 2004/02/10 18:09:12 gorelenk * Added definitions of functions SaveIfNewer and PromoteIfDifferent * - support for file overwriting only if it was changed. * * Revision 1.10 2004/02/06 23:14:59 gorelenk * Implemented support of ASN projects, semi-auto configure, * CPPFLAGS support. Second working version. * * Revision 1.9 2004/02/05 16:29:49 gorelenk * GetComponents was moved to class CMsvcSite. * * Revision 1.8 2004/02/04 23:35:17 gorelenk * Added definition of functions GetComponents and SameRootDirs. * * Revision 1.7 2004/02/03 17:19:04 gorelenk * Changed implementation of class CMsvc7RegSettings. * Added implementation of function GetComponents. * * Revision 1.6 2004/01/30 20:46:55 gorelenk * Added support of ASN projects. * * Revision 1.5 2004/01/28 17:55:49 gorelenk * += For msvc makefile support of : * Requires tag, ExcludeProject tag, * AddToProject section (SourceFiles and IncludeDirs), * CustomBuild section. * += For support of user local site. * * Revision 1.4 2004/01/26 19:27:28 gorelenk * += MSVC meta makefile support * += MSVC project makefile support * * Revision 1.3 2004/01/22 17:57:54 gorelenk * first version * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -