cmExportInstallAndroidMKGenerator.cxx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 <ostream>
  5. #include <stddef.h>
  6. #include "cmExportBuildAndroidMKGenerator.h"
  7. #include "cmExportSet.h"
  8. #include "cmGeneratorTarget.h"
  9. #include "cmInstallExportGenerator.h"
  10. #include "cmInstallTargetGenerator.h"
  11. #include "cmStateTypes.h"
  12. #include "cmSystemTools.h"
  13. #include "cmTarget.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.empty() ? 0 : 1;
  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 (cmTargetExport* te : *this->IEGen->GetExportSet()->GetTargetExports()) {
  34. // Collect import properties for this target.
  35. if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
  36. continue;
  37. }
  38. std::string dest;
  39. if (te->LibraryGenerator) {
  40. dest = te->LibraryGenerator->GetDestination("");
  41. }
  42. if (te->ArchiveGenerator) {
  43. dest = te->ArchiveGenerator->GetDestination("");
  44. }
  45. te->Target->Target->SetProperty("__dest", dest.c_str());
  46. }
  47. }
  48. void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&)
  49. {
  50. }
  51. void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
  52. std::ostream& os, cmGeneratorTarget const* target,
  53. cmStateEnums::TargetType /*targetType*/)
  54. {
  55. std::string targetName = this->Namespace;
  56. targetName += target->GetExportName();
  57. os << "include $(CLEAR_VARS)\n";
  58. os << "LOCAL_MODULE := ";
  59. os << targetName << "\n";
  60. os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
  61. os << target->Target->GetProperty("__dest") << "/";
  62. std::string config;
  63. if (!this->Configurations.empty()) {
  64. config = this->Configurations[0];
  65. }
  66. os << target->GetFullName(config) << "\n";
  67. }
  68. void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode(
  69. std::ostream&, const std::string&)
  70. {
  71. }
  72. void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode(
  73. std::ostream&, const std::string&, cmGeneratorTarget const*,
  74. ImportPropertyMap const&)
  75. {
  76. }
  77. void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode(
  78. std::ostream&, const std::vector<std::string>&)
  79. {
  80. }
  81. void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
  82. cmGeneratorTarget const* target, std::ostream& os,
  83. const ImportPropertyMap& properties)
  84. {
  85. std::string config;
  86. if (!this->Configurations.empty()) {
  87. config = this->Configurations[0];
  88. }
  89. cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
  90. target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config);
  91. }
  92. void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&)
  93. {
  94. }
  95. void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&)
  96. {
  97. }
  98. void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion(
  99. std::ostream&, const char*)
  100. {
  101. }
  102. void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables(
  103. std::ostream&)
  104. {
  105. }
  106. void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop(
  107. std::ostream&)
  108. {
  109. }
  110. void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode(
  111. std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&,
  112. const std::set<std::string>&)
  113. {
  114. }
  115. bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig(
  116. const std::string&, std::vector<std::string>&)
  117. {
  118. return true;
  119. }