diff options
author | Brad King <brad.king@kitware.com> | 2014-09-30 12:46:27 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-09-30 12:46:27 (GMT) |
commit | 34d035e70e3ef3f79212bd8c5b5d36250090d856 (patch) | |
tree | b53d2983bb643e26cc2872e174c09292b6c5ca5c /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 026c4a5d1b3ac3297b7a205d779cfcff6f74a67a (diff) | |
parent | df84281d68a715658ce0068c0869dd80831cd4a7 (diff) | |
download | CMake-34d035e70e3ef3f79212bd8c5b5d36250090d856.zip CMake-34d035e70e3ef3f79212bd8c5b5d36250090d856.tar.gz CMake-34d035e70e3ef3f79212bd8c5b5d36250090d856.tar.bz2 |
Merge topic 'vs-nsight-tegra-generator'
df84281d Help: Add notes for topic 'vs-nsight-tegra-generator'
69e198dc VS: Generate Nsight Tegra project revision number
5365c9ac VS: Map Nsight Tegra file types in .vcxproj files
178f56a5 VS: Fix Tegra-Android platform linking of libraries by name
7115702f Tests: Add test for VS Nsight Tegra generator support
a6289499 VS: Generate ANDROID_GUI executables as app packages
c12e4699 Add 'ANDROID_API' target property to set Android Target API
9a4df52a Add 'ANDROID_GUI' target property to mark Android applications
16569abf cmTarget: Track internally whether platform is Android
ef0fd4f0 VS: Teach vcxproj generation about the Tegra-Android platform
d09b60f5 VS: Detect compiler id of Nsight Tegra-Android toolchains
2f071466 VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 155 |
1 files changed, 152 insertions, 3 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a8357a7..26fc317 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -180,7 +180,16 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); - this->MSTools = true; + this->NsightTegra = gg->IsNsightTegra(); + for(int i = + sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u", + &this->NsightTegraVersion[0], &this->NsightTegraVersion[1], + &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]); + i < 4; ++i) + { + this->NsightTegraVersion[i] = 0; + } + this->MSTools = !this->NsightTegra; this->TargetCompileAsWinRT = false; this->BuildFileStream = 0; this->IsMissingFiles = false; @@ -312,6 +321,30 @@ void cmVisualStudio10TargetGenerator::Generate() "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"); this->WriteString(project_defaults.c_str(),0); + if(this->NsightTegra) + { + this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1); + if(this->NsightTegraVersion[0] >= 2) + { + // Nsight Tegra 2.0 uses project revision 8. + this->WriteString("<NsightTegraProjectRevisionNumber>" + "8" + "</NsightTegraProjectRevisionNumber>\n", 2); + // Tell newer versions to upgrade silently when loading. + this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>" + "true" + "</NsightTegraUpgradeOnceWithoutPrompt>\n", 2); + } + else + { + // Require Nsight Tegra 1.6 for JCompile support. + this->WriteString("<NsightTegraProjectRevisionNumber>" + "7" + "</NsightTegraProjectRevisionNumber>\n", 2); + } + this->WriteString("</PropertyGroup>\n", 1); + } + this->WriteProjectConfigurations(); this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1); this->WriteString("<ProjectGUID>", 2); @@ -605,11 +638,28 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "StaticLibrary"; break; case cmTarget::EXECUTABLE: - configType += "Application"; + if(this->NsightTegra && + !this->Target->GetPropertyAsBool("ANDROID_GUI")) + { + // Android executables are .so too. + configType += "DynamicLibrary"; + } + else + { + configType += "Application"; + } break; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: - configType += "Utility"; + if(this->NsightTegra) + { + // Tegra-Android platform does not understand "Utility". + configType += "StaticLibrary"; + } + else + { + configType += "Utility"; + } break; case cmTarget::UNKNOWN_LIBRARY: case cmTarget::INTERFACE_LIBRARY: @@ -622,6 +672,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { this->WriteMSToolConfigurationValues(*i); } + else if(this->NsightTegra) + { + this->WriteNsightTegraConfigurationValues(*i); + } this->WriteString("</PropertyGroup>\n", 1); } @@ -683,6 +737,25 @@ void cmVisualStudio10TargetGenerator } } +//---------------------------------------------------------------------------- +void cmVisualStudio10TargetGenerator +::WriteNsightTegraConfigurationValues(std::string const&) +{ + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); + const char* toolset = gg->GetPlatformToolset(); + std::string ntv = "<NdkToolchainVersion>"; + ntv += toolset? toolset : "Default"; + ntv += "</NdkToolchainVersion>\n"; + this->WriteString(ntv.c_str(), 2); + if(const char* api = this->Target->GetProperty("ANDROID_API")) + { + this->WriteString("<AndroidTargetAPI>", 2); + (*this->BuildFileStream ) << + "android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n"; + } +} + void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); @@ -1150,6 +1223,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { tool = "XML"; } + if(this->NsightTegra) + { + // Nsight Tegra needs specific file types to check up-to-dateness. + std::string name = + cmSystemTools::LowerCase(sf->GetLocation().GetName()); + if(name == "androidmanifest.xml" || + name == "build.xml" || + name == "proguard.cfg" || + name == "proguard-project.txt" || + ext == "properties") + { + tool = "AndroidBuild"; + } + else if(ext == "java") + { + tool = "JCompile"; + } + else if(ext == "asm" || ext == "s") + { + tool = "ClCompile"; + } + } std::string deployContent; if(this->GlobalGenerator->TargetsWindowsPhone() || @@ -1974,6 +2069,50 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) } } + +//---------------------------------------------------------------------------- +void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( + std::string const&) +{ + // Look through the sources for AndroidManifest.xml and use + // its location as the root source directory. + std::string rootDir = this->Makefile->GetCurrentDirectory(); + { + std::vector<cmSourceFile const*> extraSources; + this->GeneratorTarget->GetExtraSources(extraSources, ""); + for(std::vector<cmSourceFile const*>::const_iterator si = + extraSources.begin(); si != extraSources.end(); ++si) + { + if("androidmanifest.xml" == cmSystemTools::LowerCase( + (*si)->GetLocation().GetName())) + { + rootDir = (*si)->GetLocation().GetDirectory(); + break; + } + } + } + + // Tell MSBuild to launch Ant. + { + std::string antBuildPath = rootDir; + this->WriteString("<AntBuild>\n", 2); + this->WriteString("<AntBuildPath>", 3); + this->ConvertToWindowsSlash(antBuildPath); + (*this->BuildFileStream) << + cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n"; + } + + { + std::string manifest_xml = rootDir + "/AndroidManifest.xml"; + this->ConvertToWindowsSlash(manifest_xml); + this->WriteString("<AndroidManifestLocation>", 3); + (*this->BuildFileStream) << + cmVS10EscapeXML(manifest_xml) << "</AndroidManifestLocation>\n"; + } + + this->WriteString("</AntBuild>\n", 2); +} + //---------------------------------------------------------------------------- bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() { @@ -2198,6 +2337,10 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib"); } } + else if(this->NsightTegra) + { + linkOptions.AddFlag("SoName", targetNameSO.c_str()); + } linkOptions.Parse(flags.c_str()); @@ -2347,6 +2490,12 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WriteLinkOptions(*i); // output lib flags <Lib></Lib> this->WriteLibOptions(*i); + if(this->NsightTegra && + this->Target->GetType() == cmTarget::EXECUTABLE && + this->Target->GetPropertyAsBool("ANDROID_GUI")) + { + this->WriteAntBuildOptions(*i); + } this->WriteString("</ItemDefinitionGroup>\n", 1); } } |