]> git.tdb.fi Git - builder.git/commitdiff
Use Path objects to store include and library paths
authorMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 14:13:42 +0000 (17:13 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:54 +0000 (00:08 +0300)
source/binary.cpp
source/binarypackage.cpp
source/buildinfo.h
source/component.cpp
source/csourcefile.cpp
source/gnucompiler.cpp
source/gnulinker.cpp
source/pkgconfiggenerator.cpp
source/virtualfilesystem.h

index 421697d623fe9226d40777f9e31b9343eb20299c..957d233d65ec3bff179d3e93703b5f5af1c57e7e 100644 (file)
@@ -41,9 +41,9 @@ void Binary::find_depends()
                const Component *c = queue.front();
                queue.erase(queue.begin());
 
-               const StringList &libpath = c->get_build_info().libpath;
+               const BuildInfo::PathList &libpath = c->get_build_info().libpath;
 
-               const list<string> &libs = c->get_build_info().libs;
+               const BuildInfo::WordList &libs = c->get_build_info().libs;
                for(StringList::const_iterator i=libs.begin(); i!=libs.end(); ++i)
                {
                        Target *lib = builder.get_vfs().find_library(*i, libpath, libmode);
index 8c3571d103ac4fb9cc955e7178d3a8b745d26d95..cc90c0af4f5b26d70747938d481fd12af99bd455 100644 (file)
@@ -20,13 +20,13 @@ void BinaryPackage::set_path(const FS::Path &p)
 
 void BinaryPackage::create_build_info()
 {
-       for(StringList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i)
-               if((*i)[0]=='@')
-                       *i = (path/i->substr(1)).str();
+       for(BuildInfo::PathList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i)
+               if((*i)[0]=="@")
+                       *i = path/i->subpath(1);
 
-       for(StringList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
-               if((*i)[0]=='@')
-                       *i = (path/i->substr(1)).str();
+       for(BuildInfo::PathList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
+               if((*i)[0]=="@")
+                       *i = path/i->subpath(1);
 }
 
 BinaryPackage *BinaryPackage::from_flags(Builder &builder, const std::string &name, const vector<string> &flags)
index 297efff1df0c915ee4d51a31d831d0051ed58293..144a16dabb0e1e3215290745566b827bb63b220e 100644 (file)
@@ -33,12 +33,14 @@ public:
        };
 
        typedef std::map<std::string, std::string> DefineMap;
+       typedef std::list<Msp::FS::Path> PathList;
+       typedef std::list<std::string> WordList;
 
        DefineMap defines;
-       StringList incpath;
-       StringList libpath;
-       StringList libs;
-       StringList warnings;
+       PathList incpath;
+       PathList libpath;
+       WordList libs;
+       WordList warnings;
        bool threads;
        bool debug;
        int optimize;
index 5c859f7eaf80e01d0734f0d3fc4de4891be736c1..11d2925d83514ce4849f08fcff0bf6a9d92c8f9e 100644 (file)
@@ -61,9 +61,9 @@ void Component::create_build_info()
 
        build_info.update_from(pkg.get_build_info());
 
-       for(StringList::iterator i=build_info.incpath.begin(); i!=build_info.incpath.end(); ++i)
+       for(BuildInfo::PathList::iterator i=build_info.incpath.begin(); i!=build_info.incpath.end(); ++i)
                *i = (pkg.get_source() / *i).str();
-       for(StringList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i)
+       for(BuildInfo::PathList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i)
                *i = (pkg.get_source() / *i).str();
 
        if(pkg.get_library_mode()!=DYNAMIC)
index d3cb807a781cc1f35cefafa8ece08079ee126f94..0ff4286c5cb87bb6270a5978c304c8969c29bed0 100644 (file)
@@ -49,8 +49,8 @@ void CSourceFile::find_depends()
                deps_cache.set_deps(relname, includes);
        }
 
-       const StringList &incpath = comp->get_build_info().incpath;
-       StringList local_incpath = incpath;
+       const BuildInfo::PathList &incpath = comp->get_build_info().incpath;
+       BuildInfo::PathList local_incpath = incpath;
        local_incpath.push_front(FS::dirname(path).str());
 
        for(list<string>::iterator i=includes.begin(); i!=includes.end(); ++i)
index 6989e2d3a40e3af4fdc7cffacb07c57bdbe0ec4d..5ecd29307fc9ac8339cc95090dddaf228e6beaed 100644 (file)
@@ -44,10 +44,10 @@ Task *GnuCompiler::run(const Target &target) const
        argv.push_back("-c");
 
        const BuildInfo &binfo = comp.get_build_info();
-       for(list<string>::const_iterator i=binfo.warnings.begin(); i!=binfo.warnings.end(); ++i)
+       for(BuildInfo::WordList::const_iterator i=binfo.warnings.begin(); i!=binfo.warnings.end(); ++i)
                argv.push_back("-W"+*i);
-       for(list<string>::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
-               argv.push_back("-I"+*i);
+       for(BuildInfo::PathList::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
+               argv.push_back("-I"+i->str());
        for(BuildInfo::DefineMap::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
        {
                if(i->second.empty())
index ee4f02dd2fd520bd4e05402b596dbcd718601eae..52ae0f3ea45a90a97108435f27edc573e31e5c86 100644 (file)
@@ -91,8 +91,8 @@ Task *GnuLinker::run(const Target &target) const
                argv.push_back("-static");
 
        const BuildInfo &binfo = comp.get_build_info();
-       for(list<string>::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
-               argv.push_back("-L"+*i);
+       for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
+               argv.push_back("-L"+i->str());
        if(binfo.strip)
                argv.push_back("-s");
        if(binfo.threads)
index 827f62d4cff20ec108aab4ebc9e439f8abee1b61..f29ae4a73b9c6373a70741a7180fcb47f15b7b39 100644 (file)
@@ -52,16 +52,16 @@ void PkgConfigGenerator::Worker::main()
 
        const BuildInfo &binfo = spkg.get_exported_binfo();
        IO::print(out, "Libs:");
-       for(StringList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
+       for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
                IO::print(out, " -L%s", FS::relative(*i, builder.get_prefix()).str());
-       for(StringList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
+       for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
                IO::print(out, " -l%s", *i);
        if(binfo.threads)
                out.write("-pthread");
        out.put('\n');
 
        IO::print(out, "Cflags:");
-       for(StringList::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
+       for(BuildInfo::PathList::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
                IO::print(out, " -I%s", FS::relative(*i, builder.get_prefix()).str());
        for(BuildInfo::DefineMap::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
                if(i->second.empty())
index f0cb7383fc9e26ea093d558cbb5bc2885d574f89..362d5db8674f836c2ff01a4bfc9a176251dd095d 100644 (file)
@@ -17,10 +17,10 @@ possible to build them.
 class VirtualFileSystem
 {
 public:
-       typedef std::list<std::string> SearchPath;
+       typedef std::list<Msp::FS::Path> SearchPath;
 
 private:
-       typedef std::map<std::string, FileTarget *> TargetMap;
+       typedef std::map<Msp::FS::Path, FileTarget *> TargetMap;
 
        Builder &builder;
        TargetMap targets;