diff options
author | randomdan <randomdan@localhost> | 2014-03-11 19:58:09 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2014-03-11 19:58:09 +0000 |
commit | aff1541921b32f16da306e8ca89cbb325dad88b2 (patch) | |
tree | d42aa4aadb4149d3a164852847b45573d8713880 | |
parent | Add basic workings of the Ice client and daemon modules - will probably chang... (diff) | |
download | project2-aff1541921b32f16da306e8ca89cbb325dad88b2.tar.bz2 project2-aff1541921b32f16da306e8ca89cbb325dad88b2.tar.xz project2-aff1541921b32f16da306e8ca89cbb325dad88b2.zip |
Don't require the Ice comms code to be compiled if an existing library can support our needs
-rw-r--r-- | project2/ice/iceCompile.cpp | 13 | ||||
-rw-r--r-- | project2/ice/iceCompile.h | 7 | ||||
-rw-r--r-- | project2/ice/iceDataSource.cpp | 14 | ||||
-rw-r--r-- | project2/ice/iceDataSource.h | 1 |
4 files changed, 29 insertions, 6 deletions
diff --git a/project2/ice/iceCompile.cpp b/project2/ice/iceCompile.cpp index d9287f4..1be126c 100644 --- a/project2/ice/iceCompile.cpp +++ b/project2/ice/iceCompile.cpp @@ -44,18 +44,21 @@ IceCompile::IceCompile(const boost::filesystem::path & s, const Deps & d) : } void -IceCompile::Update() const +IceCompile::Update(int steps) const { fs::create_directories(IceCompile::tmpdir); BOOST_FOREACH(const auto & dep, deps) { - dep->Update(); + dep->Update(steps); } const fs::path cpp(tmpdir / OutputName(".cpp")); - update(InputPath(), cpp, &IceCompile::Build); + if (steps & UpdateBuild) + update(InputPath(), cpp, &IceCompile::Build); const fs::path o(tmpdir / OutputName(".o")); - update(cpp, o, &IceCompile::Compile); + if (steps & UpdateCompile) + update(cpp, o, &IceCompile::Compile); const fs::path so(tmpdir / OutputName(".so")); - update(o, so, &IceCompile::Link); + if (steps & UpdateLink) + update(o, so, &IceCompile::Link); } void diff --git a/project2/ice/iceCompile.h b/project2/ice/iceCompile.h index d403d9e..762b419 100644 --- a/project2/ice/iceCompile.h +++ b/project2/ice/iceCompile.h @@ -23,8 +23,13 @@ class IceCompile { 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() const; + 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) diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp index 5cfd5b1..7b77b19 100644 --- a/project2/ice/iceDataSource.cpp +++ b/project2/ice/iceDataSource.cpp @@ -11,6 +11,8 @@ IceDataSource::Proxies IceDataSource::proxies; DECLARE_OPTIONS(IceDataSource, "ICE Data Source") ("ice.client.slice", Options::functions(boost::bind(&IceDataSource::SetSlice, _1), boost::bind(&IceDataSource::ClearSlice)), "The ICE Slice file(s) to compile") +("ice.client.sliceclient", Options::functions(boost::bind(&IceDataSource::SetSliceClient, _1), boost::bind(&IceDataSource::ClearSlice)), + "The ICE Slice file(s) to compile (client only, assumes comms library referenced)") END_OPTIONS(IceDataSource); int dummy = 0; @@ -33,6 +35,18 @@ IceDataSource::SetSlice(const VariableType & vslice) } void +IceDataSource::SetSliceClient(const VariableType & vslice) +{ + auto slice = vslice.as<std::string>(); + BuildComms bc(slice); + bc.Update(IceCompile::UpdateBuild); + BuildShared bcs(slice, { }); + BuildClient bcl(slice, { &bcs }); + bcl.Update(); + libs.insert({ slice, bcl.Open() }); +} + +void IceDataSource::ClearSlice() { libs.clear(); diff --git a/project2/ice/iceDataSource.h b/project2/ice/iceDataSource.h index e80a3fc..fe07bc1 100644 --- a/project2/ice/iceDataSource.h +++ b/project2/ice/iceDataSource.h @@ -28,6 +28,7 @@ class IceDataSource : public DataSource { private: static void SetSlice(const VariableType &); + static void SetSliceClient(const VariableType &); static void ClearSlice(); typedef std::map<std::string, IceCompile::LibHandle> Libs; static Libs libs; |