#ifndef ICECOMPILE_H #define ICECOMPILE_H #include "options.h" #include #include #include class IceCompile { public: INITOPTIONS; typedef boost::shared_ptr Ptr; typedef boost::shared_ptr CPtr; typedef std::vector Deps; static std::string slice2cpp; static std::string cxx; static std::string linker; static std::string cxxopts; static std::string linkeropts; static boost::filesystem::path tmpdir; static boost::filesystem::path headerdir; IceCompile(const boost::filesystem::path & slice); IceCompile(const boost::filesystem::path & slice, const Deps & deps); virtual ~IceCompile(); enum Steps { UpdateBuild = 0x1, UpdateCompile = 0x2, UpdateLink = 0x4, }; /// Conditionally execute Build, Compile, Link as required void Update(int steps = UpdateBuild | UpdateCompile | UpdateLink) const; /// Source file path (e.g. /some/path/slice.ice) virtual boost::filesystem::path InputPath() const = 0; /// File name (no extension) in temporary directory (e.g. clientSlice) virtual boost::filesystem::path OutputName(const std::string & type) const = 0; typedef boost::shared_ptr LibHandle; LibHandle Open() const; protected: virtual void Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const = 0; void Compile(const boost::filesystem::path & in, const boost::filesystem::path & out) const; void Link(const boost::filesystem::path & in, const boost::filesystem::path & out) const; typedef void (IceCompile::*UpdateFunc)(const boost::filesystem::path & in, const boost::filesystem::path & out) const; void update(const boost::filesystem::path & in, const boost::filesystem::path & out, UpdateFunc func) const; const boost::filesystem::path slice; private: const Deps deps; }; #endif