From 7e78f40368faec702b4dff9908aa40ba7a770916 Mon Sep 17 00:00:00 2001
From: Mikhail Filimonov <mfilimonov@nvidia.com>
Date: Thu, 25 Jun 2015 20:15:06 +0300
Subject: [PATCH] Extended Nsight Tegra support for CMake

---
 Help/manual/cmake-properties.7.rst                 |  14 +++
 Help/manual/cmake-toolchains.7.rst                 |  13 ++-
 Help/manual/cmake-variables.7.rst                  |  14 +++
 Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst   |   8 ++
 Help/prop_tgt/ANDROID_ARCH.rst                     |  15 +++
 Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst       |   9 ++
 Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst         |   7 ++
 Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst          |   8 ++
 Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst          |   8 ++
 Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst  |   7 ++
 Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst   |   8 ++
 Help/prop_tgt/ANDROID_PROCESS_MAX.rst              |   8 ++
 Help/prop_tgt/ANDROID_PROGUARD.rst                 |   9 ++
 Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst     |   9 ++
 Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst        |   8 ++
 Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst            |   6 ++
 Help/prop_tgt/ANDROID_STL_TYPE.rst                 |  15 +++
 .../CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst       |   5 +
 Help/variable/CMAKE_ANDROID_ARCH.rst               |   5 +
 Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst |   5 +
 Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst   |   5 +
 Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst    |   5 +
 Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst    |   5 +
 .../CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst      |   5 +
 .../CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst       |   5 +
 Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst        |   5 +
 Help/variable/CMAKE_ANDROID_PROGUARD.rst           |   5 +
 .../CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst         |   5 +
 Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst  |   5 +
 Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst      |   5 +
 Help/variable/CMAKE_ANDROID_STL_TYPE.rst           |   5 +
 Source/cmTarget.cxx                                |  14 +++
 Source/cmVisualStudio10TargetGenerator.cxx         | 103 ++++++++++++++++++++-
 Tests/CMakeLists.txt                               |   2 +-
 Tests/VSNsightTegra/CMakeLists.txt                 |  17 +++-
 Tests/VSNsightTegra/NsightTegraToolchain.cmake     |   4 +
 Tests/VSNsightTegra/proguard-android.txt           |  57 ++++++++++++
 37 files changed, 421 insertions(+), 12 deletions(-)
 create mode 100644 Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst
 create mode 100644 Help/prop_tgt/ANDROID_ARCH.rst
 create mode 100644 Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst
 create mode 100644 Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst
 create mode 100644 Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst
 create mode 100644 Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst
 create mode 100644 Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst
 create mode 100644 Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst
 create mode 100644 Help/prop_tgt/ANDROID_PROCESS_MAX.rst
 create mode 100644 Help/prop_tgt/ANDROID_PROGUARD.rst
 create mode 100644 Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst
 create mode 100644 Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst
 create mode 100644 Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst
 create mode 100644 Help/prop_tgt/ANDROID_STL_TYPE.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_ARCH.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_PROGUARD.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst
 create mode 100644 Help/variable/CMAKE_ANDROID_STL_TYPE.rst
 create mode 100644 Tests/VSNsightTegra/NsightTegraToolchain.cmake
 create mode 100644 Tests/VSNsightTegra/proguard-android.txt

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index b767ed6..910d8b9 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -85,9 +85,23 @@ Properties on Targets
    :maxdepth: 1
 
    /prop_tgt/ALIASED_TARGET
+   /prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS
    /prop_tgt/ANDROID_API
    /prop_tgt/ANDROID_API_MIN
+   /prop_tgt/ANDROID_ARCH
+   /prop_tgt/ANDROID_ASSETS_DIRECTORIES
    /prop_tgt/ANDROID_GUI
+   /prop_tgt/ANDROID_JAR_DEPENDENCIES
+   /prop_tgt/ANDROID_JAR_DIRECTORIES
+   /prop_tgt/ANDROID_JAVA_SOURCE_DIR
+   /prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES
+   /prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES
+   /prop_tgt/ANDROID_PROCESS_MAX
+   /prop_tgt/ANDROID_PROGUARD
+   /prop_tgt/ANDROID_PROGUARD_CONFIG_PATH
+   /prop_tgt/ANDROID_SECURE_PROPS_PATH
+   /prop_tgt/ANDROID_SKIP_ANT_STEP
+   /prop_tgt/ANDROID_STL_TYPE
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
    /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index 054438d..89ee60a 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -256,6 +256,13 @@ like this:
 The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select
 the Nsight Tegra "Toolchain Version" value.
 
