cmGlobalWatcomWMakeGenerator.cxx 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmGlobalWatcomWMakeGenerator.h"
  4. #include <ostream>
  5. #include "cmDocumentationEntry.h"
  6. #include "cmGlobalGenerator.h"
  7. #include "cmMakefile.h"
  8. #include "cmState.h"
  9. #include "cmake.h"
  10. cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
  11. : cmGlobalUnixMakefileGenerator3(cm)
  12. {
  13. this->FindMakeProgramFile = "CMakeFindWMake.cmake";
  14. #ifdef _WIN32
  15. this->ForceUnixPaths = false;
  16. #endif
  17. this->ToolSupportsColor = true;
  18. this->NeedSymbolicMark = true;
  19. this->EmptyRuleHackCommand = "@%null";
  20. #ifdef _WIN32
  21. cm->GetState()->SetWindowsShell(true);
  22. #endif
  23. cm->GetState()->SetWatcomWMake(true);
  24. this->IncludeDirective = "!include";
  25. this->LineContinueDirective = "&\n";
  26. this->DefineWindowsNULL = true;
  27. this->UnixCD = false;
  28. this->MakeSilentFlag = "-h";
  29. }
  30. void cmGlobalWatcomWMakeGenerator::EnableLanguage(
  31. std::vector<std::string> const& l, cmMakefile* mf, bool optional)
  32. {
  33. // pick a default
  34. mf->AddDefinition("WATCOM", "1");
  35. mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1");
  36. mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
  37. mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
  38. mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
  39. mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
  40. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  41. }
  42. bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s,
  43. cmMakefile* mf)
  44. {
  45. if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86") {
  46. mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl");
  47. mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl");
  48. }
  49. return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf);
  50. }
  51. void cmGlobalWatcomWMakeGenerator::GetDocumentation(
  52. cmDocumentationEntry& entry)
  53. {
  54. entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName();
  55. entry.Brief = "Generates Watcom WMake makefiles.";
  56. }
  57. std::vector<cmGlobalGenerator::GeneratedMakeCommand>
  58. cmGlobalWatcomWMakeGenerator::GenerateBuildCommand(
  59. const std::string& makeProgram, const std::string& projectName,
  60. const std::string& projectDir, std::vector<std::string> const& targetNames,
  61. const std::string& config, bool fast, int /*jobs*/, bool verbose,
  62. std::vector<std::string> const& makeOptions)
  63. {
  64. return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
  65. makeProgram, projectName, projectDir, targetNames, config, fast,
  66. cmake::NO_BUILD_PARALLEL_LEVEL, verbose, makeOptions);
  67. }
  68. void cmGlobalWatcomWMakeGenerator::PrintBuildCommandAdvice(std::ostream& os,
  69. int jobs) const
  70. {
  71. if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
  72. // wmake does not support parallel build level
  73. /* clang-format off */
  74. os <<
  75. "Warning: Watcom's WMake does not support parallel builds. "
  76. "Ignoring parallel build command line option.\n";
  77. /* clang-format on */
  78. }
  79. this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice(
  80. os, cmake::NO_BUILD_PARALLEL_LEVEL);
  81. }