cmDependsFortran.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmDependsFortran_h
  14. #define cmDependsFortran_h
  15. #include "cmDepends.h"
  16. class cmDependsFortranInternals;
  17. class cmDependsFortranSourceInfo;
  18. /** \class cmDependsFortran
  19. * \brief Dependency scanner for Fortran object files.
  20. */
  21. class cmDependsFortran: public cmDepends
  22. {
  23. public:
  24. /** Checking instances need to know the build directory name and the
  25. relative path from the build directory to the target file. */
  26. cmDependsFortran();
  27. /** Scanning need to know the build directory name, the relative
  28. path from the build directory to the target file, the source
  29. file from which to start scanning, the include file search
  30. path, and the target directory. */
  31. cmDependsFortran(std::vector<std::string> const& includes);
  32. /** Virtual destructor to cleanup subclasses properly. */
  33. virtual ~cmDependsFortran();
  34. /** Callback from build system after a .mod file has been generated
  35. by a Fortran90 compiler to copy the .mod file to the
  36. corresponding stamp file. */
  37. static bool CopyModule(const std::vector<std::string>& args);
  38. /** Determine if a mod file and the corresponding mod.stamp file
  39. are representing different module information. */
  40. static bool ModulesDiffer(const char* modFile, const char* stampFile,
  41. const char* compilerId);
  42. /** Method to find an included file in the include path. Fortran
  43. always searches the directory containing the including source
  44. first. */
  45. bool FindIncludeFile(const char* dir, const char* includeName,
  46. std::string& fileName);
  47. protected:
  48. // Finalize the dependency information for the target.
  49. virtual bool Finalize(std::ostream& makeDepends,
  50. std::ostream& internalDepends);
  51. // Find all the modules required by the target.
  52. void LocateModules();
  53. void MatchLocalModules();
  54. void MatchRemoteModules(std::istream& fin, const char* stampDir);
  55. void ConsiderModule(const char* name, const char* stampDir);
  56. bool FindModule(std::string const& name, std::string& module);
  57. // Implement writing/checking methods required by superclass.
  58. virtual bool WriteDependencies(
  59. const char *src, const char *file,
  60. std::ostream& makeDepends, std::ostream& internalDepends);
  61. // Actually write the depenencies to the streams.
  62. bool WriteDependenciesReal(const char *obj,
  63. cmDependsFortranSourceInfo const& info,
  64. const char* mod_dir, const char* stamp_dir,
  65. std::ostream& makeDepends,
  66. std::ostream& internalDepends);
  67. // The source file from which to start scanning.
  68. std::string SourceFile;
  69. // The include file search path.
  70. std::vector<std::string> const* IncludePath;
  71. // Internal implementation details.
  72. cmDependsFortranInternals* Internal;
  73. private:
  74. cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
  75. void operator=(cmDependsFortran const&); // Purposely not implemented.
  76. };
  77. #endif