Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Source / cmExportInstallAndroidMKGenerator.cxx
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
5 #include <cstddef>
6 #include <memory>
7 #include <ostream>
8 #include <vector>
9
10 #include "cmExportBuildAndroidMKGenerator.h"
11 #include "cmExportSet.h"
12 #include "cmGeneratorTarget.h"
13 #include "cmInstallExportGenerator.h"
14 #include "cmInstallTargetGenerator.h"
15 #include "cmStateTypes.h"
16 #include "cmStringAlgorithms.h"
17 #include "cmSystemTools.h"
18 #include "cmTarget.h"
19 #include "cmTargetExport.h"
20
21 cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator(
22   cmInstallExportGenerator* iegen)
23   : cmExportInstallFileGenerator(iegen)
24 {
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.empty() ? 0 : 1;
34   std::string path;
35   for (size_t n = 0; n < numDotDot; n++) {
36     path += "/..";
37   }
38   os << "_IMPORT_PREFIX := $(LOCAL_PATH)" << path << "\n\n";
39   for (std::unique_ptr<cmTargetExport> const& te :
40        this->IEGen->GetExportSet()->GetTargetExports()) {
41     // Collect import properties for this target.
42     if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
43       continue;
44     }
45     std::string dest;
46     if (te->LibraryGenerator) {
47       dest = te->LibraryGenerator->GetDestination("");
48     }
49     if (te->ArchiveGenerator) {
50       dest = te->ArchiveGenerator->GetDestination("");
51     }
52     te->Target->Target->SetProperty("__dest", dest);
53   }
54 }
55
56 void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&)
57 {
58 }
59
60 void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
61   std::ostream& os, cmGeneratorTarget const* target,
62   cmStateEnums::TargetType /*targetType*/)
63 {
64   std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
65   os << "include $(CLEAR_VARS)\n";
66   os << "LOCAL_MODULE := ";
67   os << targetName << "\n";
68   os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
69   os << target->Target->GetSafeProperty("__dest") << "/";
70   std::string config;
71   if (!this->Configurations.empty()) {
72     config = this->Configurations[0];
73   }
74   os << target->GetFullName(config) << "\n";
75 }
76
77 void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode(
78   std::ostream&, const std::string&)
79 {
80 }
81
82 void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode(
83   std::ostream&, const std::string&, cmGeneratorTarget const*,
84   ImportPropertyMap const&)
85 {
86 }
87
88 void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode(
89   std::ostream&)
90 {
91 }
92
93 void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
94   cmGeneratorTarget const* target, std::ostream& os,
95   const ImportPropertyMap& properties)
96 {
97   std::string config;
98   if (!this->Configurations.empty()) {
99     config = this->Configurations[0];
100   }
101   cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
102     target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config);
103 }
104
105 void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&)
106 {
107 }
108
109 void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&)
110 {
111 }
112
113 void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion(
114   std::ostream&, const char*)
115 {
116 }
117
118 void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables(
119   std::ostream&)
120 {
121 }
122
123 void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop(
124   std::ostream&)
125 {
126 }
127
128 void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode(
129   std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&,
130   const std::set<std::string>&)
131 {
132 }
133
134 bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig(
135   const std::string&)
136 {
137   return true;
138 }