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 <dpolyanitsa@nvidia.com>
This commit is contained in:
Mikhail Filimonov 2015-06-25 20:15:06 +03:00 committed by Brad King
parent 7a40998329
commit 8c0afaf450
36 changed files with 510 additions and 10 deletions

View File

@ -85,9 +85,23 @@ Properties on Targets
:maxdepth: 1 :maxdepth: 1
/prop_tgt/ALIASED_TARGET /prop_tgt/ALIASED_TARGET
/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS
/prop_tgt/ANDROID_API /prop_tgt/ANDROID_API
/prop_tgt/ANDROID_API_MIN /prop_tgt/ANDROID_API_MIN
/prop_tgt/ANDROID_ARCH
/prop_tgt/ANDROID_ASSETS_DIRECTORIES
/prop_tgt/ANDROID_GUI /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_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG

View File

@ -256,6 +256,22 @@ like this:
The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select
the Nsight Tegra "Toolchain Version" value. the Nsight Tegra "Toolchain Version" value.
See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API` See also target properties:
and :prop_tgt:`ANDROID_GUI` target properties to configure
targets within the project. * :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`

View File

@ -213,9 +213,23 @@ Variables that Control the Build
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS
/variable/CMAKE_ANDROID_API /variable/CMAKE_ANDROID_API
/variable/CMAKE_ANDROID_API_MIN /variable/CMAKE_ANDROID_API_MIN
/variable/CMAKE_ANDROID_ARCH
/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES
/variable/CMAKE_ANDROID_GUI /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
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC_MOC_OPTIONS

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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`

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -297,6 +297,20 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{ {
this->SetPropertyDefault("ANDROID_API", 0); this->SetPropertyDefault("ANDROID_API", 0);
this->SetPropertyDefault("ANDROID_API_MIN", 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_NAME_DIR", 0);
this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");

View File

@ -324,12 +324,22 @@ void cmVisualStudio10TargetGenerator::Generate()
if(this->NsightTegra) if(this->NsightTegra)
{ {
this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1); this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\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("<NsightTegraProjectRevisionNumber>", 2);
this->WriteString("<NsightTegraProjectRevisionNumber>" if (nsightTegraMajorVersion > 3 ||
"9" (nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1))
"</NsightTegraProjectRevisionNumber>\n", 2); {
(*this->BuildFileStream) << "11";
}
else
{
// Nsight Tegra 2.0 uses project revision 9.
(*this->BuildFileStream) << "9";
}
(*this->BuildFileStream) << "</NsightTegraProjectRevisionNumber>\n";
// Tell newer versions to upgrade silently when loading. // Tell newer versions to upgrade silently when loading.
this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>" this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>"
"true" "true"
@ -787,6 +797,20 @@ void cmVisualStudio10TargetGenerator
(*this->BuildFileStream ) << (*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n"; "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() void cmVisualStudio10TargetGenerator::WriteCustomCommands()
@ -1978,6 +2002,17 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX"); "\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) if(this->MSTools)
{ {
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
@ -2170,7 +2205,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
std::string const&) std::string const& configName)
{ {
// Look through the sources for AndroidManifest.xml and use // Look through the sources for AndroidManifest.xml and use
// its location as the root source directory. // its location as the root source directory.
@ -2200,6 +2235,92 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n"; 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* securePropertiesLocation =
this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH"))
{
this->WriteString("<SecurePropertiesLocation>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) <<
"</SecurePropertiesLocation>\n";
}
if (const char* nativeLibDirectoriesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDirectoriesExpression);
std::string nativeLibDirs = cge->Evaluate(this->Makefile, configName);
this->WriteString("<NativeLibDirectories>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs) <<
"</NativeLibDirectories>\n";
}
if (const char* nativeLibDependenciesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDependenciesExpression);
std::string nativeLibDeps = cge->Evaluate(this->Makefile, configName);
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* jarDirectoriesExpression =
this->Target->GetProperty("ANDROID_JAR_DIRECTORIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(jarDirectoriesExpression);
std::string jarDirectories = cge->Evaluate(this->Makefile, configName);
this->WriteString("<JarDirectories>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(jarDirectories) <<
"</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"; std::string manifest_xml = rootDir + "/AndroidManifest.xml";
this->ConvertToWindowsSlash(manifest_xml); this->ConvertToWindowsSlash(manifest_xml);
@ -2208,6 +2329,14 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
cmVS10EscapeXML(manifest_xml) << "</AndroidManifestLocation>\n"; 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); this->WriteString("</AntBuild>\n", 2);
} }

View File

@ -1,10 +1,16 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.3)
project(VSNsightTegra C CXX) 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_MIN 9)
set(CMAKE_ANDROID_API 15) set(CMAKE_ANDROID_API 15)
set(CMAKE_ANDROID_GUI 1) 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 set(FIRST_C_FILES
jni/first.c jni/first.c
jni/first.h jni/first.h
@ -38,3 +44,14 @@ add_executable(twolib-second
target_include_directories(twolib-second PUBLIC jni) target_include_directories(twolib-second PUBLIC jni)
target_link_libraries(twolib-second twolib-first) target_link_libraries(twolib-second twolib-first)
target_link_libraries(twolib-second m) # test linking to library by name 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 $<TARGET_FILE_DIR:twolib-second>)
set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $<TARGET_FILE_NAME:twolib-second>)
set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $<TARGET_FILE_DIR:twolib-first>)

View File

@ -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.**