Attached Files | cmLocalVisualStudio7Generator.h.recursiv_directories.diff [^] (813 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]36a37,49
> struct graph_node
> {
> const std::string* name;
> graph_node* parent;
> std::set< const graph_node* > childs;
> int child_sources;
> const cmSourceGroup* sg;
>
> graph_node() : name(0), sg(0), parent(0), child_sources(0) {}
> };
> typedef std::map< std::string, graph_node > t_Hierarchy;
> typedef std::set< const graph_node* > t_GraphNodeSet;
>
107a121
>
109a124,128
>
> void WriteGroup( std::ostream& fout, const char *libName, cmTarget &target, const graph_node &sgn );
>
> void WriteGroupFiles( std::ostream& fout, const char *libName, cmTarget &target, const std::vector<const cmSourceFile *> &sourceFiles );
>
113c132
< void WriteVCProjEndGroup(std::ostream& fout);
---
> void WriteVCProjEndGroup(std::ostream& fout, const char* group );
cmLocalVisualStudio7Generator.cxx.recursiv_directories.diff [^] (5,330 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]839a840,855
> static void split_string( std::vector< std::string > &splits, const std::string &s, const char* set )
> {
> splits.clear();
> int off = 0, next;
> while(1)
> {
> next = s.find_first_of( set, off );
> if( std::string::npos==next )
> {
> if( s.begin()+off < s.end() ) splits.push_back( std::string( s.begin()+off, s.end() ) );
> break;
> }
> splits.push_back( std::string( s.begin()+off, s.begin()+next ) );
> off = next+1;
> }
> }
891,892c907,912
< for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin();
< sg != sourceGroups.end(); ++sg)
---
> t_Hierarchy sg_hierarchy;
> std::string sg_name;
> std::vector< std::string > sg_name_spit;
>
> int ii=0;
> for( std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); sg != sourceGroups.end(); ++sg, ++ii )
894,897c914,947
< const std::vector<const cmSourceFile *> &sourceFiles =
< sg->GetSourceFiles();
< // If the group is empty, don't write it at all.
< if(sourceFiles.empty())
---
> sg_name = sg->GetName();
> t_Hierarchy::iterator hit = sg_hierarchy.find( sg_name );
> if( hit==sg_hierarchy.end() )
> {
> sg_hierarchy.insert( std::make_pair( sg_name, graph_node() ) );
> hit = sg_hierarchy.find( sg_name );
> hit->second.name = &hit->first;
> }
> graph_node* gn = &hit->second;
> int sources = sg->GetSourceFiles().size();
> gn->sg = &*sg;
> gn->child_sources += sources;
>
> while(1)
> {
> int off = sg_name.find_last_of( "\\/" );
> if( std::string::npos==off ) break;
> sg_name.resize( off );
>
> t_Hierarchy::iterator shit = sg_hierarchy.find( sg_name );
> if( shit==sg_hierarchy.end() )
> {
> sg_hierarchy.insert( std::make_pair( sg_name, graph_node() ) );
> shit = sg_hierarchy.find( sg_name );
> shit->second.name = &shit->first;
> }
> gn->parent = &shit->second;
> shit->second.childs.insert( gn );
> gn = &hit->second;
> gn->child_sources += sources;
> }
> }
>
> for( t_Hierarchy::const_iterator sg = sg_hierarchy.begin(); sg != sg_hierarchy.end(); ++sg )
899c949,954
< continue;
---
> if( 0==sg->second.parent ) this->WriteGroup( fout, libName, target, sg->second );
> }
> fout << "\t</Files>\n";
>
> // Write the VCProj file's footer.
> this->WriteVCProjFooter(fout);
901a957,963
> void cmLocalVisualStudio7Generator::WriteGroup( std::ostream& fout, const char *libName, cmTarget &target, const graph_node &sgn )
> {
> // If the group is empty, don't write it at all.
> if( 0==sgn.child_sources ) return;
>
> std::string name = *sgn.name;
>
903d964
< std::string name = sg->GetName();
905a967,969
> int off = name.find_last_of("\\/");
> if( off!=std::string::npos ) name = std::string( name.begin()+off+1, name.end() );
>
908a973,999
> for( t_GraphNodeSet::const_iterator psg = sgn.childs.begin(); psg != sgn.childs.end(); ++psg )
> {
> this->WriteGroup( fout, libName, target, **psg );
> }
>
> if( sgn.sg )
> {
> const std::vector<const cmSourceFile *> &sourceFiles = sgn.sg->GetSourceFiles();
> this->WriteGroupFiles( fout, libName, target, sourceFiles );
> }
>
> // If the group has a name, write the footer.
> if(name != "")
> {
> this->WriteVCProjEndGroup(fout,name.c_str());
> }
> }
>
> bool orderSourceFiles( const cmSourceFile* a, const cmSourceFile* b )
> {
> int v1 = a->GetSourceName().compare( b->GetSourceName() );
> if( 0==v1 ) v1 = a->GetSourceExtension().compare( b->GetSourceExtension() );
> return 0>=v1;
> }
>
> void cmLocalVisualStudio7Generator::WriteGroupFiles( std::ostream& fout, const char *libName, cmTarget &target, const std::vector<const cmSourceFile *> &c_sourceFiles )
> {
909a1001,1003
> std::vector<const cmSourceFile *> sourceFiles = c_sourceFiles;
> std::sort( sourceFiles.begin(), sourceFiles.end(), orderSourceFiles );
>
923a1018,1024
>
> std::string excluded_from_build;
> if( (*sf)->GetPropertyAsBool("EXCLUDED_FROM_BUILD") )
> {
> excluded_from_build = " ExcludedFromBuild=\"TRUE\"";
> }
>
975a1077,1080
> // get the configurations
> std::vector<std::string> *configs =
> static_cast<cmGlobalVisualStudio7Generator *>
> (m_GlobalGenerator)->GetConfigurations();
980c1085
< << "\t\t\t\t\tName=\"" << *i << "|Win32\">\n"
---
> << "\t\t\t\t\tName=\"" << *i << "|Win32\"" << excluded_from_build << ">\n"
1000,1010d1104
<
< // If the group has a name, write the footer.
< if(name != "")
< {
< this->WriteVCProjEndGroup(fout);
< }
< }
< fout << "\t</Files>\n";
<
< // Write the VCProj file's footer.
< this->WriteVCProjFooter(fout);
1013d1106
<
1105a1199,1206
> const char* t = group;
> while( 1 )
> {
> int n = strcspn( t, "\\/" );
> if( 0==t[n] ) break;
> t += n+1;
> }
>
1107c1208
< << "\t\t\tName=\"" << group << "\"\n"
---
> << "\t\t\tName=\"" << t << "\"\n"
1112c1213
< void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
---
> void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout, const char* group)
recursive_directories.example.cmake [^] (338 bytes) 1969-12-31 19:00 |