2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2015-07-22 17:21:45 +00:00
|
|
|
#ifndef cmFortran_h
|
|
|
|
#define cmFortran_h
|
2005-01-26 20:33:38 +00:00
|
|
|
|
2017-08-25 18:39:02 +00:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2017-04-11 19:42:35 +00:00
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
#include "cmDepends.h"
|
|
|
|
|
2007-12-28 16:49:59 +00:00
|
|
|
class cmDependsFortranInternals;
|
2015-07-22 17:21:45 +00:00
|
|
|
class cmFortranSourceInfo;
|
2016-09-01 18:59:28 +00:00
|
|
|
class cmLocalGenerator;
|
2007-12-28 16:49:59 +00:00
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
/** \class cmDependsFortran
|
|
|
|
* \brief Dependency scanner for Fortran object files.
|
|
|
|
*/
|
2016-05-16 14:34:04 +00:00
|
|
|
class cmDependsFortran : public cmDepends
|
2005-01-26 20:33:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Checking instances need to know the build directory name and the
|
|
|
|
relative path from the build directory to the target file. */
|
2005-05-11 17:16:45 +00:00
|
|
|
cmDependsFortran();
|
2005-01-26 20:33:38 +00:00
|
|
|
|
|
|
|
/** Scanning need to know the build directory name, the relative
|
|
|
|
path from the build directory to the target file, the source
|
2007-12-19 19:28:46 +00:00
|
|
|
file from which to start scanning, the include file search
|
|
|
|
path, and the target directory. */
|
2008-05-08 14:09:14 +00:00
|
|
|
cmDependsFortran(cmLocalGenerator* lg);
|
2005-01-26 20:33:38 +00:00
|
|
|
|
|
|
|
/** Virtual destructor to cleanup subclasses properly. */
|
2017-09-15 13:56:26 +00:00
|
|
|
~cmDependsFortran() override;
|
2005-01-26 20:33:38 +00:00
|
|
|
|
2019-01-23 19:30:01 +00:00
|
|
|
cmDependsFortran(cmDependsFortran const&) = delete;
|
|
|
|
cmDependsFortran& operator=(cmDependsFortran const&) = delete;
|
|
|
|
|
2005-03-03 21:53:33 +00:00
|
|
|
/** Callback from build system after a .mod file has been generated
|
|
|
|
by a Fortran90 compiler to copy the .mod file to the
|
|
|
|
corresponding stamp file. */
|
|
|
|
static bool CopyModule(const std::vector<std::string>& args);
|
|
|
|
|
2007-12-31 16:25:17 +00:00
|
|
|
/** Determine if a mod file and the corresponding mod.stamp file
|
|
|
|
are representing different module information. */
|
2019-01-19 01:20:00 +00:00
|
|
|
static bool ModulesDiffer(const std::string& modFile,
|
|
|
|
const std::string& stampFile,
|
|
|
|
const std::string& compilerId);
|
2007-12-31 16:25:17 +00:00
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
protected:
|
2007-12-28 16:49:59 +00:00
|
|
|
// Finalize the dependency information for the target.
|
2016-06-27 19:25:27 +00:00
|
|
|
bool Finalize(std::ostream& makeDepends,
|
2017-09-15 13:56:26 +00:00
|
|
|
std::ostream& internalDepends) override;
|
2007-12-28 16:49:59 +00:00
|
|
|
|
|
|
|
// Find all the modules required by the target.
|
|
|
|
void LocateModules();
|
|
|
|
void MatchLocalModules();
|
2019-01-19 01:20:00 +00:00
|
|
|
void MatchRemoteModules(std::istream& fin, const std::string& stampDir);
|
|
|
|
void ConsiderModule(const std::string& name, const std::string& stampDir);
|
2007-12-28 16:49:59 +00:00
|
|
|
bool FindModule(std::string const& name, std::string& module);
|
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
// Implement writing/checking methods required by superclass.
|
2016-06-27 19:25:27 +00:00
|
|
|
bool WriteDependencies(const std::set<std::string>& sources,
|
|
|
|
const std::string& file, std::ostream& makeDepends,
|
2017-09-15 13:56:26 +00:00
|
|
|
std::ostream& internalDepends) override;
|
2005-01-26 20:33:38 +00:00
|
|
|
|
2018-01-03 12:09:54 +00:00
|
|
|
// Actually write the dependencies to the streams.
|
2019-01-19 01:20:00 +00:00
|
|
|
bool WriteDependenciesReal(std::string const& obj,
|
|
|
|
cmFortranSourceInfo const& info,
|
|
|
|
std::string const& mod_dir,
|
|
|
|
std::string const& stamp_dir,
|
2007-12-28 16:49:59 +00:00
|
|
|
std::ostream& makeDepends,
|
|
|
|
std::ostream& internalDepends);
|
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
// The source file from which to start scanning.
|
2006-03-15 16:02:08 +00:00
|
|
|
std::string SourceFile;
|
2005-01-26 20:33:38 +00:00
|
|
|
|
2019-02-13 18:34:56 +00:00
|
|
|
std::string CompilerId;
|
2019-02-13 19:08:34 +00:00
|
|
|
std::string SModSep;
|
|
|
|
std::string SModExt;
|
2019-02-13 18:34:56 +00:00
|
|
|
|
2015-07-22 17:45:28 +00:00
|
|
|
std::set<std::string> PPDefinitions;
|
2005-01-26 20:33:38 +00:00
|
|
|
|
2007-12-28 16:49:59 +00:00
|
|
|
// Internal implementation details.
|
2018-11-21 22:17:54 +00:00
|
|
|
cmDependsFortranInternals* Internal = nullptr;
|
2007-12-28 16:49:59 +00:00
|
|
|
|
2005-01-26 20:33:38 +00:00
|
|
|
private:
|
2016-10-04 20:56:31 +00:00
|
|
|
std::string MaybeConvertToRelativePath(std::string const& base,
|
|
|
|
std::string const& path);
|
2005-01-26 20:33:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|