diff options
author | Brad King <brad.king@kitware.com> | 2014-07-18 15:12:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-09-29 20:05:52 (GMT) |
commit | 2f071466ebd4e3a416a523ac5f17c84543ff8b3c (patch) | |
tree | e5a7bd9d212eca3ac892eaa22071d80590146f65 | |
parent | c655f0c417f66096a62bb837e163ec636665dd69 (diff) | |
download | CMake-2f071466ebd4e3a416a523ac5f17c84543ff8b3c.zip CMake-2f071466ebd4e3a416a523ac5f17c84543ff8b3c.tar.gz CMake-2f071466ebd4e3a416a523ac5f17c84543ff8b3c.tar.bz2 |
VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
When CMAKE_SYSTEM_NAME is 'Android', check for an installation of
'NVIDIA Nsight Tegra Visual Studio Edition' and generate .vcxproj
files for the "Tegra-Android" platform. Also make the installed
version available in a CMAKE_VS_NsightTegra_VERSION variable.
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/variable/CMAKE_VS_NsightTegra_VERSION.rst | 7 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 41 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 6 |
4 files changed, 55 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index b00c16e..097eba3 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -74,6 +74,7 @@ Variables that Provide Information /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION /variable/CMAKE_VS_MSBUILD_COMMAND /variable/CMAKE_VS_MSDEV_COMMAND + /variable/CMAKE_VS_NsightTegra_VERSION /variable/CMAKE_VS_PLATFORM_NAME /variable/CMAKE_VS_PLATFORM_TOOLSET /variable/CMAKE_XCODE_PLATFORM_TOOLSET diff --git a/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst new file mode 100644 index 0000000..386c3a9 --- /dev/null +++ b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst @@ -0,0 +1,7 @@ +CMAKE_VS_NsightTegra_VERSION +---------------------------- + +When using a Visual Studio generator with the +:variable:`CMAKE_SYSTEM_NAME` variable set to ``Android``, +this variable contains the version number of the +installed NVIDIA Nsight Tegra Visual Studio Edition. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index e947c54..21d1f34 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -198,6 +198,31 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } + else if(this->SystemName == "Android") + { + if(this->DefaultPlatformName != "Win32") + { + cmOStringStream e; + e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " + << "specifies a platform too: '" << this->GetName() << "'"; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + std::string v = this->GetInstalledNsightTegraVersion(); + if(v.empty()) + { + mf->IssueMessage(cmake::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.c_str()); + } + return true; } @@ -587,3 +612,19 @@ bool cmGlobalVisualStudio10Generator::UseFolderProperty() { return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty(); } + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::IsNsightTegra() const +{ + return !this->NsightTegraVersion.empty(); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion() +{ + std::string version; + cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;" + "Version", version, cmSystemTools::KeyWOW64_32); + return version; +} diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index c02d204..1df98e3 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -59,6 +59,9 @@ public: /** Is the installed VS an Express edition? */ bool IsExpressEdition() const { return this->ExpressEdition; } + /** Generating for Nsight Tegra VS plugin? */ + bool IsNsightTegra() const; + /** The toolset name for the target platform. */ const char* GetPlatformToolset() const; @@ -106,6 +109,8 @@ public: virtual void FindMakeProgram(cmMakefile*); + static std::string GetInstalledNsightTegraVersion(); + protected: virtual void Generate(); virtual bool InitializeSystem(cmMakefile* mf); @@ -124,6 +129,7 @@ protected: std::string DefaultPlatformToolset; std::string SystemName; std::string SystemVersion; + std::string NsightTegraVersion; bool SystemIsWindowsCE; bool SystemIsWindowsPhone; bool SystemIsWindowsStore; |