Add 'ANDROID_API_MIN' target property to set Android Target MIN API

Also add a 'CMAKE_ANDROID_API_MIN' variable to set the property
default.  Teach the VS generator to write the MIN API value into
Nsight Tegra project files.
This commit is contained in:
Dmitry Polyanitsa 2014-12-17 17:11:51 +03:00 committed by Brad King
parent 1b3ab3318d
commit eeaa25e521
9 changed files with 30 additions and 2 deletions

View File

@ -80,6 +80,7 @@ Properties on Targets
/prop_tgt/ALIASED_TARGET
/prop_tgt/ANDROID_API
/prop_tgt/ANDROID_API_MIN
/prop_tgt/ANDROID_GUI
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY

View File

@ -256,5 +256,6 @@ like this:
The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select
the Nsight Tegra "Toolchain Version" value.
See the :prop_tgt:`ANDROID_API` and :prop_tgt:`ANDROID_GUI`
target properties to configure targets within the project.
See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API`
and :prop_tgt:`ANDROID_GUI` target properties to configure
targets within the project.

View File

@ -206,6 +206,7 @@ Variables that Control the Build
:maxdepth: 1
/variable/CMAKE_ANDROID_API
/variable/CMAKE_ANDROID_API_MIN
/variable/CMAKE_ANDROID_GUI
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_AUTOMOC_MOC_OPTIONS

View File

@ -0,0 +1,7 @@
ANDROID_API_MIN
---------------
Set the Android MIN API version (e.g. ``9``). The version number
must be a positive decimal integer. This property is initialized by
the value of the :variable:`CMAKE_ANDROID_API_MIN` variable if it is set
when a target is created. Native code builds using this API version.

View File

@ -0,0 +1,5 @@
vs-nsight-tegra-min-api
-----------------------
* A :prop_tgt:`ANDROID_API_MIN` target property was introduced to
specify the minimum version to be targeted by the toolchain.

View File

@ -0,0 +1,5 @@
CMAKE_ANDROID_API_MIN
---------------------
Default value for the :prop_tgt:`ANDROID_API_MIN` target property.
See that target property for additional information.

View File

@ -325,6 +325,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
{
this->SetPropertyDefault("ANDROID_API", 0);
this->SetPropertyDefault("ANDROID_API_MIN", 0);
this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");

View File

@ -748,6 +748,12 @@ void cmVisualStudio10TargetGenerator
ntv += toolset? toolset : "Default";
ntv += "</NdkToolchainVersion>\n";
this->WriteString(ntv.c_str(), 2);
if(const char* minApi = this->Target->GetProperty("ANDROID_API_MIN"))
{
this->WriteString("<AndroidMinAPI>", 2);
(*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(minApi) << "</AndroidMinAPI>\n";
}
if(const char* api = this->Target->GetProperty("ANDROID_API"))
{
this->WriteString("<AndroidTargetAPI>", 2);

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.0)
project(VSNsightTegra C CXX)
set(CMAKE_ANDROID_API_MIN 9)
set(CMAKE_ANDROID_API 15)
set(CMAKE_ANDROID_GUI 1)