diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-02-10 16:18:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-05 14:35:10 (GMT) |
commit | 791b4d26d6cbcb69615ddfbd1872a34a2e214b39 (patch) | |
tree | c79234751e9638b6dcf151f50355846f8ac4d984 /Source/cmGlobalNinjaGenerator.cxx | |
parent | 4b233591179f9fe266e9157ef89e0a97854aa54c (diff) | |
download | CMake-791b4d26d6cbcb69615ddfbd1872a34a2e214b39.zip CMake-791b4d26d6cbcb69615ddfbd1872a34a2e214b39.tar.gz CMake-791b4d26d6cbcb69615ddfbd1872a34a2e214b39.tar.bz2 |
ninja: add experimental infrastructure to generate modmap files with dyndep
The scan step may need to output additional information for the
compiler, not just the build tool. The modmap is assumed to be beside
the object output. Additional refactoring may open up a channel to
inform per-source paths to the dyndep rule in the future, but is not
done here.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 16cdcd3..25d6a56 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2369,7 +2369,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( std::string const& arg_dd, std::vector<std::string> const& arg_ddis, std::string const& module_dir, std::vector<std::string> const& linked_target_dirs, - std::string const& arg_lang) + std::string const& arg_lang, std::string const& arg_modmapfmt) { // Setup path conversions. { @@ -2456,6 +2456,25 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( build.Variables.emplace("restat", "1"); } + if (arg_modmapfmt.empty()) { + // nothing to do. + } else { + std::stringstream mm; + if (false) { + } else { + cmSystemTools::Error( + cmStrCat("-E cmake_ninja_dyndep does not understand the ", + arg_modmapfmt, " module map format")); + return false; + } + + // XXX(modmap): If changing this path construction, change + // `cmNinjaTargetGenerator::WriteObjectBuildStatements` to generate the + // corresponding file path. + cmGeneratedFileStream mmf(cmStrCat(object.PrimaryOutput, ".modmap")); + mmf << mm.str(); + } + this->WriteBuild(ddf, build); } } @@ -2479,6 +2498,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, std::string arg_dd; std::string arg_lang; std::string arg_tdi; + std::string arg_modmapfmt; std::vector<std::string> arg_ddis; for (std::string const& arg : arg_full) { if (cmHasLiteralPrefix(arg, "--tdi=")) { @@ -2487,6 +2507,8 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, arg_lang = arg.substr(7); } else if (cmHasLiteralPrefix(arg, "--dd=")) { arg_dd = arg.substr(5); + } else if (cmHasLiteralPrefix(arg, "--modmapfmt=")) { + arg_modmapfmt = arg.substr(12); } else if (!cmHasLiteralPrefix(arg, "--") && cmHasLiteralSuffix(arg, ".ddi")) { arg_ddis.push_back(arg); @@ -2545,7 +2567,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, if (!ggd || !cm::static_reference_cast<cmGlobalNinjaGenerator>(ggd).WriteDyndepFile( dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld, arg_dd, arg_ddis, - module_dir, linked_target_dirs, arg_lang)) { + module_dir, linked_target_dirs, arg_lang, arg_modmapfmt)) { return 1; } return 0; |