From 8c0afaf45098dccaee51b50b40593ffb67c3e42a Mon Sep 17 00:00:00 2001 From: Mikhail Filimonov Date: Thu, 25 Jun 2015 20:15:06 +0300 Subject: [PATCH] VS: Add more Nsight Tegra generator Android property settings Extend the Nsight Tegra project generator to add bunch of properties with the backing variables to fine-tune the generated projects. Add target properties that map to all "Configuration" PropertyGroups for each configuration: * ANDROID_ARCH * ANDROID_STL_TYPE Add target properties that map to the AntBuild section of vcxproj files: * ANDROID_ANT_ADDITIONAL_OPTIONS * ANDROID_ASSETS_DIRECTORIES * ANDROID_JAR_DEPENDENCIES * ANDROID_JAR_DIRECTORIES * ANDROID_JAVA_SOURCE_DIR * ANDROID_NATIVE_LIB_DEPENDENCIES * ANDROID_NATIVE_LIB_DIRECTORIES * ANDROID_PROCESS_MAX * ANDROID_PROGUARD * ANDROID_PROGUARD_CONFIG_PATH * ANDROID_SECURE_PROPS_PATH * ANDROID_SKIP_ANT_STEP Reviewed-by: Dmitry Polyanitsa --- Help/manual/cmake-properties.7.rst | 14 ++ Help/manual/cmake-toolchains.7.rst | 22 ++- Help/manual/cmake-variables.7.rst | 14 ++ .../ANDROID_ANT_ADDITIONAL_OPTIONS.rst | 8 + Help/prop_tgt/ANDROID_ARCH.rst | 17 +++ Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst | 9 ++ Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst | 7 + Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst | 14 ++ Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst | 8 + .../ANDROID_NATIVE_LIB_DEPENDENCIES.rst | 14 ++ .../ANDROID_NATIVE_LIB_DIRECTORIES.rst | 16 ++ Help/prop_tgt/ANDROID_PROCESS_MAX.rst | 8 + Help/prop_tgt/ANDROID_PROGUARD.rst | 9 ++ .../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 ++ .../dev/vs-nsight-tegra-attributes.rst | 21 +++ .../CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst | 5 + Help/variable/CMAKE_ANDROID_ARCH.rst | 5 + .../CMAKE_ANDROID_ASSETS_DIRECTORIES.rst | 5 + .../CMAKE_ANDROID_JAR_DEPENDENCIES.rst | 5 + .../CMAKE_ANDROID_JAR_DIRECTORIES.rst | 5 + .../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 + .../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 | 141 +++++++++++++++++- Tests/VSNsightTegra/CMakeLists.txt | 19 ++- Tests/VSNsightTegra/proguard-android.txt | 57 +++++++ 36 files changed, 510 insertions(+), 10 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/release/dev/vs-nsight-tegra-attributes.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/proguard-android.txt diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index b767ed624..910d8b940 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 054438dd6..a06dce7cd 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -256,6 +256,22 @@ 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 also target properties: + +* :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` +* :prop_tgt:`ANDROID_API_MIN` +* :prop_tgt:`ANDROID_API` +* :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_CONFIG_PATH` +* :prop_tgt:`ANDROID_PROGUARD` +* :prop_tgt:`ANDROID_SECURE_PROPS_PATH` +* :prop_tgt:`ANDROID_SKIP_ANT_STEP` +* :prop_tgt:`ANDROID_STL_TYPE` diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index f54436a43..35a67c355 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 000000000..af6b40587 --- /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 000000000..5477fb598 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ARCH.rst @@ -0,0 +1,17 @@ +ANDROID_ARCH +------------ + +Set the Android target architecture. + +This is a string property that could be set to the one of +the following values: + +* ``armv7-a``: "ARMv7-A (armv7-a)" +* ``armv7-a-hard``: "ARMv7-A, hard-float ABI (armv7-a)" +* ``arm64-v8a``: "ARMv8-A, 64bit (arm64-v8a)" +* ``x86``: "x86 (x86)" +* ``x86_64``: "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 000000000..764a58244 --- /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 000000000..42937c1b4 --- /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 000000000..54f0a8ff7 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst @@ -0,0 +1,14 @@ +ANDROID_JAR_DIRECTORIES +----------------------- + +Set the Android property that specifies directories to search for +the JAR libraries. + +This a string property that contains the directory paths separated by +semicolons. This property is initialized by the value of the +:variable:`CMAKE_ANDROID_JAR_DIRECTORIES` variable if it is set when +a target is created. + +Contents of ``ANDROID_JAR_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. 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 000000000..90ef1ce93 --- /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 000000000..759a37b06 --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst @@ -0,0 +1,14 @@ +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. + +Contents of ``ANDROID_NATIVE_LIB_DEPENDENCIES`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for +available expressions. 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 000000000..bc673804d --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -0,0 +1,16 @@ +ANDROID_NATIVE_LIB_DIRECTORIES +------------------------------ + +Set the Android property that specifies directories to search for the +.so libraries. + +This a string property that contains the directory paths separated +by semicolons. + +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. + +Contents of ``ANDROID_NATIVE_LIB_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. diff --git a/Help/prop_tgt/ANDROID_PROCESS_MAX.rst b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst new file mode 100644 index 000000000..847acae5b --- /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 000000000..dafc51ee5 --- /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 000000000..0e929d16a --- /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 000000000..9533f1a70 --- /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 000000000..636189656 --- /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 000000000..7256e266c --- /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/release/dev/vs-nsight-tegra-attributes.rst b/Help/release/dev/vs-nsight-tegra-attributes.rst new file mode 100644 index 000000000..7ebea33d5 --- /dev/null +++ b/Help/release/dev/vs-nsight-tegra-attributes.rst @@ -0,0 +1,21 @@ +vs-nsight-tegra-attributes +-------------------------- + +* :ref:`Visual Studio Generators` learned to support additonal + target properties to customize projects for NVIDIA Nsight + Tegra Visual Studio Edition: + + * :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` + * :prop_tgt:`ANDROID_ARCH` + * :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` + * :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` 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 000000000..8862ba91d --- /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 000000000..8fbb46d53 --- /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 000000000..c372fe449 --- /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 000000000..451a92960 --- /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 000000000..af83e3430 --- /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 000000000..3dc05e05e --- /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 000000000..52e60b142 --- /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 000000000..8480575f5 --- /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 000000000..19fb527f7 --- /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 000000000..b8fdd46cc --- /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 000000000..8dea00907 --- /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 000000000..69a4d0b56 --- /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 000000000..0a96df9fa --- /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 000000000..766b2c8fd --- /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 2b73e6f09..0303f1e4b 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 a2f9bcabe..67d52b8d1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -324,12 +324,22 @@ void cmVisualStudio10TargetGenerator::Generate() if(this->NsightTegra) { this->WriteString("\n", 1); - if(this->NsightTegraVersion[0] >= 2) + const int nsightTegraMajorVersion = this->NsightTegraVersion[0]; + const int nsightTegraMinorVersion = this->NsightTegraVersion[1]; + if (nsightTegraMajorVersion >= 2) { - // Nsight Tegra 2.0 uses project revision 9. - this->WriteString("" - "9" - "\n", 2); + this->WriteString("", 2); + if (nsightTegraMajorVersion > 3 || + (nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) + { + (*this->BuildFileStream) << "11"; + } + else + { + // Nsight Tegra 2.0 uses project revision 9. + (*this->BuildFileStream) << "9"; + } + (*this->BuildFileStream) << "\n"; // Tell newer versions to upgrade silently when loading. this->WriteString("" "true" @@ -787,6 +797,20 @@ void cmVisualStudio10TargetGenerator (*this->BuildFileStream ) << "android-" << cmVS10EscapeXML(api) << "\n"; } + + if(const char* cpuArch = this->Target->GetProperty("ANDROID_ARCH")) + { + this->WriteString("", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << + "\n"; + } + + if(const char* stlType = this->Target->GetProperty("ANDROID_STL_TYPE")) + { + this->WriteString("", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(stlType) << + "\n"; + } } void cmVisualStudio10TargetGenerator::WriteCustomCommands() @@ -1978,6 +2002,17 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); + if(this->NsightTegra) + { + if(const char* processMax = + this->Target->GetProperty("ANDROID_PROCESS_MAX")) + { + this->WriteString("", 3); + *this->BuildFileStream << cmVS10EscapeXML(processMax) << + "\n"; + } + } + if(this->MSTools) { this->WriteString("$(IntDir)\n", 3); @@ -2170,7 +2205,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,6 +2235,92 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( cmVS10EscapeXML(antBuildPath) << "\n"; } + if (this->Target->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) + { + this->WriteString("true\n", 3); + } + + if (this->Target->GetPropertyAsBool("ANDROID_PROGUARD")) + { + this->WriteString("true\n", 3); + } + + if (const char* proGuardConfigLocation = + this->Target->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) << + "\n"; + } + + if (const char* securePropertiesLocation = + this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) << + "\n"; + } + + if (const char* nativeLibDirectoriesExpression = + this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(nativeLibDirectoriesExpression); + std::string nativeLibDirs = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs) << + "\n"; + } + + if (const char* nativeLibDependenciesExpression = + this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(nativeLibDependenciesExpression); + std::string nativeLibDeps = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDeps) << + "\n"; + } + + if (const char* javaSourceDir = + this->Target->GetProperty("ANDROID_JAVA_SOURCE_DIR")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) << + "\n"; + } + + if (const char* jarDirectoriesExpression = + this->Target->GetProperty("ANDROID_JAR_DIRECTORIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(jarDirectoriesExpression); + std::string jarDirectories = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(jarDirectories) << + "\n"; + } + + if (const char* jarDeps = + this->Target->GetProperty("ANDROID_JAR_DEPENDENCIES")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) << + "\n"; + } + + if (const char* assetsDirectories = + this->Target->GetProperty("ANDROID_ASSETS_DIRECTORIES")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) << + "\n"; + } + { std::string manifest_xml = rootDir + "/AndroidManifest.xml"; this->ConvertToWindowsSlash(manifest_xml); @@ -2208,6 +2329,14 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( cmVS10EscapeXML(manifest_xml) << "\n"; } + if (const char* antAdditionalOptions = + this->Target->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) << + " %(AdditionalOptions)\n"; + } + this->WriteString("\n", 2); } diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt index 10f55d972..61a04fdd3 100644 --- a/Tests/VSNsightTegra/CMakeLists.txt +++ b/Tests/VSNsightTegra/CMakeLists.txt @@ -1,10 +1,16 @@ -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) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + set(FIRST_C_FILES jni/first.c jni/first.h @@ -38,3 +44,14 @@ add_executable(twolib-second 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 + +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_target_properties(twolib-second PROPERTIES ANDROID_SECURE_PROPS_PATH /definitely/insecure) + +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $) +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $) + +set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $) diff --git a/Tests/VSNsightTegra/proguard-android.txt b/Tests/VSNsightTegra/proguard-android.txt new file mode 100644 index 000000000..fe73baeb5 --- /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 ; +} + +# 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 ; +} + +# 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.**