cmExportInstallAndroidMKGenerator.cxx 4.0 KB

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