cmGlobalWatcomWMakeGenerator.cxx 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst 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. std::string const& makeProgram, std::string const& projectName,
  60. std::string const& projectDir, std::vector<std::string> const& targetNames,
  61. std::string const& config, int /*jobs*/, bool verbose,
  62. cmBuildOptions buildOptions, std::vector<std::string> const& makeOptions,
  63. BuildTryCompile /*isInTryCompile */)
  64. {
  65. return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
  66. makeProgram, projectName, projectDir, targetNames, config,
  67. cmake::NO_BUILD_PARALLEL_LEVEL, verbose, buildOptions, makeOptions);
  68. }
  69. std::string cmGlobalWatcomWMakeGenerator::GetShortBinaryOutputDir() const
  70. {
  71. return "_o";
  72. }
  73. void cmGlobalWatcomWMakeGenerator::PrintBuildCommandAdvice(std::ostream& os,
  74. int jobs) const
  75. {
  76. if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
  77. // wmake does not support parallel build level
  78. /* clang-format off */
  79. os <<
  80. "Warning: Watcom's WMake does not support parallel builds. "
  81. "Ignoring parallel build command line option.\n";
  82. /* clang-format on */
  83. }
  84. this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice(
  85. os, cmake::NO_BUILD_PARALLEL_LEVEL);
  86. }