#ifndef ICECOMPILE_H #define ICECOMPILE_H #include "options.h" #include #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 slicer; 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; static boost::filesystem::path slicerheaderdir; IceCompile(const boost::filesystem::path & slice); IceCompile(const boost::filesystem::path & slice, const Deps & deps); enum Steps { UpdateBuild = 0x1, UpdateCompile = 0x2, UpdateLink = 0x4, }; /// Conditionally execute Build, Compile, Link as required void Update(int steps = UpdateBuild | UpdateCompile | UpdateLink); /// 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; typedef std::set LibHandles; LibHandles Open() const; protected: virtual unsigned int Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const = 0; virtual unsigned int Count(const boost::filesystem::path & in) const = 0; void BuildInteral(const boost::filesystem::path & in, const boost::filesystem::path & out); void Compile(const boost::filesystem::path & in, const boost::filesystem::path & out); void Link(const boost::filesystem::path & in, const boost::filesystem::path & out); typedef void (IceCompile::*UpdateFunc)(const boost::filesystem::path & in, const boost::filesystem::path & out); typedef void (IceCompile::*CountFunc)(const boost::filesystem::path & in); void update(const boost::filesystem::path & in, const boost::filesystem::path & out, UpdateFunc func, CountFunc count = NULL); const boost::filesystem::path slice; private: void countComponents(const boost::filesystem::path & in); unsigned int components; LibHandle OpenLib() const; const Deps deps; }; #endif