-See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API`
-and :prop_tgt:`ANDROID_GUI` target properties to configure
-targets within the project.
+See the :prop_tgt:`ANROID_ANT_ADDITIONAL_OPTIONS`
+:prop_tgt:`ANROID_API`, :prop_tgt:`ANROID_API_MIN`,
+:prop_tgt:`ANROID_ARCH`, :prop_tgt:`ANROID_ASSETS_DIRECTORIES`,
+:prop_tgt:`ANROID_GUI`, :prop_tgt:`ANROID_JAR_DEPENDENCIES`,
+:prop_tgt:`ANROID_JAR_DIRECTORIES`, :prop_tgt:`ANROID_JAVA_SOURCE_DIR`,
+:prop_tgt:`ANROID_NATIVE_LIB_DEPENDENCIES`,:prop_tgt:`ANROID_NATIVE_LIB_DIRECTORIES`,
+:prop_tgt:`ANROID_PROCESS_MAX`, :prop_tgt:`ANROID_PROGUARD`,
+:prop_tgt:`ANROID_PROGUARD_CONFIG_PATH`, :prop_tgt:`ANROID_SECURE_PROPS_PATH`,
+:prop_tgt:`ANROID_SKIP_ANT_STEP`, :prop_tgt:`ANROID_STL_TYPE`
+target properties to configure targets within the project.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index f54436a..35a67c3 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -213,9 +213,23 @@ Variables that Control the Build
 .. toctree::
    :maxdepth: 1
 
+   /variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS
    /variable/CMAKE_ANDROID_API
    /variable/CMAKE_ANDROID_API_MIN
+   /variable/CMAKE_ANDROID_ARCH
+   /variable/CMAKE_ANDROID_ASSETS_DIRECTORIES
    /variable/CMAKE_ANDROID_GUI
+   /variable/CMAKE_ANDROID_JAR_DEPENDENCIES
+   /variable/CMAKE_ANDROID_JAR_DIRECTORIES
+   /variable/CMAKE_ANDROID_JAVA_SOURCE_DIR
+   /variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES
+   /variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES
+   /variable/CMAKE_ANDROID_PROCESS_MAX
+   /variable/CMAKE_ANDROID_PROGUARD
+   /variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH
+   /variable/CMAKE_ANDROID_SECURE_PROPS_PATH
+   /variable/CMAKE_ANDROID_SKIP_ANT_STEP
+   /variable/CMAKE_ANDROID_STL_TYPE
    /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
    /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
    /variable/CMAKE_AUTOMOC_MOC_OPTIONS
diff --git a/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst
new file mode 100644
index 0000000..af6b405
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst
@@ -0,0 +1,8 @@
+ANDROID_ANT_ADDITIONAL_OPTIONS
+------------------------------
+
+Set the additional options for Android Ant build system. This is
+a string value containing all command line options for the Ant build.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS` variable if it is
+set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_ARCH.rst b/Help/prop_tgt/ANDROID_ARCH.rst
new file mode 100644
index 0000000..aff1189
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_ARCH.rst
@@ -0,0 +1,15 @@
+ANDROID_ARCH
+------------
+
+Set the Android target architecture.
+This is a string property that could be set to the one of
+the following values:
+``multiple``     e.g. "Multiple"
+``armv7-a``      e.g. "ARMv7-A (armv7-a)"
+``armv7-a-hard`` e.g. "ARMv7-A, hard-float ABI (armv7-a)"
+``arm64-v8a``    e.g. "ARMv8-A, 64bit (arm64-v8a)"
+``x86``          e.g. "x86 (x86)"
+``x86_64``       e.g. "x86_64 (x86_64)"
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_ARCH` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst
new file mode 100644
index 0000000..b178024
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst
@@ -0,0 +1,9 @@
+ANDROID_ASSETS_DIRECTORIES
+--------------------------
+
+Set the Android assets directories to copy into the main assets 
+folder before build. This a string property that contains the
+directory paths separated by semicolon. 
+This property is initialized by the value of the 
+:variable:`CMAKE_ANDROID_ASSETS_DIRECTORIES` variable
+if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst
new file mode 100644
index 0000000..42937c1
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst
@@ -0,0 +1,7 @@
+ANDROID_JAR_DEPENDENCIES
+------------------------
+
+Set the Android property that specifies JAR dependencies.
+This is a string value property. This property is initialized
+by the value of the :variable:`CMAKE_ANDROID_JAR_DEPENDENCIES`
+variable if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst
new file mode 100644
index 0000000..ee2e2d5
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst
@@ -0,0 +1,8 @@
+ANDROID_JAR_DIRECTORIES
+-----------------------
+
+Set the Android property that specifies directories to search for
+JAR libraries. This a string property that contains the directory
+paths separated by semicolon. This property is initialized
+by the value of the :variable:`CMAKE_ANDROID_JAR_DIRECTORIES` variable
+if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst
new file mode 100644
index 0000000..90ef1ce
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst
@@ -0,0 +1,8 @@
+ANDROID_JAVA_SOURCE_DIR
+-----------------------
+
+Set the Android property that defines the Java source code root directories.
+This a string property that contains the directory paths separated by semicolon.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_JAVA_SOURCE_DIR` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst
new file mode 100644
index 0000000..fa86aa1
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst
@@ -0,0 +1,7 @@
+ANDROID_NATIVE_LIB_DEPENDENCIES
+-------------------------------
+
+Set the Android property that specifies the .so dependencies.
+This is a string property. This property is initialized by
+the value of the :variable:`CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES`
+variable if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst
new file mode 100644
index 0000000..d306dab
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst
@@ -0,0 +1,8 @@
+ANDROID_NATIVE_LIB_DIRECTORIES
+------------------------------
+
+Set the Android property that specifies directories to search for .so libraries.
+This a string property that contains the directory paths separated by semicolon.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES` variable
+if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_PROCESS_MAX.rst b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst
new file mode 100644
index 0000000..847acae
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst
@@ -0,0 +1,8 @@
+ANDROID_PROCESS_MAX
+-------------------
+
+Set the Android property that defines the maximum number of a
+parallel Android NDK compiler processes (e.g. ``4``).
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_PROCESS_MAX` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_PROGUARD.rst b/Help/prop_tgt/ANDROID_PROGUARD.rst
new file mode 100644
index 0000000..dafc51e
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_PROGUARD.rst
@@ -0,0 +1,9 @@
+ANDROID_PROGUARD
+----------------
+
+When this property is set to true that enables the ProGuard tool to shrink,
+optimize, and obfuscate the code by removing unused code and renaming
+classes, fields, and methods with semantically obscure names.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_PROGUARD` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst
new file mode 100644
index 0000000..0e929d1
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst
@@ -0,0 +1,9 @@
+ANDROID_PROGUARD_CONFIG_PATH
+----------------------------
+
+Set the Android property that specifies the location of the ProGuard
+config file. Leave empty to use the default one.
+This a string property that contains the path to ProGuard config file.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_PROGUARD_CONFIG_PATH` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst
new file mode 100644
index 0000000..9533f1a
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst
@@ -0,0 +1,8 @@
+ANDROID_SECURE_PROPS_PATH
+-------------------------
+
+Set the Android property that states the location of the secure properties file.
+This is a string property that contains the file path.
+This property is initialized by the value of the
+:variable:`CMAKE_ANDROID_SECURE_PROPS_PATH` variable
+if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst
new file mode 100644
index 0000000..6361896
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst
@@ -0,0 +1,6 @@
+ANDROID_SKIP_ANT_STEP
+---------------------
+
+Set the Android property that defines whether or not to skip the Ant build step.
+This is a boolean property initialized by the value of the
+:variable:`CMAKE_ANDROID_SKIP_ANT_STEP` variable if it is set when a target is created.
diff --git a/Help/prop_tgt/ANDROID_STL_TYPE.rst b/Help/prop_tgt/ANDROID_STL_TYPE.rst
new file mode 100644
index 0000000..7256e26
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_STL_TYPE.rst
@@ -0,0 +1,15 @@
+ANDROID_STL_TYPE
+----------------
+
+Set the Android property that defines the type of STL support for the project.
+This is a string property that could set to the one of the following values:
+``none``           e.g. "No C++ Support"
+``system``         e.g. "Minimal C++ without STL"
+``gabi++_static``  e.g. "GAbi++ Static"
+``gabi++_shared``  e.g. "GAbi++ Shared"
+``gnustl_static``  e.g. "GNU libstdc++ Static"
+``gnustl_shared``  e.g. "GNU libstdc++ Shared"
+``stlport_static`` e.g. "STLport Static"
+``stlport_shared`` e.g. "STLport Shared"
+This property is initialized by the value of the
+variable:`CMAKE_ANDROID_STL_TYPE` variable if it is set when a target is created.
diff --git a/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst
new file mode 100644
index 0000000..8862ba9
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS
+------------------------------------
+
+Default value for the :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_ARCH.rst b/Help/variable/CMAKE_ANDROID_ARCH.rst
new file mode 100644
index 0000000..8fbb46d
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_ARCH.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_ARCH
+------------------
+
+Default value for the :prop_tgt:`ANDROID_ARCH` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst
new file mode 100644
index 0000000..c372fe4
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_ASSETS_DIRECTORIES
+--------------------------------
+
+Default value for the :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst
new file mode 100644
index 0000000..451a929
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_JAR_DEPENDENCIES
+------------------------------
+
+Default value for the :prop_tgt:`ANDROID_JAR_DEPENDENCIES` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst
new file mode 100644
index 0000000..af83e34
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_JAR_DIRECTORIES
+-----------------------------
+
+Default value for the :prop_tgt:`ANDROID_JAR_DIRECTORIES` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst
new file mode 100644
index 0000000..3dc05e0
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_JAVA_SOURCE_DIR
+-----------------------------
+
+Default value for the :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst
new file mode 100644
index 0000000..52e60b1
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES
+-------------------------------------
+
+Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst
new file mode 100644
index 0000000..8480575
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES
+------------------------------------
+
+Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst
new file mode 100644
index 0000000..19fb527
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_PROCESS_MAX
+-------------------------
+
+Default value for the :prop_tgt:`ANDROID_PROCESS_MAX` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD.rst b/Help/variable/CMAKE_ANDROID_PROGUARD.rst
new file mode 100644
index 0000000..b8fdd46
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_PROGUARD.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_PROGUARD
+----------------------
+
+Default value for the :prop_tgt:`ANDROID_PROGUARD` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst
new file mode 100644
index 0000000..8dea009
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_PROGUARD_CONFIG_PATH
+----------------------------------
+
+Default value for the :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst
new file mode 100644
index 0000000..69a4d0b
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_SECURE_PROPS_PATH
+-------------------------------
+
+Default value for the :prop_tgt:`ANDROID_SECURE_PROPS_PATH` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst
new file mode 100644
index 0000000..0a96df9
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_SKIP_ANT_STEP
+---------------------------
+
+Default value for the :prop_tgt:`ANDROID_SKIP_ANT_STEP` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst
new file mode 100644
index 0000000..766b2c8
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_STL_TYPE
+----------------------
+
+Default value for the :prop_tgt:`ANDROID_STL_TYPE` target property.
+See that target property for additional information.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d309927..0bc88d0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -297,6 +297,20 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     {
     this->SetPropertyDefault("ANDROID_API", 0);
     this->SetPropertyDefault("ANDROID_API_MIN", 0);
+    this->SetPropertyDefault("ANDROID_ARCH", 0);
+    this->SetPropertyDefault("ANDROID_STL_TYPE", 0);
+    this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", 0);
+    this->SetPropertyDefault("ANDROID_PROCESS_MAX", 0);
+    this->SetPropertyDefault("ANDROID_PROGUARD", 0);
+    this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", 0);
+    this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", 0);
+    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", 0);
+    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", 0);
+    this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", 0);
+    this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", 0);
+    this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", 0);
+    this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", 0);
+    this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", 0);
     this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
     this->SetPropertyDefault("INSTALL_RPATH", "");
     this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a2f9bca..7083d7d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -787,6 +787,18 @@ void cmVisualStudio10TargetGenerator
     (*this->BuildFileStream ) <<
       "android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n";
     }
