cmLocalXCodeGenerator.cxx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmLocalXCodeGenerator.h"
  11. #include "cmGlobalXCodeGenerator.h"
  12. #include "cmSourceFile.h"
  13. #include "cmMakefile.h"
  14. //----------------------------------------------------------------------------
  15. cmLocalXCodeGenerator::cmLocalXCodeGenerator()
  16. {
  17. // the global generator does this, so do not
  18. // put these flags into the language flags
  19. this->EmitUniversalBinaryFlags = false;
  20. }
  21. //----------------------------------------------------------------------------
  22. cmLocalXCodeGenerator::~cmLocalXCodeGenerator()
  23. {
  24. }
  25. //----------------------------------------------------------------------------
  26. std::string
  27. cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const
  28. {
  29. // No per-target directory for this generator (yet).
  30. return "";
  31. }
  32. //----------------------------------------------------------------------------
  33. void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
  34. const std::string& rawFlag)
  35. {
  36. cmGlobalXCodeGenerator* gg =
  37. static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
  38. gg->AppendFlag(flags, rawFlag);
  39. }
  40. //----------------------------------------------------------------------------
  41. void cmLocalXCodeGenerator::Generate()
  42. {
  43. cmLocalGenerator::Generate();
  44. cmTargets& targets = this->Makefile->GetTargets();
  45. for(cmTargets::iterator iter = targets.begin();
  46. iter != targets.end(); ++iter)
  47. {
  48. cmTarget* t = &iter->second;
  49. t->HasMacOSXRpathInstallNameDir("");
  50. }
  51. }
  52. //----------------------------------------------------------------------------
  53. void cmLocalXCodeGenerator::GenerateInstallRules()
  54. {
  55. cmLocalGenerator::GenerateInstallRules();
  56. cmTargets& targets = this->Makefile->GetTargets();
  57. for(cmTargets::iterator iter = targets.begin();
  58. iter != targets.end(); ++iter)
  59. {
  60. cmTarget* t = &iter->second;
  61. t->HasMacOSXRpathInstallNameDir("");
  62. }
  63. }
  64. //----------------------------------------------------------------------------
  65. void cmLocalXCodeGenerator::ComputeObjectFilenames(
  66. std::map<cmSourceFile const*, std::string>& mapping,
  67. cmGeneratorTarget const*)
  68. {
  69. // Count the number of object files with each name. Warn about duplicate
  70. // names since Xcode names them uniquely automatically with a numeric suffix
  71. // to avoid exact duplicate file names. Note that Mac file names are not
  72. // typically case sensitive, hence the LowerCase.
  73. std::map<std::string, int> counts;
  74. for(std::map<cmSourceFile const*, std::string>::iterator
  75. si = mapping.begin(); si != mapping.end(); ++si)
  76. {
  77. cmSourceFile const* sf = si->first;
  78. std::string objectName =
  79. cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
  80. objectName += ".o";
  81. std::string objectNameLower = cmSystemTools::LowerCase(objectName);
  82. counts[objectNameLower] += 1;
  83. if (2 == counts[objectNameLower])
  84. {
  85. // TODO: emit warning about duplicate name?
  86. }
  87. si->second = objectName;
  88. }
  89. }