cmGlobalWatcomWMakeGenerator.cxx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 <cm/string_view>
  6. #include <cmext/string_view>
  7. #include "cmGlobalGenerator.h"
  8. #include "cmMakefile.h"
  9. #include "cmState.h"
  10. #include "cmake.h"
  11. cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
  12. : cmGlobalUnixMakefileGenerator3(cm)
  13. {
  14. this->FindMakeProgramFile = "CMakeFindWMake.cmake";
  15. #ifdef _WIN32
  16. this->ForceUnixPaths = false;
  17. #endif
  18. this->ToolSupportsColor = true;
  19. this->NeedSymbolicMark = true;
  20. this->EmptyRuleHackCommand = "@%null";
  21. #ifdef _WIN32
  22. cm->GetState()->SetWindowsShell(true);
  23. #endif
  24. cm->GetState()->SetWatcomWMake(true);
  25. this->IncludeDirective = "!include";
  26. this->LineContinueDirective = "&\n";
  27. this->DefineWindowsNULL = true;
  28. this->UnixCD = false;
  29. this->MakeSilentFlag = "-h";
  30. }
  31. void cmGlobalWatcomWMakeGenerator::EnableLanguage(
  32. std::vector<std::string> const& l, cmMakefile* mf, bool optional)
  33. {
  34. // pick a default
  35. mf->AddDefinition("WATCOM", "1");
  36. mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1");
  37. mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
  38. mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
  39. mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
  40. mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
  41. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  42. }
  43. bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s,
  44. cmMakefile* mf)
  45. {
  46. if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86"_s) {
  47. mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl");
  48. mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl");
  49. }
  50. return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf);
  51. }
  52. cmDocumentationEntry cmGlobalWatcomWMakeGenerator::GetDocumentation()
  53. {
  54. return { cmGlobalWatcomWMakeGenerator::GetActualName(),
  55. "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, int /*jobs*/, bool verbose,
  62. const cmBuildOptions& buildOptions,
  63. std::vector<std::string> const& makeOptions)
  64. {
  65. return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
  66. makeProgram, projectName, projectDir, targetNames, config,
  67. cmake::NO_BUILD_PARALLEL_LEVEL, verbose, buildOptions, makeOptions);
  68. }
  69. void cmGlobalWatcomWMakeGenerator::PrintBuildCommandAdvice(std::ostream& os,
  70. int jobs) const
  71. {
  72. if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
  73. // wmake does not support parallel build level
  74. /* clang-format off */
  75. os <<
  76. "Warning: Watcom's WMake does not support parallel builds. "
  77. "Ignoring parallel build command line option.\n";
  78. /* clang-format on */
  79. }
  80. this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice(
  81. os, cmake::NO_BUILD_PARALLEL_LEVEL);
  82. }