+
+  if(const char* cpuArch = this->Target->GetProperty("ANDROID_ARCH"))
+    {
+    this->WriteString("<AndroidArch>", 2);
+    (*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << "</AndroidArch>\n";
+    }
+
+  if(const char* stlType = this->Target->GetProperty("ANDROID_STL_TYPE"))
+    {
+    this->WriteString("<AndroidStlType>", 2);
+    (*this->BuildFileStream) << cmVS10EscapeXML(stlType) << "</AndroidStlType>\n";
+    }
 }
 
 void cmVisualStudio10TargetGenerator::WriteCustomCommands()
@@ -1978,6 +1990,15 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
   clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, "      ",
                                           "\n", "CXX");
 
+  if(this->NsightTegra)
+    {
+    if(const char* processMax = this->Target->GetProperty("ANDROID_PROCESS_MAX"))
+      {
+      this->WriteString("<ProcessMax>", 3);
+      *this->BuildFileStream << cmVS10EscapeXML(processMax) << "</ProcessMax>\n";
+      }
+    }
+
   if(this->MSTools)
     {
     this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
@@ -2170,7 +2191,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
 
 //----------------------------------------------------------------------------
 void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
-  std::string const&)
+  std::string const& configName)
 {
   // Look through the sources for AndroidManifest.xml and use
   // its location as the root source directory.
@@ -2200,14 +2221,86 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
     cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n";
   }
 
