cmExportInstallAndroidMKGenerator.cxx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 "cmExportInstallAndroidMKGenerator.h"
  11. #include "cmAlgorithms.h"
  12. #include "cmExportBuildAndroidMKGenerator.h"
  13. #include "cmExportSet.h"
  14. #include "cmExportSetMap.h"
  15. #include "cmGeneratedFileStream.h"
  16. #include "cmGeneratorTarget.h"
  17. #include "cmGlobalGenerator.h"
  18. #include "cmInstallExportGenerator.h"
  19. #include "cmInstallTargetGenerator.h"
  20. #include "cmLocalGenerator.h"
  21. #include "cmTargetExport.h"
  22. cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator(
  23. cmInstallExportGenerator* iegen)
  24. : cmExportInstallFileGenerator(iegen)
  25. {
  26. }
  27. void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
  28. std::ostream& os, const std::string&)
  29. {
  30. std::string installDir = this->IEGen->GetDestination();
  31. os << "LOCAL_PATH := $(call my-dir)\n";
  32. size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/');
  33. numDotDot += (installDir.size() > 0) ? 1 : 0;
  34. std::string path;
  35. for (size_t n = 0; n < numDotDot; n++) {
  36. path += "/..";
  37. }
  38. os << "_IMPORT_PREFIX := "
  39. << "$(LOCAL_PATH)" << path << "\n\n";
  40. for (std::vector<cmTargetExport*>::const_iterator tei =
  41. this->IEGen->GetExportSet()->GetTargetExports()->begin();
  42. tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
  43. // Collect import properties for this target.
  44. cmTargetExport const* te = *tei;
  45. if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) {
  46. continue;
  47. }
  48. std::string dest;
  49. if (te->LibraryGenerator) {
  50. dest = te->LibraryGenerator->GetDestination("");
  51. }
  52. if (te->ArchiveGenerator) {
  53. dest = te->ArchiveGenerator->GetDestination("");
  54. }
  55. te->Target->Target->SetProperty("__dest", dest.c_str());
  56. }
  57. }
  58. void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&)
  59. {
  60. }
  61. void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
  62. std::ostream& os, const cmGeneratorTarget* target)
  63. {
  64. std::string targetName = this->Namespace;
  65. targetName += target->GetExportName();
  66. os << "include $(CLEAR_VARS)\n";
  67. os << "LOCAL_MODULE := ";
  68. os << targetName << "\n";
  69. os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
  70. os << target->Target->GetProperty("__dest") << "/";
  71. std::string config = "";
  72. if (!this->Configurations.empty()) {
  73. config = this->Configurations[0];
  74. }
  75. os << target->GetFullName(config) << "\n";
  76. }
  77. void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode(
  78. std::ostream&, const std::string&)
  79. {
  80. }
  81. void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode(
  82. std::ostream&, const std::string&, cmGeneratorTarget const*,
  83. ImportPropertyMap const&)
  84. {
  85. }
  86. void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode(
  87. std::ostream&, const std::vector<std::string>&)
  88. {
  89. }
  90. void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
  91. cmGeneratorTarget const* target, std::ostream& os,
  92. const ImportPropertyMap& properties)
  93. {
  94. std::string config = "";
  95. if (!this->Configurations.empty()) {
  96. config = this->Configurations[0];
  97. }
  98. cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
  99. target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config);
  100. }
  101. void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&)
  102. {
  103. }
  104. void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&)
  105. {
  106. }
  107. void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion(
  108. std::ostream&, const char*)
  109. {
  110. }
  111. void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables(
  112. std::ostream&)
  113. {
  114. }
  115. void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop(
  116. std::ostream&)
  117. {
  118. }
  119. void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode(
  120. std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&,
  121. const std::set<std::string>&)
  122. {
  123. }
  124. bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig(
  125. const std::string&, std::vector<std::string>&)
  126. {
  127. return true;
  128. }