]> git.tdb.fi Git - builder.git/blobdiff - source/tool.h
Make VirtualFileSystem able to find binaries
[builder.git] / source / tool.h
index 22fc3b28568293ea3a6b8bdb51faafc0d43da474..36d1be165b4f614a994d99ca08bcda4b37674ecd 100644 (file)
@@ -10,9 +10,14 @@ class Component;
 class Target;
 class Task;
 
+/**
+Base class for tools.  Tools are used to turn targets into other targets.
+Examples include compilers and linkers.
+*/
 class Tool
 {
 public:
+       typedef std::list<Msp::FS::Path> SearchPath;
        typedef std::list<std::string> SuffixList;
 
 protected:
@@ -20,6 +25,7 @@ protected:
        std::string tag;
        SuffixList input_suffixes;
        SuffixList aux_suffixes;
+       SearchPath system_path;
 
        Tool(Builder &, const std::string &);
 public:
@@ -29,11 +35,26 @@ public:
        const SuffixList &get_input_suffixes() const { return input_suffixes; }
        const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; }
        bool accepts_suffix(const std::string &, bool = false) const;
+       const SearchPath &get_system_path() const { return system_path; }
 
        virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }
+       virtual Target *create_source(const Msp::FS::Path &) const { return 0; }
        Target *create_target(Target &, const std::string & = std::string()) const;
        virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) const = 0;
        virtual Task *run(const Target &) const = 0;
 };
 
+/**
+Intermediate base class for tool facets.  For example, a linker may need to
+use different commands depending on whether C++ source files are present or
+not, but their presence can't be directly determined from the object files.
+*/
+class SubTool: public Tool
+{
+protected:
+       Tool &parent;
+
+       SubTool(Tool &);
+};
+
 #endif