+  if (this->Target->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP"))
+    {
+    this->WriteString("<SkipAntStep>true</SkipAntStep>\n", 3);
+    }
+
+  if (this->Target->GetPropertyAsBool("ANDROID_PROGUARD"))
+    {
+    this->WriteString("<EnableProGuard>true</EnableProGuard>\n", 3);
+    }
+
+  if (const char* proGuardConfigLocation = this->Target->GetProperty("ANDROID_PROGUARD_CONFIG_PATH"))
+    {
+    this->WriteString("<ProGuardConfigLocation>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) << "</ProGuardConfigLocation>\n";
+    }
+
+  if (const char* securePropertiesLocatios = this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH"))
+    {
+    this->WriteString("<SecurePropertiesLocation>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocatios) << "</SecurePropertiesLocation>\n";
+    }
+
+  if (const char* nativeLibDirsRaw = this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES"))
+    {
+    cmGeneratorExpression ge;
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(nativeLibDirsRaw);
+    std::string nativeLibDirs = cge->Evaluate(this->Makefile, configName);
+    this->WriteString("<NativeLibDirectories>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs) << "</NativeLibDirectories>\n";
+    }
+
   {
-  std::string manifest_xml = rootDir + "/AndroidManifest.xml";
-  this->ConvertToWindowsSlash(manifest_xml);
-  this->WriteString("<AndroidManifestLocation>", 3);
-  (*this->BuildFileStream) <<
+  if (const char* nativeLibDeps = this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES"))
+    {
+    this->WriteString("<NativeLibDependencies>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDeps) << "</NativeLibDependencies>\n";
+    }
+  }
+
+  if (const char* javaSourceDir = this->Target->GetProperty("ANDROID_JAVA_SOURCE_DIR"))
+    {
+    this->WriteString("<JavaSourceDir>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) << "</JavaSourceDir>\n";
+    }
+
+  if (const char* jarDirsRaw = this->Target->GetProperty("ANDROID_JAR_DIRECTORIES"))
+    {
+    cmGeneratorExpression ge;
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(jarDirsRaw);
+    std::string jarDirs = cge->Evaluate(this->Makefile, configName);
+    this->WriteString("<JarDirectories>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(jarDirs) << "</JarDirectories>\n";
+    }
+
+  if (const char* jarDeps = this->Target->GetProperty("ANDROID_JAR_DEPENDENCIES"))
+    {
+    this->WriteString("<JarDependencies>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) << "</JarDependencies>\n";
+    }
+
+  if (const char* assetsDirectories = this->Target->GetProperty("ANDROID_ASSETS_DIRECTORIES"))
+    {
+    this->WriteString("<AssetsDirectories>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) << "</AssetsDirectories>\n";
+    }
+
+  {
+    std::string manifest_xml = rootDir + "/AndroidManifest.xml";
+    this->ConvertToWindowsSlash(manifest_xml);
+    this->WriteString("<AndroidManifestLocation>", 3);
+    (*this->BuildFileStream) <<
     cmVS10EscapeXML(manifest_xml) << "</AndroidManifestLocation>\n";
   }
 
+  if (const char* antAdditionalOptions = this->Target->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS"))
+    {
+    this->WriteString("<AdditionalOptions>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) << " %(AdditionalOptions)</AdditionalOptions>\n";
+    }
+
   this->WriteString("</AntBuild>\n", 2);
 }
 
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8de1c79..e8a53a2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2041,7 +2041,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
         --build-generator "${generator}"
         --build-project VSNsightTegra
         --build-config $<CONFIGURATION>
-        --build-options -DCMAKE_SYSTEM_NAME=Android
+        --build-options -DCMAKE_SYSTEM_NAME=Android -DCMAKE_TOOLCHAIN_FILE= "${CMake_SOURCE_DIR}/Tests/VSNsightTegra/NsightTegraToolchain.cmake"
         )
       list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}")
     endmacro()
diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt
index 10f55d9..d6c5e52 100644
--- a/Tests/VSNsightTegra/CMakeLists.txt
+++ b/Tests/VSNsightTegra/CMakeLists.txt
@@ -1,6 +1,8 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.3)
 project(VSNsightTegra C CXX)
 
+set(CMAKE_ANDROID_ARCH armv7-a-hard)
+set(CMAKE_ANDROID_STL_TYPE stlport_shared)
 set(CMAKE_ANDROID_API_MIN 9)
 set(CMAKE_ANDROID_API 15)
 set(CMAKE_ANDROID_GUI 1)
@@ -36,5 +38,14 @@ add_executable(twolib-second
   ${SECOND_ANDROID_FILES}
   )
 target_include_directories(twolib-second PUBLIC jni)
-target_link_libraries(twolib-second twolib-first)
-target_link_libraries(twolib-second m) # test linking to library by name
+target_link_libraries(twolib-second twolib-first \( c m gcc log \))
+
+set_property(TARGET twolib-second PROPERTY C_STANDARD 11)
+set_target_properties(twolib-second PROPERTIES ANDROID_SKIP_ANT_STEP 1)
+set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD 1)
+set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD_CONFIG_PATH proguard-android.txt)
+
+set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $<TARGET_LINKER_FILE_DIR:twolib-first>)
+set_property(TARGET twolib-second APPEND PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES c:\\wrk c:\\wrk\\cmake)
+
+set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $<TARGET_FILE_DIR:twolib-first>)
diff --git a/Tests/VSNsightTegra/NsightTegraToolchain.cmake b/Tests/VSNsightTegra/NsightTegraToolchain.cmake
new file mode 100644
index 0000000..6d2408d
--- /dev/null
+++ b/Tests/VSNsightTegra/NsightTegraToolchain.cmake
@@ -0,0 +1,4 @@
+# CMake toolchain file used for the generation of Nsight Tegra project files
+
+set(CMAKE_GENERATOR_TOOLSET clang-3.5)
+set(CMAKE_SYSTEM_NAME Android)
diff --git a/Tests/VSNsightTegra/proguard-android.txt b/Tests/VSNsightTegra/proguard-android.txt
new file mode 100644
index 0000000..fe73bae
--- /dev/null
+++ b/Tests/VSNsightTegra/proguard-android.txt
@@ -0,0 +1,57 @@
+# This is a configuration file for ProGuard.
+# http://proguard.sourceforge.net/index.html#manual/usage.html
+
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-verbose
+
+# Optimization is turned off by default. Dex does not like code run
+# through the ProGuard optimize and preverify steps (and performs some
+# of these optimizations on its own).
+-dontoptimize
+-dontpreverify
+# Note that if you want to enable optimization, you cannot just
+# include optimization flags in your own project configuration file;
+# instead you will need to point to the
+# "proguard-android-optimize.txt" file instead of this one from your
+# project.properties file.
+
+-keepattributes *Annotation*
+-keep public class com.google.vending.licensing.ILicensingService
+-keep public class com.android.vending.licensing.ILicensingService
+
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+# keep setters in Views so that animations can still work.
+# see http://proguard.sourceforge.net/manual/examples.html#beans
+-keepclassmembers public class * extends android.view.View {
+   void set*(***);
+   *** get*();
+}
+
+# We want to keep methods in Activity that could be used in the XML attribute onClick
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
+
+-keepclassmembers class **.R$* {
+    public static <fields>;
+}
+
+# The support library contains references to newer platform versions.
+# Don't warn about those in case this app is linking against an older
+# platform version.  We know about them, and they are safe.
+-dontwarn android.support.**
-- 
2.1.4

