[Cmake-commits] CMake branch, next, updated. v3.0.2-5535-g78ada1f
Brad King
brad.king at kitware.com
Tue Sep 30 08:46:00 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 78ada1ffa5a64f0cac937907e851c8b6636da99e (commit)
via df84281d68a715658ce0068c0869dd80831cd4a7 (commit)
via 69e198dc3fd0e0d16a7b4fe5bcda4c6e1e77ea2f (commit)
via 5365c9ac377ab6f579a1af32c4bfbec798417efb (commit)
via 178f56a57996651a4f8c2a20271f1e2c999279d2 (commit)
via 7115702f1b116fcf9b82ab197bab7426db10c610 (commit)
via a62894998f59d87e092a664ea50e33ff8dbb180c (commit)
via c12e46991e02c2ea59864512d2c1fb7c2b4b0f9d (commit)
from af9d532e111efecd25be155ece236826f132c0a3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78ada1ffa5a64f0cac937907e851c8b6636da99e
commit 78ada1ffa5a64f0cac937907e851c8b6636da99e
Merge: af9d532 df84281
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 30 08:45:59 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 30 08:45:59 2014 -0400
Merge topic 'vs-nsight-tegra-generator' into next
df84281d Help: Add notes for topic 'vs-nsight-tegra-generator'
69e198dc VS: Generate Nsight Tegra project revision number
5365c9ac VS: Map Nsight Tegra file types in .vcxproj files
178f56a5 VS: Fix Tegra-Android platform linking of libraries by name
7115702f Tests: Add test for VS Nsight Tegra generator support
a6289499 VS: Generate ANDROID_GUI executables as app packages
c12e4699 Add 'ANDROID_API' target property to set Android Target API
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df84281d68a715658ce0068c0869dd80831cd4a7
commit df84281d68a715658ce0068c0869dd80831cd4a7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 22 09:14:13 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:35 2014 -0400
Help: Add notes for topic 'vs-nsight-tegra-generator'
diff --git a/Help/release/dev/vs-nsight-tegra-generator.rst b/Help/release/dev/vs-nsight-tegra-generator.rst
new file mode 100644
index 0000000..92f4236
--- /dev/null
+++ b/Help/release/dev/vs-nsight-tegra-generator.rst
@@ -0,0 +1,8 @@
+vs-nsight-tegra-generator
+-------------------------
+
+* Generators for Visual Studio 10 (2010) and above learned to generate
+ projects for NVIDIA Nsight Tegra Visual Studio Edition. One may set
+ the :variable:`CMAKE_SYSTEM_NAME` variable to ``Android`` on the
+ :manual:`cmake(1)` command-line or in a :variable:`CMAKE_TOOLCHAIN_FILE`
+ to activate this platform.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69e198dc3fd0e0d16a7b4fe5bcda4c6e1e77ea2f
commit 69e198dc3fd0e0d16a7b4fe5bcda4c6e1e77ea2f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 26 14:57:30 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:35 2014 -0400
VS: Generate Nsight Tegra project revision number
Nsight Tegra 2.0 will be revision '8'. Generate this revision number
and add a NsightTegraUpgradeOnceWithoutPrompt element to tell newer
versions not to prompt when upgrading the generated project file.
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 21d1f34..d70d2af 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -620,6 +620,12 @@ bool cmGlobalVisualStudio10Generator::IsNsightTegra() const
}
//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio10Generator::GetNsightTegraVersion() const
+{
+ return this->NsightTegraVersion;
+}
+
+//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
{
std::string version;
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 1df98e3..3af7b51 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -61,6 +61,7 @@ public:
/** Generating for Nsight Tegra VS plugin? */
bool IsNsightTegra() const;
+ std::string GetNsightTegraVersion() const;
/** The toolset name for the target platform. */
const char* GetPlatformToolset() const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b42bf90..8ac12df 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -181,6 +181,14 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName();
this->NsightTegra = gg->IsNsightTegra();
+ for(int i =
+ sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u",
+ &this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
+ &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
+ i < 4; ++i)
+ {
+ this->NsightTegraVersion[i] = 0;
+ }
this->MSTools = !this->NsightTegra;
this->TargetCompileAsWinRT = false;
this->BuildFileStream = 0;
@@ -316,9 +324,24 @@ void cmVisualStudio10TargetGenerator::Generate()
if(this->NsightTegra)
{
this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1);
- this->WriteString("<NsightTegraProjectRevisionNumber>"
- "7"
- "</NsightTegraProjectRevisionNumber>\n", 2);
+ if(this->NsightTegraVersion[0] >= 2)
+ {
+ // Nsight Tegra 2.0 uses project revision 8.
+ this->WriteString("<NsightTegraProjectRevisionNumber>"
+ "8"
+ "</NsightTegraProjectRevisionNumber>\n", 2);
+ // Tell newer versions to upgrade silently when loading.
+ this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>"
+ "true"
+ "</NsightTegraUpgradeOnceWithoutPrompt>\n", 2);
+ }
+ else
+ {
+ // Require Nsight Tegra 1.6 for JCompile support.
+ this->WriteString("<NsightTegraProjectRevisionNumber>"
+ "7"
+ "</NsightTegraProjectRevisionNumber>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 36155f9..a02dfa8 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -142,6 +142,7 @@ private:
std::string Name;
bool MSTools;
bool NsightTegra;
+ int NsightTegraVersion[4];
bool TargetCompileAsWinRT;
cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5365c9ac377ab6f579a1af32c4bfbec798417efb
commit 5365c9ac377ab6f579a1af32c4bfbec798417efb
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 24 14:27:18 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:35 2014 -0400
VS: Map Nsight Tegra file types in .vcxproj files
Map ".java" to JCompile, ".asm" and ".s" to ClCompile, and a few
Android-specific source file names to AndroidBuild. This allows
Nsight Tegra 1.6 and above to check up-to-dateness of such sources.
Bump NsightTegraProjectRevisionNumber to 7 to allow these fields.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b0c84e3..b42bf90 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -317,7 +317,7 @@ void cmVisualStudio10TargetGenerator::Generate()
{
this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1);
this->WriteString("<NsightTegraProjectRevisionNumber>"
- "6"
+ "7"
"</NsightTegraProjectRevisionNumber>\n", 2);
this->WriteString("</PropertyGroup>\n", 1);
}
@@ -1200,6 +1200,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
{
tool = "XML";
}
+ if(this->NsightTegra)
+ {
+ // Nsight Tegra needs specific file types to check up-to-dateness.
+ std::string name =
+ cmSystemTools::LowerCase(sf->GetLocation().GetName());
+ if(name == "androidmanifest.xml" ||
+ name == "build.xml" ||
+ name == "proguard.cfg" ||
+ name == "proguard-project.txt" ||
+ ext == "properties")
+ {
+ tool = "AndroidBuild";
+ }
+ else if(ext == "java")
+ {
+ tool = "JCompile";
+ }
+ else if(ext == "asm" || ext == "s")
+ {
+ tool = "ClCompile";
+ }
+ }
std::string deployContent;
if(this->GlobalGenerator->TargetsWindowsPhone() ||
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=178f56a57996651a4f8c2a20271f1e2c999279d2
commit 178f56a57996651a4f8c2a20271f1e2c999279d2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 19 10:11:36 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:35 2014 -0400
VS: Fix Tegra-Android platform linking of libraries by name
Nsight Tegra Visual Studio Edition handles prefixing of library names
with '-l' automatically, so teach the generator not to do so.
Reported-by: Mourad Boufarguine <mourad at boufarguine.name>
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index e6d4fcf..1bdad04 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -7,3 +7,9 @@ set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
# Android reportedly ignores RPATH, and we cannot predict the install
# location anyway.
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+
+# Nsight Tegra Visual Studio Edition takes care of
+# prefixing library names with '-l'.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(CMAKE_LINK_LIBRARY_FLAG "")
+endif()
diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt
index e011cac..570733b 100644
--- a/Tests/VSNsightTegra/CMakeLists.txt
+++ b/Tests/VSNsightTegra/CMakeLists.txt
@@ -36,3 +36,4 @@ 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
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7115702f1b116fcf9b82ab197bab7426db10c610
commit 7115702f1b116fcf9b82ab197bab7426db10c610
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 16 09:48:38 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:34 2014 -0400
Tests: Add test for VS Nsight Tegra generator support
Create a VSNsightTegra test based on the "two-libs" example from the
Android NDK. Add it whenever testing on a machine with VS 11 or 12
and the NVIDIA Nsight Tegra Visual Studio Edition installed. Exclude
it when there is a space in the path to the source or build tree because
the tools do not seem to support it.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2b70f56..acb6b86 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1781,13 +1781,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
if(WIN32)
+ set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]")
set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]")
set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]")
set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]")
set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]")
set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]")
set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]")
- foreach(reg vs11 vs12 ws80 ws81 wp80 wp81)
+ set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
+ foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 tegra)
get_filename_component(r "${reg_${reg}}" ABSOLUTE)
if(IS_DIRECTORY "${r}")
set(${reg} 1)
@@ -1833,6 +1835,30 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
+ if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ")
+ macro(add_test_VSNsightTegra name generator)
+ add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/VSNsightTegra"
+ "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}"
+ --build-generator "${generator}"
+ --build-project VSNsightTegra
+ --build-config $<CONFIGURATION>
+ --build-options -DCMAKE_SYSTEM_NAME=Android
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}")
+ endmacro()
+ if(vs10)
+ add_test_VSNsightTegra(vs10 "Visual Studio 10 2010")
+ endif()
+ if(vs11)
+ add_test_VSNsightTegra(vs11 "Visual Studio 11 2012")
+ endif()
+ if(vs12)
+ add_test_VSNsightTegra(vs12 "Visual Studio 12 2013")
+ endif()
+ endif()
+
if (APPLE)
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(BundleTestInstallDir
diff --git a/Tests/VSNsightTegra/AndroidManifest.xml b/Tests/VSNsightTegra/AndroidManifest.xml
new file mode 100644
index 0000000..951e8f3
--- /dev/null
+++ b/Tests/VSNsightTegra/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.twolibs"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="3" />
+ <application android:label="@string/app_name">
+ <activity android:name=".TwoLibs"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt
new file mode 100644
index 0000000..e011cac
--- /dev/null
+++ b/Tests/VSNsightTegra/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.0)
+project(VSNsightTegra C CXX)
+
+set(CMAKE_ANDROID_API 15)
+set(CMAKE_ANDROID_GUI 1)
+
+set(FIRST_C_FILES
+ jni/first.c
+ jni/first.h
+ )
+
+source_group(jni FILES ${FIRST_C_FILES})
+add_library(twolib-first ${FIRST_C_FILES})
+
+set(SECOND_C_FILES
+ jni/second.c
+ )
+set(SECOND_JAVA_FILES
+ src/com/example/twolibs/TwoLibs.java
+ )
+set(SECOND_RES_FILES
+ res/values/strings.xml
+ )
+set(SECOND_ANDROID_FILES
+ AndroidManifest.xml
+ )
+
+source_group(jni FILES ${SECOND_C_FILES})
+source_group(res\\values FILES ${SECOND_RES_FILES})
+source_group(src\\com\\example\\twolibs FILES ${SECOND_JAVA_FILES})
+add_executable(twolib-second
+ ${SECOND_C_FILES}
+ ${SECOND_JAVA_FILES}
+ ${SECOND_RES_FILES}
+ ${SECOND_ANDROID_FILES}
+ )
+target_include_directories(twolib-second PUBLIC jni)
+target_link_libraries(twolib-second twolib-first)
diff --git a/Tests/VSNsightTegra/build.xml b/Tests/VSNsightTegra/build.xml
new file mode 100644
index 0000000..17a2cc0
--- /dev/null
+++ b/Tests/VSNsightTegra/build.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="TwoLibs" default="help">
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+</project>
diff --git a/Tests/VSNsightTegra/jni/first.c b/Tests/VSNsightTegra/jni/first.c
new file mode 100644
index 0000000..f09e376
--- /dev/null
+++ b/Tests/VSNsightTegra/jni/first.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "first.h"
+
+int first(int x, int y)
+{
+ return x + y;
+}
diff --git a/Tests/VSNsightTegra/jni/first.h b/Tests/VSNsightTegra/jni/first.h
new file mode 100644
index 0000000..d893480
--- /dev/null
+++ b/Tests/VSNsightTegra/jni/first.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef FIRST_H
+#define FIRST_H
+
+extern int first(int x, int y);
+
+#endif /* FIRST_H */
diff --git a/Tests/VSNsightTegra/jni/second.c b/Tests/VSNsightTegra/jni/second.c
new file mode 100644
index 0000000..4631848
--- /dev/null
+++ b/Tests/VSNsightTegra/jni/second.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "first.h"
+#include <jni.h>
+
+jint
+Java_com_example_twolibs_TwoLibs_add( JNIEnv* env,
+ jobject this,
+ jint x,
+ jint y )
+{
+ return first(x, y);
+}
diff --git a/Tests/VSNsightTegra/res/values/strings.xml b/Tests/VSNsightTegra/res/values/strings.xml
new file mode 100644
index 0000000..858cdb4
--- /dev/null
+++ b/Tests/VSNsightTegra/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">TwoLibs</string>
+</resources>
diff --git a/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java b/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java
new file mode 100644
index 0000000..ef9da01
--- /dev/null
+++ b/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.twolibs;
+
+import android.app.Activity;
+import android.widget.TextView;
+import android.os.Bundle;
+
+public class TwoLibs extends Activity
+{
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ TextView tv = new TextView(this);
+ int x = 1000;
+ int y = 42;
+
+ // here, we dynamically load the library at runtime
+ // before calling the native method.
+ //
+ System.loadLibrary("twolib-second");
+
+ int z = add(x, y);
+
+ tv.setText( "The sum of " + x + " and " + y + " is " + z );
+ setContentView(tv);
+ }
+
+ public native int add(int x, int y);
+}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a62894998f59d87e092a664ea50e33ff8dbb180c
commit a62894998f59d87e092a664ea50e33ff8dbb180c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 2 14:33:17 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:34 2014 -0400
VS: Generate ANDROID_GUI executables as app packages
When an executable is marked with ANDROID_GUI, generate an AntBuild
step in the .vcxproj file and point it at the directory found to
contain AndroidManifest.xml. Assume it also contains build.xml.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index bfabb21..b0c84e3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -615,7 +615,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "StaticLibrary";
break;
case cmTarget::EXECUTABLE:
- if(this->NsightTegra)
+ if(this->NsightTegra &&
+ !this->Target->GetPropertyAsBool("ANDROID_GUI"))
{
// Android executables are .so too.
configType += "DynamicLibrary";
@@ -2019,6 +2020,50 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
}
}
+
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
+ std::string const&)
+{
+ // Look through the sources for AndroidManifest.xml and use
+ // its location as the root source directory.
+ std::string rootDir = this->Makefile->GetCurrentDirectory();
+ {
+ std::vector<cmSourceFile const*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources, "");
+ for(std::vector<cmSourceFile const*>::const_iterator si =
+ extraSources.begin(); si != extraSources.end(); ++si)
+ {
+ if("androidmanifest.xml" == cmSystemTools::LowerCase(
+ (*si)->GetLocation().GetName()))
+ {
+ rootDir = (*si)->GetLocation().GetDirectory();
+ break;
+ }
+ }
+ }
+
+ // Tell MSBuild to launch Ant.
+ {
+ std::string antBuildPath = rootDir;
+ this->WriteString("<AntBuild>\n", 2);
+ this->WriteString("<AntBuildPath>", 3);
+ this->ConvertToWindowsSlash(antBuildPath);
+ (*this->BuildFileStream) <<
+ cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n";
+ }
+
+ {
+ std::string manifest_xml = rootDir + "/AndroidManifest.xml";
+ this->ConvertToWindowsSlash(manifest_xml);
+ this->WriteString("<AndroidManifestLocation>", 3);
+ (*this->BuildFileStream) <<
+ cmVS10EscapeXML(manifest_xml) << "</AndroidManifestLocation>\n";
+ }
+
+ this->WriteString("</AntBuild>\n", 2);
+}
+
//----------------------------------------------------------------------------
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
{
@@ -2390,6 +2435,12 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
this->WriteLinkOptions(*i);
// output lib flags <Lib></Lib>
this->WriteLibOptions(*i);
+ if(this->NsightTegra &&
+ this->Target->GetType() == cmTarget::EXECUTABLE &&
+ this->Target->GetPropertyAsBool("ANDROID_GUI"))
+ {
+ this->WriteAntBuildOptions(*i);
+ }
this->WriteString("</ItemDefinitionGroup>\n", 1);
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 8887d14..36155f9 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -97,6 +97,7 @@ private:
void WriteLinkOptions(std::string const& config);
void WriteMidlOptions(std::string const& config,
std::vector<std::string> const & includes);
+ void WriteAntBuildOptions(std::string const& config);
void OutputLinkIncremental(std::string const& configName);
void WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const & command);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c12e46991e02c2ea59864512d2c1fb7c2b4b0f9d
commit c12e46991e02c2ea59864512d2c1fb7c2b4b0f9d
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 2 13:53:26 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 30 08:45:34 2014 -0400
Add 'ANDROID_API' target property to set Android Target API
Also add a 'CMAKE_ANDROID_API' variable to set the property default.
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index d17ea15..38bcd04 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -79,6 +79,7 @@ Properties on Targets
:maxdepth: 1
/prop_tgt/ALIASED_TARGET
+ /prop_tgt/ANDROID_API
/prop_tgt/ANDROID_GUI
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 8017b43..3f92ec5 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -204,6 +204,7 @@ Variables that Control the Build
.. toctree::
:maxdepth: 1
+ /variable/CMAKE_ANDROID_API
/variable/CMAKE_ANDROID_GUI
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_AUTOMOC_MOC_OPTIONS
diff --git a/Help/prop_tgt/ANDROID_API.rst b/Help/prop_tgt/ANDROID_API.rst
new file mode 100644
index 0000000..714ad58
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_API.rst
@@ -0,0 +1,7 @@
+ANDROID_API
+-----------
+
+Set the Android Target API version (e.g. ``15``). The version number
+must be a positive decimal integer. This property is initialized by
+the value of the :variable:`CMAKE_ANDROID_API` variable if it is set
+when a target is created.
diff --git a/Help/variable/CMAKE_ANDROID_API.rst b/Help/variable/CMAKE_ANDROID_API.rst
new file mode 100644
index 0000000..c8264e0
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_API.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_API
+-----------------
+
+Default value for the :prop_tgt:`ANDROID_API` target property.
+See that target property for additional information.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1e2f75c..85bf087 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -324,6 +324,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Setup default property values.
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
{
+ this->SetPropertyDefault("ANDROID_API", 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 15d0980..bfabb21 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -724,6 +724,12 @@ void cmVisualStudio10TargetGenerator
ntv += toolset? toolset : "Default";
ntv += "</NdkToolchainVersion>\n";
this->WriteString(ntv.c_str(), 2);
+ if(const char* api = this->Target->GetProperty("ANDROID_API"))
+ {
+ this->WriteString("<AndroidTargetAPI>", 2);
+ (*this->BuildFileStream ) <<
+ "android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n";
+ }
}
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list