diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-11-19 17:29:26 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-11-19 17:29:26 +0800 |
commit | 3db124f5233862042f0c8eee1c6afd4392de0539 (patch) | |
tree | 871be9c256368fbad772900628b6a6cc71eb5190 /tools/minicargo/manifest.cpp | |
parent | c3644014de94c711b8233b6ca06351a17a284499 (diff) | |
download | mrust-3db124f5233862042f0c8eee1c6afd4392de0539.tar.gz |
minicargo - Fix handling of binaries
Diffstat (limited to 'tools/minicargo/manifest.cpp')
-rw-r--r-- | tools/minicargo/manifest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index 668100fc..bdb237dd 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -334,6 +334,24 @@ PackageManifest PackageManifest::load_from_toml(const ::std::string& path) // Default target names for(auto& tgt : rv.m_targets) { + if(tgt.m_path == "") + { + switch(tgt.m_type) + { + case PackageTarget::Type::Lib: + tgt.m_path = "src/lib.rs"; + break; + case PackageTarget::Type::Bin: + if(tgt.m_name == "") { + tgt.m_path = "src/main.rs"; + } + else { + // TODO: What about src/bin/foo/main.rs? + tgt.m_path = ::helpers::path("src") / "bin" / tgt.m_name.c_str() + ".rs"; + } + break; + } + } if(tgt.m_name == "") { tgt.m_name.reserve(rv.m_name.size()); |