X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvirtualfilesystem.h;h=4aa20d4b158d1ac8985a46b0383d6c00938b2276;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=f0cb7383fc9e26ea093d558cbb5bc2885d574f89;hpb=2f1e3b296bb8a2c4fcb73d7339cf7d0d6f9d1459;p=builder.git diff --git a/source/virtualfilesystem.h b/source/virtualfilesystem.h index f0cb738..4aa20d4 100644 --- a/source/virtualfilesystem.h +++ b/source/virtualfilesystem.h @@ -1,13 +1,16 @@ #ifndef VIRTUALFILESYSTEM_H_ #define VIRTUALFILESYSTEM_H_ -#include #include +#include +#include #include +#include "buildinfo.h" class Builder; class FileTarget; class Pattern; +class Tool; /** Provides access to the filesystem in a way that takes known targets into @@ -17,18 +20,19 @@ possible to build them. class VirtualFileSystem { public: - typedef std::list SearchPath; + using SearchPath = std::vector; private: - typedef std::map TargetMap; - Builder &builder; - TargetMap targets; + std::map targets; std::set nonexistent; + SearchPath sys_bin_path; public: VirtualFileSystem(Builder &); + /** Gets an existing target associated with a path. If no target has claimed + that path, 0 is returned. */ FileTarget *get_target(const Msp::FS::Path &) const; /** Registers a target with the VFS. A target may be registered at multiple @@ -36,14 +40,21 @@ public: void register_path(const Msp::FS::Path &, FileTarget *); /** Locates a source file. If a file is found but no target is associated - with it, a new package-less target is created with the appropriate tool. */ - FileTarget *find_header(const std::string &, const SearchPath &); + with it, a new package-less target is created with the appropriate tool. If + use_syspath is true, the system path reported by the tool is also searched. */ + FileTarget *find_header(const std::string &, Tool *, const SearchPath &, bool use_syspath = true); /** Locates a library. The library name should be the same as what would be used in linking with the library. If a file is found but no target is associated with it, a new package-less target of appropriate type is - created. */ - FileTarget *find_library(const std::string &, const SearchPath &, LibMode); + created. If use_syspath is true, the system path reported by the LINK tool + is also searched. */ + FileTarget *find_library(const std::string &, const SearchPath &, BuildInfo::LibraryMode, bool use_syspath = true); + + /** Locates a binary. The normal search path for binaries is used (usually + this means the PATH environment variable). If a file is found but no target + is associated with it, a new package-less Executable target is created. */ + FileTarget *find_binary(const std::string &); private: bool file_exists(const Msp::FS::Path &);