This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 0069825f50c83b8144374150dd682d48c84f6874 (commit) via d80ecba5c27ec249dc85c3a3559db822ef320d05 (commit) via 72057d9c1582f4b6dec66cd0675860c4c335636e (commit) via 7ae329e2ed84f62165cb11794ad85c6c43dbd7dc (commit) from 50ba2f019baa3e5487a975cb72059f1fc178f9d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0069825f50c83b8144374150dd682d48c84f6874 commit 0069825f50c83b8144374150dd682d48c84f6874 Merge: 50ba2f0 d80ecba Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu Feb 14 15:25:08 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Thu Feb 14 10:25:15 2019 -0500 Merge topic 'fortran-submodule-names' d80ecba5c2 Fortran: Fix submodule file names across compilers 72057d9c15 Fortran: Thread compiler id through to internal Fortran parser 7ae329e2ed Fortran: Factor out .mod and .smod file name construction Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Michael Hirsch, Ph.D. <mich...@scivision.co> Merge-request: !2958 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d80ecba5c27ec249dc85c3a3559db822ef320d05 commit d80ecba5c27ec249dc85c3a3559db822ef320d05 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Feb 13 14:08:34 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Feb 14 10:23:02 2019 -0500 Fortran: Fix submodule file names across compilers The naming convention for submodule files varies across compilers. Add a table to the compiler information modules and thread the information through to the Fortran module dependency parser. Fill out the table for compiler ids known to support Fortran submodules. Fixes: #18746 diff --git a/Modules/Compiler/Flang-Fortran.cmake b/Modules/Compiler/Flang-Fortran.cmake index d522739..f0e61d8 100644 --- a/Modules/Compiler/Flang-Fortran.cmake +++ b/Modules/Compiler/Flang-Fortran.cmake @@ -1,6 +1,9 @@ include(Compiler/Clang) __compiler_clang(Fortran) +set(CMAKE_Fortran_SUBMODULE_SEP "-") +set(CMAKE_Fortran_SUBMODULE_EXT ".mod") + set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index c333d50..6413769 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -1,6 +1,9 @@ include(Compiler/GNU) __compiler_gnu(Fortran) +set(CMAKE_Fortran_SUBMODULE_SEP "@") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index a132055..5275ddf 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -1,6 +1,9 @@ include(Compiler/Intel) __compiler_intel(Fortran) +set(CMAKE_Fortran_SUBMODULE_SEP "@") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + set(CMAKE_Fortran_MODDIR_FLAG "-module ") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake index a183c33..3daf798 100644 --- a/Modules/Compiler/PGI-Fortran.cmake +++ b/Modules/Compiler/PGI-Fortran.cmake @@ -1,6 +1,9 @@ include(Compiler/PGI) __compiler_pgi(Fortran) +set(CMAKE_Fortran_SUBMODULE_SEP "-") +set(CMAKE_Fortran_SUBMODULE_EXT ".mod") + set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake index 6bab6f6..c4fb097 100644 --- a/Modules/Compiler/XL-Fortran.cmake +++ b/Modules/Compiler/XL-Fortran.cmake @@ -1,6 +1,9 @@ include(Compiler/XL) __compiler_xl(Fortran) +set(CMAKE_Fortran_SUBMODULE_SEP "_") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=<right_margin>] set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm] diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index fe69d14..3f036a9 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -96,6 +96,8 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg) } this->CompilerId = mf->GetSafeDefinition("CMAKE_Fortran_COMPILER_ID"); + this->SModSep = mf->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_SEP"); + this->SModExt = mf->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT"); } cmDependsFortran::~cmDependsFortran() @@ -120,6 +122,8 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, cmFortranCompiler fc; fc.Id = this->CompilerId; + fc.SModSep = this->SModSep; + fc.SModExt = this->SModExt; bool okay = true; for (std::string const& src : sources) { diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index f2d9cf2..0485115 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -78,6 +78,8 @@ protected: std::string SourceFile; std::string CompilerId; + std::string SModSep; + std::string SModExt; std::set<std::string> PPDefinitions; diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 3fbf552..0762340 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -131,6 +131,8 @@ struct cmFortranFile struct cmFortranCompiler { std::string Id; + std::string SModSep; + std::string SModExt; }; struct cmFortranParser_s diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 8787206..18e3c10 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -79,7 +79,7 @@ std::string cmFortranParser_s::ModName(std::string const& mod_name) const std::string cmFortranParser_s::SModName(std::string const& mod_name, std::string const& sub_name) const { - return mod_name + "@" + sub_name + ".smod"; + return mod_name + this->Compiler.SModSep + sub_name + this->Compiler.SModExt; } bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f5262f0..920f639 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1704,6 +1704,12 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, Json::Value const& tdi_compiler_id = tdi["compiler-id"]; fc.Id = tdi_compiler_id.asString(); + + Json::Value const& tdi_submodule_sep = tdi["submodule-sep"]; + fc.SModSep = tdi_submodule_sep.asString(); + + Json::Value const& tdi_submodule_ext = tdi["submodule-ext"]; + fc.SModExt = tdi_submodule_ext.asString(); } cmFortranSourceInfo info; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d6f71d3..7eb4a03 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1808,6 +1808,17 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( << "_COMPILER_ID \"" << cid << "\")\n"; } + if (implicitLang.first == "Fortran") { + std::string smodSep = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_SEP"); + std::string smodExt = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT"); + cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_SEP \"" << smodSep + << "\")\n"; + cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_EXT \"" << smodExt + << "\")\n"; + } + // Build a list of preprocessor definitions for the target. std::set<std::string> defines; this->GetTargetDefines(target, this->ConfigName, implicitLang.first, diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5d76dc2..82bc5f2 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1144,6 +1144,10 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang) mod_dir = this->Makefile->GetCurrentBinaryDirectory(); } tdi["module-dir"] = mod_dir; + tdi["submodule-sep"] = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_SEP"); + tdi["submodule-ext"] = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT"); } tdi["dir-cur-bld"] = this->Makefile->GetCurrentBinaryDirectory(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72057d9c1582f4b6dec66cd0675860c4c335636e commit 72057d9c1582f4b6dec66cd0675860c4c335636e Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Feb 13 13:34:56 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Feb 14 10:23:02 2019 -0500 Fortran: Thread compiler id through to internal Fortran parser diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index cae3ff6..fe69d14 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -94,6 +94,8 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg) } this->PPDefinitions.insert(def); } + + this->CompilerId = mf->GetSafeDefinition("CMAKE_Fortran_COMPILER_ID"); } cmDependsFortran::~cmDependsFortran() @@ -116,6 +118,9 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, return false; } + cmFortranCompiler fc; + fc.Id = this->CompilerId; + bool okay = true; for (std::string const& src : sources) { // Get the information object for this source. @@ -123,7 +128,7 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, // Create the parser object. The constructor takes info by reference, // so we may look into the resulting objects later. - cmFortranParser parser(this->IncludePath, this->PPDefinitions, info); + cmFortranParser parser(fc, this->IncludePath, this->PPDefinitions, info); // Push on the starting file. cmFortranParser_FilePush(&parser, src.c_str()); diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index bf09904..f2d9cf2 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -77,6 +77,8 @@ protected: // The source file from which to start scanning. std::string SourceFile; + std::string CompilerId; + std::set<std::string> PPDefinitions; // Internal implementation details. diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index cc5c113..3fbf552 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -128,9 +128,14 @@ struct cmFortranFile bool LastCharWasNewline; }; +struct cmFortranCompiler +{ + std::string Id; +}; + struct cmFortranParser_s { - cmFortranParser_s(std::vector<std::string> includes, + cmFortranParser_s(cmFortranCompiler fc, std::vector<std::string> includes, std::set<std::string> defines, cmFortranSourceInfo& info); ~cmFortranParser_s(); @@ -141,6 +146,9 @@ struct cmFortranParser_s std::string SModName(std::string const& mod_name, std::string const& sub_name) const; + // What compiler. + cmFortranCompiler Compiler; + // The include file search path. std::vector<std::string> IncludePath; diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 7b0c1a9..8787206 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -43,10 +43,12 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir, return false; } -cmFortranParser_s::cmFortranParser_s(std::vector<std::string> includes, +cmFortranParser_s::cmFortranParser_s(cmFortranCompiler fc, + std::vector<std::string> includes, std::set<std::string> defines, cmFortranSourceInfo& info) - : IncludePath(std::move(includes)) + : Compiler(std::move(fc)) + , IncludePath(std::move(includes)) , PPDefinitions(std::move(defines)) , Info(info) { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6498024..f5262f0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1679,6 +1679,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, return 1; } + cmFortranCompiler fc; std::vector<std::string> includes; { Json::Value tdio; @@ -1700,11 +1701,14 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, includes.push_back(tdi_include_dir.asString()); } } + + Json::Value const& tdi_compiler_id = tdi["compiler-id"]; + fc.Id = tdi_compiler_id.asString(); } cmFortranSourceInfo info; std::set<std::string> defines; - cmFortranParser parser(includes, defines, info); + cmFortranParser parser(fc, includes, defines, info); if (!cmFortranParser_FilePush(&parser, arg_pp.c_str())) { cmSystemTools::Error("-E cmake_ninja_depends failed to open ", arg_pp.c_str()); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ae329e2ed84f62165cb11794ad85c6c43dbd7dc commit 7ae329e2ed84f62165cb11794ad85c6c43dbd7dc Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Feb 13 13:42:51 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Feb 14 10:23:02 2019 -0500 Fortran: Factor out .mod and .smod file name construction diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 8d4c90b..cc5c113 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -137,6 +137,10 @@ struct cmFortranParser_s bool FindIncludeFile(const char* dir, const char* includeName, std::string& fileName); + std::string ModName(std::string const& mod_name) const; + std::string SModName(std::string const& mod_name, + std::string const& sub_name) const; + // The include file search path. std::vector<std::string> IncludePath; diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 45481a4..7b0c1a9 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -69,6 +69,17 @@ cmFortranParser_s::~cmFortranParser_s() cmFortran_yylex_destroy(this->Scanner); } +std::string cmFortranParser_s::ModName(std::string const& mod_name) const +{ + return mod_name + ".mod"; +} + +std::string cmFortranParser_s::SModName(std::string const& mod_name, + std::string const& sub_name) const +{ + return mod_name + "@" + sub_name + ".smod"; +} + bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) { // Open the new file and push it onto the stack. Save the old @@ -178,7 +189,7 @@ void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name) // syntax: "use module_name" // requires: "module_name.mod" std::string const& mod_name = cmSystemTools::LowerCase(module_name); - parser->Info.Requires.insert(mod_name + ".mod"); + parser->Info.Requires.insert(parser->ModName(mod_name)); } void cmFortranParser_RuleLineDirective(cmFortranParser* parser, @@ -242,7 +253,7 @@ void cmFortranParser_RuleModule(cmFortranParser* parser, // syntax: "module module_name" // provides: "module_name.mod" std::string const& mod_name = cmSystemTools::LowerCase(module_name); - parser->Info.Provides.insert(mod_name + ".mod"); + parser->Info.Provides.insert(parser->ModName(mod_name)); } } @@ -265,8 +276,8 @@ void cmFortranParser_RuleSubmodule(cmFortranParser* parser, std::string const& mod_name = cmSystemTools::LowerCase(module_name); std::string const& sub_name = cmSystemTools::LowerCase(submodule_name); - parser->Info.Requires.insert(mod_name + ".mod"); - parser->Info.Provides.insert(mod_name + "@" + sub_name + ".smod"); + parser->Info.Requires.insert(parser->ModName(mod_name)); + parser->Info.Provides.insert(parser->SModName(mod_name, sub_name)); } void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser, @@ -286,8 +297,8 @@ void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser, std::string const& sub_name = cmSystemTools::LowerCase(submodule_name); std::string const& nest_name = cmSystemTools::LowerCase(nested_submodule_name); - parser->Info.Requires.insert(mod_name + "@" + sub_name + ".smod"); - parser->Info.Provides.insert(mod_name + "@" + nest_name + ".smod"); + parser->Info.Requires.insert(parser->SModName(mod_name, sub_name)); + parser->Info.Provides.insert(parser->SModName(mod_name, nest_name)); } void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro) ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Flang-Fortran.cmake | 3 +++ Modules/Compiler/GNU-Fortran.cmake | 3 +++ Modules/Compiler/Intel-Fortran.cmake | 3 +++ Modules/Compiler/PGI-Fortran.cmake | 3 +++ Modules/Compiler/XL-Fortran.cmake | 3 +++ Source/cmDependsFortran.cxx | 11 ++++++++++- Source/cmDependsFortran.h | 4 ++++ Source/cmFortranParser.h | 16 +++++++++++++++- Source/cmFortranParserImpl.cxx | 29 +++++++++++++++++++++-------- Source/cmGlobalNinjaGenerator.cxx | 12 +++++++++++- Source/cmLocalUnixMakefileGenerator3.cxx | 11 +++++++++++ Source/cmNinjaTargetGenerator.cxx | 4 ++++ 12 files changed, 91 insertions(+), 11 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits