From 2d9112e84d735e1948313240df8d5140364cca0e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 27 Mar 2024 20:28:05 +0300 Subject: Add export-stub sub-option to bdep-new --type exe option --- bdep/new.cli | 5 +++++ bdep/new.cxx | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/bdep/new.cli b/bdep/new.cli index 7bbfe8f..bcbc6c6 100644 --- a/bdep/new.cli +++ b/bdep/new.cli @@ -316,6 +316,10 @@ namespace bdep Don't add support for installing.| + \li|\n\ \ \ \cb{export-stub} + + Add support for importing this project's targets from other projects.| + \li|\n\ \ \ \c{\b{prefix=}\i{dir}} Optional source prefix relative to project/package root.| @@ -642,6 +646,7 @@ namespace bdep bool no-tests; bool unit-tests; bool no-install; + bool export-stub; dir_path prefix; dir_path subdir; bool no-subdir; diff --git a/bdep/new.cxx b/bdep/new.cxx index 229a21d..e461d42 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -2777,6 +2777,24 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args) } } + // build/export.build + // + if (!src && t.exe_opt.export_stub ()) + { + string sd ( + (pfx_src / (sub_src && !bfile_in_pfx_src ? sub : empty_dir_path)). + posix_representation ()); + + open (bd / "export." + build_ext); + os << "$out_root/" << '\n' + << "{" << '\n' + << " include " << (!sd.empty () ? sd : "./") << '\n' + << "}" << '\n' + << '\n' + << "export $out_root/" << sd << "$import.target" << '\n'; + os.close (); + } + break; } case type::lib: -- cgit v1.1