diff options
-rw-r--r-- | project2/ice/iceBase.cpp | 2 | ||||
-rw-r--r-- | project2/ice/iceBase.h | 2 | ||||
-rw-r--r-- | project2/ice/iceCompile.cpp | 16 | ||||
-rw-r--r-- | project2/ice/iceCompile.h | 5 | ||||
-rw-r--r-- | project2/ice/iceDaemon.h | 4 |
5 files changed, 18 insertions, 11 deletions
diff --git a/project2/ice/iceBase.cpp b/project2/ice/iceBase.cpp index 0171f1b..ce50782 100644 --- a/project2/ice/iceBase.cpp +++ b/project2/ice/iceBase.cpp @@ -25,7 +25,7 @@ class WaitAndLoad : public boost::static_visitor<> { lib = boost::get<0>(th)->Open(); } - void operator()(IceCompile::LibHandle) const + void operator()(IceCompile::LibHandles) const { } diff --git a/project2/ice/iceBase.h b/project2/ice/iceBase.h index 06d8994..1d45346 100644 --- a/project2/ice/iceBase.h +++ b/project2/ice/iceBase.h @@ -9,7 +9,7 @@ class IceBase { public: typedef boost::tuple<IceCompile::CPtr, std::thread *> LibCompile; - typedef boost::variant<LibCompile, IceCompile::LibHandle> LibPromise; + typedef boost::variant<LibCompile, IceCompile::LibHandles> LibPromise; typedef std::vector<LibPromise> Libs; typedef boost::function<IceCompile::CPtr(const std::string &, const IceCompile::Deps &)> GetComponentCompiler; diff --git a/project2/ice/iceCompile.cpp b/project2/ice/iceCompile.cpp index 74b0b45..fc7e100 100644 --- a/project2/ice/iceCompile.cpp +++ b/project2/ice/iceCompile.cpp @@ -106,18 +106,26 @@ void IceCompile::Link(const fs::path & in, const fs::path & out) const { auto link = stringbf("%s %s -o %s -shared %s", linker, linkeropts, out, in); - BOOST_FOREACH(const auto & dep, deps) { - link += " " + (tmpdir / dep->OutputName(".so")).string(); - } Logger()->messagebf(LOG_DEBUG, "link command: %s", link); if (system(link.c_str())) { throw std::runtime_error("link failed"); } } -IceCompile::LibHandle +IceCompile::LibHandles IceCompile::Open() const { + LibHandles rtn; + BOOST_FOREACH(const auto & dep, deps) { + rtn.insert(dep->OpenLib()); + } + rtn.insert(OpenLib()); + return rtn; +} + +IceCompile::LibHandle +IceCompile::OpenLib() const +{ void * handle = dlopen((IceCompile::tmpdir / OutputName(".so")).string().c_str(), RTLD_GLOBAL | RTLD_NOW); if (!handle) { std::string msg(dlerror()); diff --git a/project2/ice/iceCompile.h b/project2/ice/iceCompile.h index 5e6873a..a66b1d7 100644 --- a/project2/ice/iceCompile.h +++ b/project2/ice/iceCompile.h @@ -3,6 +3,7 @@ #include "options.h" #include <string> +#include <set> #include <boost/filesystem/path.hpp> #include <boost/optional.hpp> @@ -41,7 +42,8 @@ class IceCompile { virtual boost::filesystem::path OutputName(const std::string & type) const = 0; typedef boost::shared_ptr<void> LibHandle; - LibHandle Open() const; + typedef std::set<LibHandle> LibHandles; + LibHandles Open() const; protected: virtual void Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const = 0; @@ -54,6 +56,7 @@ class IceCompile { const boost::filesystem::path slice; private: + LibHandle OpenLib() const; const Deps deps; }; diff --git a/project2/ice/iceDaemon.h b/project2/ice/iceDaemon.h index 623da11..1ec9d11 100644 --- a/project2/ice/iceDaemon.h +++ b/project2/ice/iceDaemon.h @@ -7,10 +7,6 @@ class IceDaemon : public Daemon, IceBase { public: - typedef boost::tuple<IceCompile::CPtr, std::thread *> LibCompile; - typedef boost::variant<LibCompile, IceCompile::LibHandle> LibPromise; - typedef std::vector<LibPromise> Libs; - IceDaemon(int & argc, char ** argv); virtual ~IceDaemon(); |