Commit ab83a219 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'visual-studio-android'

6051a49c Visual Studio: Add Android support
bbcaf968 Refactor: Add IsAndroidGuiExecutable() method to cmTarget
14456923 cmGlobalVisualStudio10Generator: Move variable initialization to header
d5b5c192 cmGlobalGenerator: FindMakeProgram() before CMakeDetermineSystem
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !4898
parents 6e0143f3 6051a49c
Pipeline #179093 canceled with stages
in 49 minutes and 9 seconds
visual-studio-android
---------------------
* The :ref:`Visual Studio Generators` for Visual Studio 2015 and above gained
support for the Visual Studio Tools for Android. This allows you to set
:variable:`CMAKE_SYSTEM_NAME` to `Android` to generate `.vcxproj` files for
the Android tools.
......@@ -248,7 +248,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_PostBuildEvent_Command "")
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$")
set(id_cl_var "ClangClExecutable")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg][Cc][Ll]$")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg]([Cc][Ll]$|_[0-9])")
set(id_cl "$(CLToolExe)")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
set(id_cl clang.exe)
......@@ -310,17 +310,36 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_PreferredToolArchitecture "")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(id_keyword "Win32Proj")
set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(id_keyword "Win32Proj")
set(id_system "<ApplicationType>Windows Store</ApplicationType>")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(id_keyword "Android")
set(id_system "<ApplicationType>Android</ApplicationType>")
else()
set(id_keyword "Win32Proj")
set(id_system "")
endif()
if(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
if(id_keyword STREQUAL "Android")
if(CMAKE_GENERATOR MATCHES "Visual Studio 14")
set(id_system_version "<ApplicationTypeRevision>2.0</ApplicationTypeRevision>")
elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]")
set(id_system_version "<ApplicationTypeRevision>3.0</ApplicationTypeRevision>")
else()
set(id_system_version "")
endif()
elseif(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
set(id_system_version "<ApplicationTypeRevision>${CMAKE_MATCH_1}</ApplicationTypeRevision>")
else()
set(id_system_version "")
endif()
if(id_keyword STREQUAL "Android")
set(id_config_type "DynamicLibrary")
else()
set(id_config_type "Application")
endif()
if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
set(id_WindowsTargetPlatformVersion "<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>")
endif()
......@@ -333,9 +352,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
string(APPEND id_CustomGlobals "<${CMAKE_MATCH_1}>${CMAKE_MATCH_2}</${CMAKE_MATCH_1}>\n ")
endif()
endforeach()
if(id_platform STREQUAL ARM64)
if(id_keyword STREQUAL "Android")
set(id_WindowsSDKDesktopARMSupport "")
elseif(id_platform STREQUAL "ARM64")
set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>")
elseif(id_platform STREQUAL ARM)
elseif(id_platform STREQUAL "ARM")
set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
else()
set(id_WindowsSDKDesktopARMSupport "")
......
......@@ -9,7 +9,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
<Keyword>@id_keyword@</Keyword>
@id_system@
@id_system_version@
@id_WindowsTargetPlatformVersion@
......@@ -24,7 +24,7 @@
@id_PreferredToolArchitecture@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>@id_config_type@</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
......
......@@ -53,4 +53,7 @@ macro(__android_compiler_clang lang)
endif()
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(_ANDROID_STL_NOSTDLIBXX 1)
endif()
endmacro()
......@@ -7,8 +7,8 @@
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
if(CMAKE_GENERATOR MATCHES "Visual Studio")
# that functionality for now.
if(CMAKE_GENERATOR_PLATFORM STREQUAL "Tegra-Android")
return()
endif()
......@@ -27,6 +27,63 @@ endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# If using Android tools for Visual Studio, compile a sample project to get the
# sysroot.
if(CMAKE_GENERATOR MATCHES "Visual Studio")
if(NOT CMAKE_SYSROOT)
set(vcx_platform ${CMAKE_GENERATOR_PLATFORM})
if(CMAKE_GENERATOR MATCHES "Visual Studio 1[45]")
set(vcx_sysroot_var "Sysroot")
else()
set(vcx_sysroot_var "SysrootLink")
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 14")
set(vcx_revision "2.0")
elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]")
set(vcx_revision "3.0")
else()
set(vcx_revision "")
endif()
configure_file(${CMAKE_ROOT}/Modules/Platform/Android/VCXProjInspect.vcxproj.in
${CMAKE_PLATFORM_INFO_DIR}/VCXProjInspect.vcxproj @ONLY)
execute_process(
COMMAND "${CMAKE_VS_MSBUILD_COMMAND}" "VCXProjInspect.vcxproj"
"/p:Configuration=Debug" "/p:Platform=${vcx_platform}"
WORKING_DIRECTORY ${CMAKE_PLATFORM_INFO_DIR}
OUTPUT_VARIABLE VCXPROJ_INSPECT_OUTPUT
ERROR_VARIABLE VCXPROJ_INSPECT_OUTPUT
RESULT_VARIABLE VCXPROJ_INSPECT_RESULT
)
if(NOT CMAKE_SYSROOT AND VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_SYSROOT=([^%\r\n]+)[\r\n]")
# Strip VS diagnostic output from the end of the line.
string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _sysroot "${CMAKE_MATCH_1}")
if(EXISTS "${_sysroot}")
file(TO_CMAKE_PATH "${_sysroot}" CMAKE_SYSROOT)
endif()
endif()
if(VCXPROJ_INSPECT_RESULT)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining the sysroot for the Android NDK failed.
The output was:
${VCXPROJ_INSPECT_RESULT}
${VCXPROJ_INSPECT_OUTPUT}
")
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining the sysroot for the Android NDK succeeded.
The output was:
${VCXPROJ_INSPECT_RESULT}
${VCXPROJ_INSPECT_OUTPUT}
")
endif()
endif()
if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION "clang")
endif()
endif()
# If the user provided CMAKE_SYSROOT for us, extract information from it.
set(_ANDROID_SYSROOT_NDK "")
set(_ANDROID_SYSROOT_API "")
......
......@@ -6,7 +6,7 @@
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
# that functionality for now.
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return()
endif()
......
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|@vcx_platform@">
<Configuration>Debug</Configuration>
<Platform>@vcx_platform@</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{14D44772-ECF7-47BD-9E29-BC62FAF940A5}</ProjectGuid>
<RootNamespace>VCXProjInspect</RootNamespace>
<Keyword>Android</Keyword>
<ApplicationType>Android</ApplicationType>
<ApplicationTypeRevision>@vcx_revision@</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'">
<PostBuildEvent>
<Command>%40echo CMAKE_SYSROOT=$(@vcx_sysroot_var@)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
......@@ -596,6 +596,16 @@ void cmGlobalGenerator::EnableLanguage(
mf->ReadListFile(fpath);
}
}
if (readCMakeSystem) {
// Find the native build tool for this generator.
// This has to be done early so that MSBuild can be used to examine the
// cross-compilation environment.
if (!this->FindMakeProgram(mf)) {
return;
}
}
// Load the CMakeDetermineSystem.cmake file and find out
// what platform we are running on
if (!mf->GetDefinition("CMAKE_SYSTEM")) {
......@@ -667,11 +677,6 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::SetFatalErrorOccured();
return;
}
// Find the native build tool for this generator.
if (!this->FindMakeProgram(mf)) {
return;
}
}
// Check that the languages are supported by the generator and its
......
......@@ -138,9 +138,6 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
"ProductDir",
vc10Express, cmSystemTools::KeyWOW64_32);
this->CudaEnabled = false;
this->SystemIsWindowsCE = false;
this->SystemIsWindowsPhone = false;
this->SystemIsWindowsStore = false;
this->MSBuildCommandInitialized = false;
{
std::string envPlatformToolset;
......@@ -511,18 +508,16 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
std::string v = this->GetInstalledNsightTegraVersion();
if (v.empty()) {
mf->IssueMessage(MessageType::FATAL_ERROR,
"CMAKE_SYSTEM_NAME is 'Android' but "
"'NVIDIA Nsight Tegra Visual Studio Edition' "
"is not installed.");
return false;
if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == "Tegra-Android") {
if (!this->InitializeTegraAndroid(mf)) {
return false;
}
} else {
this->SystemIsAndroid = true;
if (!this->InitializeAndroid(mf)) {
return false;
}
}
this->DefaultPlatformName = "Tegra-Android";
this->DefaultPlatformToolset = "Default";
this->NsightTegraVersion = v;
mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v);
}
return true;
......@@ -564,6 +559,31 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
return false;
}
bool cmGlobalVisualStudio10Generator::InitializeTegraAndroid(cmMakefile* mf)
{
std::string v = this->GetInstalledNsightTegraVersion();
if (v.empty()) {
mf->IssueMessage(MessageType::FATAL_ERROR,
"CMAKE_SYSTEM_NAME is 'Android' but "
"'NVIDIA Nsight Tegra Visual Studio Edition' "
"is not installed.");
return false;
}
this->DefaultPlatformName = "Tegra-Android";
this->DefaultPlatformToolset = "Default";
this->NsightTegraVersion = v;
mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v);
return true;
}
bool cmGlobalVisualStudio10Generator::InitializeAndroid(cmMakefile* mf)
{
std::ostringstream e;
e << this->GetName() << " does not support Android.";
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
bool cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
std::string& toolset) const
{
......@@ -598,6 +618,28 @@ void cmGlobalVisualStudio10Generator::Generate()
{
this->LongestSource = LongestSourcePath();
this->cmGlobalVisualStudio8Generator::Generate();
if (!this->AndroidExecutableWarnings.empty() &&
!this->CMakeInstance->GetIsInTryCompile()) {
std::ostringstream e;
/* clang-format off */
e <<
"You are using Visual Studio tools for Android, which does not support "
"standalone executables. However, the following executable targets do "
"not have the ANDROID_GUI property set, and thus will not be built as "
"expected. They will be built as shared libraries with executable "
"filenames:\n"
" ";
/* clang-format on */
bool first = true;
for (auto const& name : this->AndroidExecutableWarnings) {
if (!first) {
e << ", ";
}
first = false;
e << name;
}
this->CMakeInstance->IssueMessage(MessageType::WARNING, e.str());
}
if (this->LongestSource.Length > 0) {
cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
std::ostringstream e;
......@@ -664,8 +706,14 @@ std::string const& cmGlobalVisualStudio10Generator::GetPlatformToolsetString()
if (!this->GeneratorToolset.empty()) {
return this->GeneratorToolset;
}
if (!this->DefaultPlatformToolset.empty()) {
return this->DefaultPlatformToolset;
if (this->SystemIsAndroid) {
if (!this->DefaultAndroidToolset.empty()) {
return this->DefaultAndroidToolset;
}
} else {
if (!this->DefaultPlatformToolset.empty()) {
return this->DefaultPlatformToolset;
}
}
static std::string const empty;
return empty;
......@@ -879,7 +927,10 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
epg.Attribute("Label", "Globals");
cmXMLElement(epg, "ProjectGuid")
.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}");
cmXMLElement(epg, "Keyword").Content("Win32Proj");
cmXMLElement(epg, "Keyword")
.Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android"
? "Android"
: "Win32Proj");
cmXMLElement(epg, "Platform").Content(this->GetPlatformName());
if (this->GetSystemName() == "WindowsPhone") {
cmXMLElement(epg, "ApplicationType").Content("Windows Phone");
......@@ -889,15 +940,21 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
cmXMLElement(epg, "ApplicationType").Content("Windows Store");
cmXMLElement(epg, "ApplicationTypeRevision")
.Content(this->GetApplicationTypeRevision());
} else if (this->GetSystemName() == "Android") {
cmXMLElement(epg, "ApplicationType").Content("Android");
cmXMLElement(epg, "ApplicationTypeRevision")
.Content(this->GetApplicationTypeRevision());
}
if (!this->WindowsTargetPlatformVersion.empty()) {
cmXMLElement(epg, "WindowsTargetPlatformVersion")
.Content(this->WindowsTargetPlatformVersion);
}
if (this->GetPlatformName() == "ARM64") {
cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true");
} else if (this->GetPlatformName() == "ARM") {
cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true");
if (this->GetSystemName() != "Android") {
if (this->GetPlatformName() == "ARM64") {
cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true");
} else if (this->GetPlatformName() == "ARM") {
cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true");
}
}
}
cmXMLElement(eprj, "Import")
......@@ -1209,6 +1266,10 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const
{
if (this->GetSystemName() == "Android") {
return this->GetAndroidApplicationTypeRevision();
}
// Return the first two '.'-separated components of the Windows version.
std::string::size_type end1 = this->SystemVersion.find('.');
std::string::size_type end2 =
......
......@@ -4,6 +4,7 @@
#define cmGlobalVisualStudio10Generator_h
#include <memory>
#include <set>
#include "cmGlobalVisualStudio8Generator.h"
#include "cmVisualStudio10ToolsetOptions.h"
......@@ -43,6 +44,11 @@ public:
void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
bool optional) override;
void AddAndroidExecutableWarning(const std::string& name)
{
this->AndroidExecutableWarnings.insert(name);
}
bool IsCudaEnabled() const { return this->CudaEnabled; }
/** Generating for Nsight Tegra VS plugin? */
......@@ -100,6 +106,9 @@ public:
/** Return true if building for WindowsStore */
bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
/** Return true if building for Android */
bool TargetsAndroid() const { return this->SystemIsAndroid; }
const char* GetCMakeCFGIntDir() const override { return "$(Configuration)"; }
bool Find64BitTools(cmMakefile* mf);
......@@ -128,6 +137,8 @@ public:
/** Return the first two components of CMAKE_SYSTEM_VERSION. */
std::string GetApplicationTypeRevision() const;
virtual const char* GetAndroidApplicationTypeRevision() const { return ""; }
cmIDEFlagTable const* GetClFlagTable() const;
cmIDEFlagTable const* GetCSharpFlagTable() const;
cmIDEFlagTable const* GetRcFlagTable() const;
......@@ -148,6 +159,8 @@ protected:
virtual bool InitializeWindowsCE(cmMakefile* mf);
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual bool InitializeTegraAndroid(cmMakefile* mf);
virtual bool InitializeAndroid(cmMakefile* mf);
virtual bool ProcessGeneratorToolsetField(std::string const& key,
std::string const& value);
......@@ -171,6 +184,7 @@ protected:
std::string GeneratorToolsetCudaCustomDir;
std::string DefaultPlatformToolset;
std::string DefaultPlatformToolsetHostArchitecture;
std::string DefaultAndroidToolset;
std::string WindowsTargetPlatformVersion;
std::string SystemName;
std::string SystemVersion;
......@@ -185,9 +199,10 @@ protected:
std::string DefaultNasmFlagTableName;
std::string DefaultRCFlagTableName;
bool SupportsUnityBuilds = false;
bool SystemIsWindowsCE;
bool SystemIsWindowsPhone;
bool SystemIsWindowsStore;
bool SystemIsWindowsCE = false;
bool SystemIsWindowsPhone = false;
bool SystemIsWindowsStore = false;
bool SystemIsAndroid = false;
private:
class Factory;
......@@ -211,6 +226,7 @@ private:
std::string MSBuildCommand;
bool MSBuildCommandInitialized;
cmVisualStudio10ToolsetOptions ToolsetOptions;
std::set<std::string> AndroidExecutableWarnings;
virtual std::string FindMSBuildCommand();
std::string FindDevEnvCommand() override;
std::string GetVSMakeProgram() override { return this->GetMSBuildCommand(); }
......
......@@ -109,6 +109,7 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
"ProductDir",
vc14Express, cmSystemTools::KeyWOW64_32);
this->DefaultPlatformToolset = "v140";
this->DefaultAndroidToolset = "Clang_3_8";
this->DefaultCLFlagTableName = "v140";
this->DefaultCSharpFlagTableName = "v140";
this->DefaultLibFlagTableName = "v14";
......@@ -159,6 +160,11 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf)
return true;
}
bool cmGlobalVisualStudio14Generator::InitializeAndroid(cmMakefile*)
{
return true;
}
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
bool required)
{
......
......@@ -23,12 +23,18 @@ public:
bool MatchesGeneratorName(const std::string& name) const override;
const char* GetAndroidApplicationTypeRevision() const override
{
return "2.0";
}
protected:
cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool InitializeWindows(cmMakefile* mf) override;
bool InitializeWindowsStore(cmMakefile* mf) override;
bool InitializeAndroid(cmMakefile* mf) override;
bool SelectWindowsStoreToolset(std::string& toolset) const override;
// These aren't virtual because we need to check if the selected version
......
......@@ -100,6 +100,24 @@ static const char* VSVersionToToolset(
return "";
}
static const char* VSVersionToAndroidToolset(
cmGlobalVisualStudioGenerator::VSVersion v)
{
switch (v) {
case cmGlobalVisualStudioGenerator::VS9:
case cmGlobalVisualStudioGenerator::VS10:
case cmGlobalVisualStudioGenerator::VS11:
case cmGlobalVisualStudioGenerator::VS12:
return "";
case cmGlobalVisualStudioGenerator::VS14:
return "Clang_3_8";
case cmGlobalVisualStudioGenerator::VS15:
case cmGlobalVisualStudioGenerator::VS16:
return "Clang_5_0";
}
return "";
}
static const char vs15generatorName[] = "Visual Studio 15 2017";
// Map generator name without year to name with year.
......@@ -284,6 +302,7 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
this->Version = version;
this->ExpressEdition = false;
this->DefaultPlatformToolset = VSVersionToToolset(this->Version);
this->DefaultAndroidToolset = VSVersionToAndroidToolset(this->Version);
this->DefaultCLFlagTableName = VSVersionToToolset(this->Version);
this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version);
this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version);
......@@ -408,6 +427,25 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
vsInstanceVersion > vsInstanceVersion16_7_P2);
}
const char*
cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision()
const
{
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VS9:
case cmGlobalVisualStudioGenerator::VS10:
case cmGlobalVisualStudioGenerator::VS11:
case cmGlobalVisualStudioGenerator::VS12:
return "";
case cmGlobalVisualStudioGenerator::VS14:
return "2.0";
case cmGlobalVisualStudioGenerator::VS15:
case cmGlobalVisualStudioGenerator::VS16:
return "3.0";
}
return "";
}
std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
{
const char* version = this->GetPlatformToolsetVersion();
......
......@@ -36,6 +36,8 @@ public:
bool IsStdOutEncodingSupported() const override;
const char* GetAndroidApplicationTypeRevision() const override;