[Cmake-commits] CMake branch, next, updated. v3.0.2-5515-g977a76d
Brad King
brad.king at kitware.com
Mon Sep 29 16:10:03 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 977a76d6f3015618ef2dd31f98cae2e5f820e634 (commit)
via 89d6d2ee35ab506c586a7969bcb9896d333bf17d (commit)
via 98e2762b8de44db575ffd6f360195ab05cdb995f (commit)
via 2920bda902176afd42aadbdec0008e6bed4fb8e6 (commit)
via aa456d0dbf5acecb7e8d5c51128e1e8412f51443 (commit)
via 2a33785e09d085682f858b12aae8c46afdeb2256 (commit)
via b26e2c2fc8cb1d2e332b6de83efd7dbbbb6e3677 (commit)
via cc47d2a3b38efef17d173a79b831da9ec0d44896 (commit)
via 9a4df52aa1f6736c2eceebd109240441bc3a4d6e (commit)
via 16569abfa83ce231b1270282f03aae0b4542c42d (commit)
via ef0fd4f0ced850edd049bb05b527c3bd234f441f (commit)
via d09b60f563902bd2197d88a3e83b119c09e62428 (commit)
via 2f071466ebd4e3a416a523ac5f17c84543ff8b3c (commit)
via c655f0c417f66096a62bb837e163ec636665dd69 (commit)
via 227a336714274992f90ad171bd6588d8dd17b76c (commit)
via 4a24015afccfa71bed9ea741af38ef4463740074 (commit)
from 1e1e74e729392e0326daf30f41b5782c15a9d1ee (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=977a76d6f3015618ef2dd31f98cae2e5f820e634
commit 977a76d6f3015618ef2dd31f98cae2e5f820e634
Merge: 1e1e74e 89d6d2e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 29 16:09:59 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 29 16:09:59 2014 -0400
Merge topic 'vs-nsight-tegra-generator' into next
89d6d2ee Help: Add notes for topic 'vs-nsight-tegra-generator'
98e2762b VS: Generate Nsight Tegra project revision number
2920bda9 VS: Map Nsight Tegra file types in .vcxproj files
aa456d0d VS: Fix Tegra-Android platform linking of libraries by name
2a33785e Tests: Add test for VS Nsight Tegra generator support
b26e2c2f VS: Generate ANDROID_GUI executables as app packages
cc47d2a3 Add 'ANDROID_API' target property to set Android Target API
9a4df52a Add 'ANDROID_GUI' target property to mark Android applications
16569abf cmTarget: Track internally whether platform is Android
ef0fd4f0 VS: Teach vcxproj generation about the Tegra-Android platform
d09b60f5 VS: Detect compiler id of Nsight Tegra-Android toolchains
2f071466 VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
c655f0c4 VS: Drop GenerateManifest from .vcxproj files for non-MS tools
227a3367 VS: Use case-insensitive check for hlsl,jpg,png,xml file extensions
4a24015a Tests: Always detect VS and SDK availability on Windows
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89d6d2ee35ab506c586a7969bcb9896d333bf17d
commit 89d6d2ee35ab506c586a7969bcb9896d333bf17d
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: Mon Sep 29 16:08:32 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=98e2762b8de44db575ffd6f360195ab05cdb995f
commit 98e2762b8de44db575ffd6f360195ab05cdb995f
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: Mon Sep 29 16:08:32 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=2920bda902176afd42aadbdec0008e6bed4fb8e6
commit 2920bda902176afd42aadbdec0008e6bed4fb8e6
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: Mon Sep 29 16:08:32 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=aa456d0dbf5acecb7e8d5c51128e1e8412f51443
commit aa456d0dbf5acecb7e8d5c51128e1e8412f51443
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: Mon Sep 29 16:05:54 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=2a33785e09d085682f858b12aae8c46afdeb2256
commit 2a33785e09d085682f858b12aae8c46afdeb2256
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: Mon Sep 29 16:05:54 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=b26e2c2fc8cb1d2e332b6de83efd7dbbbb6e3677
commit b26e2c2fc8cb1d2e332b6de83efd7dbbbb6e3677
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: Mon Sep 29 16:05:54 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=cc47d2a3b38efef17d173a79b831da9ec0d44896
commit cc47d2a3b38efef17d173a79b831da9ec0d44896
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: Mon Sep 29 16:05:54 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..82edb4e
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_API.rst
@@ -0,0 +1,6 @@
+ANDROID_API
+-----------
+
+Set the Android Target API version (e.g. ``15``). 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()
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a4df52aa1f6736c2eceebd109240441bc3a4d6e
commit 9a4df52aa1f6736c2eceebd109240441bc3a4d6e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 24 14:49:56 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:53 2014 -0400
Add 'ANDROID_GUI' target property to mark Android applications
Also add a 'CMAKE_ANDROID_GUI' variable to set the property default
so a project can easily make all executables Android applications.
An Android application executable file has the same extension as a
shared library (.so).
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index d28229a..d17ea15 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_GUI
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 097eba3..8017b43 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_GUI
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_AUTOMOC_MOC_OPTIONS
/variable/CMAKE_AUTOMOC
diff --git a/Help/prop_tgt/ANDROID_GUI.rst b/Help/prop_tgt/ANDROID_GUI.rst
new file mode 100644
index 0000000..90d2428
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_GUI.rst
@@ -0,0 +1,9 @@
+ANDROID_GUI
+-----------
+
+Build an executable as an application package on Android.
+
+When this property is set to true the executable when built for Android
+will be created as an application package. This property is initialized
+by the value of the :variable:`CMAKE_ANDROID_GUI` variable if it is set
+when a target is created.
diff --git a/Help/variable/CMAKE_ANDROID_GUI.rst b/Help/variable/CMAKE_ANDROID_GUI.rst
new file mode 100644
index 0000000..1755375
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_GUI.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_GUI
+-----------------
+
+Default value for the :prop_tgt:`ANDROID_GUI` target property of
+executables. See that target property for additional information.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 80c0020..1e2f75c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -446,6 +446,10 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0);
}
+ if(this->TargetTypeValue == cmTarget::EXECUTABLE)
+ {
+ this->SetPropertyDefault("ANDROID_GUI", 0);
+ }
if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY
|| this->TargetTypeValue == cmTarget::MODULE_LIBRARY)
{
@@ -3504,7 +3508,10 @@ const char* cmTarget::GetSuffixVariableInternal(bool implib) const
case cmTarget::EXECUTABLE:
return (implib
? "CMAKE_IMPORT_LIBRARY_SUFFIX"
- : "CMAKE_EXECUTABLE_SUFFIX");
+ // Android GUI application packages store the native
+ // binary as a shared library.
+ : (this->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI")?
+ "CMAKE_SHARED_LIBRARY_SUFFIX" : "CMAKE_EXECUTABLE_SUFFIX"));
default:
break;
}
@@ -3528,7 +3535,12 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
? "CMAKE_IMPORT_LIBRARY_PREFIX"
: "CMAKE_SHARED_MODULE_PREFIX");
case cmTarget::EXECUTABLE:
- return (implib? "CMAKE_IMPORT_LIBRARY_PREFIX" : "");
+ return (implib
+ ? "CMAKE_IMPORT_LIBRARY_PREFIX"
+ // Android GUI application packages store the native
+ // binary as a shared library.
+ : (this->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI")?
+ "CMAKE_SHARED_LIBRARY_PREFIX" : ""));
default:
break;
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16569abfa83ce231b1270282f03aae0b4542c42d
commit 16569abfa83ce231b1270282f03aae0b4542c42d
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 24 15:03:04 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:53 2014 -0400
cmTarget: Track internally whether platform is Android
Add an IsAndroid member to save whether CMAKE_SYSTEM_NAME is "Android".
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index acae0b3..80c0020 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -257,6 +257,7 @@ cmTarget::cmTarget()
#endif
this->HaveInstallRule = false;
this->DLLPlatform = false;
+ this->IsAndroid = false;
this->IsApple = false;
this->IsImportedTarget = false;
this->BuildInterfaceIncludesAppended = false;
@@ -312,6 +313,11 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->Makefile->IsOn("CYGWIN") ||
this->Makefile->IsOn("MINGW"));
+ // Check whether we are targeting an Android platform.
+ this->IsAndroid =
+ strcmp(this->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"),
+ "Android") == 0;
+
// Check whether we are targeting an Apple platform.
this->IsApple = this->Makefile->IsOn("APPLE");
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 333e2ae..a3ecca0 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -755,6 +755,7 @@ private:
mutable cmPropertyMap Properties;
LinkLibraryVectorType OriginalLinkLibraries;
bool DLLPlatform;
+ bool IsAndroid;
bool IsApple;
bool IsImportedTarget;
mutable bool DebugIncludesDone;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef0fd4f0ced850edd049bb05b527c3bd234f441f
commit ef0fd4f0ced850edd049bb05b527c3bd234f441f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 10 11:33:19 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:53 2014 -0400
VS: Teach vcxproj generation about the Tegra-Android platform
Complete the basic implementation of the VS Tegra-Android generators
by replacing parts of vcxproj files that are specific to MS tools
with settings defined for the NVIDIA Nsight Tegra tools.
Current limitations include:
* We have no "flag table" so flags will be passed in the additional
options fields instead of mapped to the vcxproj elements defined
by Nsight Tegra msbuild platform definition files.
* We have no interface to set the AndroidArch, AndroidStlType, or
AndroidTargetAPI fields so defaults will be used.
* The Nsight Tegra msbuild platform definition files do not provide
a working "Utility" target type so for add_custom_target we need
to use a "StaticLibrary" target type and leave out ClCompile rules.
* There is also no target type for plain command-line executables
so for add_executable we need to use a "DynamicLibrary" target.
Full application bundles will likely require new CMake target
properties (like WIN32_EXECUTABLE for Windows GUI executables).
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a13cbd2..15d0980 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -180,7 +180,8 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->GlobalGenerator->CreateGUID(this->Name.c_str());
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName();
- this->MSTools = true;
+ this->NsightTegra = gg->IsNsightTegra();
+ this->MSTools = !this->NsightTegra;
this->TargetCompileAsWinRT = false;
this->BuildFileStream = 0;
this->IsMissingFiles = false;
@@ -312,6 +313,15 @@ void cmVisualStudio10TargetGenerator::Generate()
"xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
this->WriteString(project_defaults.c_str(),0);
+ if(this->NsightTegra)
+ {
+ this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1);
+ this->WriteString("<NsightTegraProjectRevisionNumber>"
+ "6"
+ "</NsightTegraProjectRevisionNumber>\n", 2);
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+
this->WriteProjectConfigurations();
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
this->WriteString("<ProjectGUID>", 2);
@@ -605,11 +615,27 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "StaticLibrary";
break;
case cmTarget::EXECUTABLE:
- configType += "Application";
+ if(this->NsightTegra)
+ {
+ // Android executables are .so too.
+ configType += "DynamicLibrary";
+ }
+ else
+ {
+ configType += "Application";
+ }
break;
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
- configType += "Utility";
+ if(this->NsightTegra)
+ {
+ // Tegra-Android platform does not understand "Utility".
+ configType += "StaticLibrary";
+ }
+ else
+ {
+ configType += "Utility";
+ }
break;
case cmTarget::UNKNOWN_LIBRARY:
case cmTarget::INTERFACE_LIBRARY:
@@ -622,6 +648,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
this->WriteMSToolConfigurationValues(*i);
}
+ else if(this->NsightTegra)
+ {
+ this->WriteNsightTegraConfigurationValues(*i);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
@@ -683,6 +713,19 @@ void cmVisualStudio10TargetGenerator
}
}
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator
+::WriteNsightTegraConfigurationValues(std::string const&)
+{
+ cmGlobalVisualStudio10Generator* gg =
+ static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ const char* toolset = gg->GetPlatformToolset();
+ std::string ntv = "<NdkToolchainVersion>";
+ ntv += toolset? toolset : "Default";
+ ntv += "</NdkToolchainVersion>\n";
+ this->WriteString(ntv.c_str(), 2);
+}
+
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
{
this->SourcesVisited.clear();
@@ -2188,6 +2231,10 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib");
}
}
+ else if(this->NsightTegra)
+ {
+ linkOptions.AddFlag("SoName", targetNameSO.c_str());
+ }
linkOptions.Parse(flags.c_str());
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d6db18a..8887d14 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -59,6 +59,7 @@ private:
void WriteMSToolConfigurationValues(std::string const& config);
void WriteHeaderSource(cmSourceFile const* sf);
void WriteExtraSource(cmSourceFile const* sf);
+ void WriteNsightTegraConfigurationValues(std::string const& config);
void WriteSource(std::string const& tool, cmSourceFile const* sf,
const char* end = 0);
void WriteSources(std::string const& tool,
@@ -139,6 +140,7 @@ private:
std::string GUID;
std::string Name;
bool MSTools;
+ bool NsightTegra;
bool TargetCompileAsWinRT;
cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d09b60f563902bd2197d88a3e83b119c09e62428
commit d09b60f563902bd2197d88a3e83b119c09e62428
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 10 11:30:28 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:53 2014 -0400
VS: Detect compiler id of Nsight Tegra-Android toolchains
Teach CMakeDetermineCompilerId to recognize the Tegra-Android platform
and generate a test project for Nsight Tegra tools. Locate the full
path to CMAKE_<LANG>_COMPILER by computing it within the test project
build environment.
Also teach CMakeFindBinUtils that this variant of the Visual Studio
generator uses UNIX-like instead of MS-like archiving and linking tools.
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index e00f22a..a7b5760 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -142,7 +142,17 @@ Id flags: ${testflags}
set(id_platform ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}")
set(id_cl cl.exe)
- if(lang STREQUAL Fortran)
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(v NsightTegra)
+ set(ext vcxproj)
+ if(lang STREQUAL CXX)
+ set(id_gcc g++)
+ set(id_clang clang++)
+ else()
+ set(id_gcc gcc)
+ set(id_clang clang)
+ endif()
+ elseif(lang STREQUAL Fortran)
set(v Intel)
set(ext vfproj)
set(id_cl ifort.exe)
@@ -161,9 +171,13 @@ Id flags: ${testflags}
set(id_platform ia64)
endif()
if(CMAKE_VS_PLATFORM_TOOLSET)
- set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
- if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
- set(id_cl icl.exe)
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>")
+ else()
+ set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
+ if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
+ set(id_cl icl.exe)
+ endif()
endif()
else()
set(id_toolset "")
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index dda28bd..e0ba131 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -35,7 +35,8 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"
OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC"
OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"
- OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+ OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio"
+ AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/CompilerId/VS-NsightTegra.vcxproj.in b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
new file mode 100644
index 0000000..b7389eb
--- /dev/null
+++ b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="NsightTegraProject">
+ <NsightTegraProjectRevisionNumber>6</NsightTegraProjectRevisionNumber>
+ </PropertyGroup>
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|@id_platform@">
+ <Configuration>Debug</Configuration>
+ <Platform>@id_platform@</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
+ <RootNamespace>CompilerId at id_lang@</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ @id_toolset@
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ </Link>
+ <PostBuildEvent>
+ <Command>
+if "$(ToolchainName)"=="gcc" (
+ for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_gcc at .exe) do (
+ @echo CMAKE_ at id_lang@_COMPILER=%%i
+ goto :done
+ )
+)
+if "$(ToolchainName)"=="clang" (
+ for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_clang at .exe) do (
+ @echo CMAKE_ at id_lang@_COMPILER=%%i
+ goto :done
+ )
+)
+:done
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="@id_src@" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+</Project>
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f071466ebd4e3a416a523ac5f17c84543ff8b3c
commit 2f071466ebd4e3a416a523ac5f17c84543ff8b3c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 18 11:12:11 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:52 2014 -0400
VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
When CMAKE_SYSTEM_NAME is 'Android', check for an installation of
'NVIDIA Nsight Tegra Visual Studio Edition' and generate .vcxproj
files for the "Tegra-Android" platform. Also make the installed
version available in a CMAKE_VS_NsightTegra_VERSION variable.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index b00c16e..097eba3 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -74,6 +74,7 @@ Variables that Provide Information
/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
/variable/CMAKE_VS_MSBUILD_COMMAND
/variable/CMAKE_VS_MSDEV_COMMAND
+ /variable/CMAKE_VS_NsightTegra_VERSION
/variable/CMAKE_VS_PLATFORM_NAME
/variable/CMAKE_VS_PLATFORM_TOOLSET
/variable/CMAKE_XCODE_PLATFORM_TOOLSET
diff --git a/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst
new file mode 100644
index 0000000..386c3a9
--- /dev/null
+++ b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst
@@ -0,0 +1,7 @@
+CMAKE_VS_NsightTegra_VERSION
+----------------------------
+
+When using a Visual Studio generator with the
+:variable:`CMAKE_SYSTEM_NAME` variable set to ``Android``,
+this variable contains the version number of the
+installed NVIDIA Nsight Tegra Visual Studio Edition.
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index e947c54..21d1f34 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -198,6 +198,31 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
return false;
}
}
+ else if(this->SystemName == "Android")
+ {
+ if(this->DefaultPlatformName != "Win32")
+ {
+ cmOStringStream e;
+ e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR "
+ << "specifies a platform too: '" << this->GetName() << "'";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+ std::string v = this->GetInstalledNsightTegraVersion();
+ if(v.empty())
+ {
+ mf->IssueMessage(cmake::FATAL_ERROR,
+ "CMAKE_SYSTEM_NAME is 'Android' but "
+ "'NVIDIA Nsight Tegra Visual Studio Edition' "
+ "is not installed.");
+ return false;
+ }
+ this->DefaultPlatformName = "Tegra-Android";
+ this->DefaultPlatformToolset = "Default";
+ this->NsightTegraVersion = v;
+ mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v.c_str());
+ }
+
return true;
}
@@ -587,3 +612,19 @@ bool cmGlobalVisualStudio10Generator::UseFolderProperty()
{
return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Generator::IsNsightTegra() const
+{
+ return !this->NsightTegraVersion.empty();
+}
+
+//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
+{
+ std::string version;
+ cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;"
+ "Version", version, cmSystemTools::KeyWOW64_32);
+ return version;
+}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index c02d204..1df98e3 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -59,6 +59,9 @@ public:
/** Is the installed VS an Express edition? */
bool IsExpressEdition() const { return this->ExpressEdition; }
+ /** Generating for Nsight Tegra VS plugin? */
+ bool IsNsightTegra() const;
+
/** The toolset name for the target platform. */
const char* GetPlatformToolset() const;
@@ -106,6 +109,8 @@ public:
virtual void FindMakeProgram(cmMakefile*);
+ static std::string GetInstalledNsightTegraVersion();
+
protected:
virtual void Generate();
virtual bool InitializeSystem(cmMakefile* mf);
@@ -124,6 +129,7 @@ protected:
std::string DefaultPlatformToolset;
std::string SystemName;
std::string SystemVersion;
+ std::string NsightTegraVersion;
bool SystemIsWindowsCE;
bool SystemIsWindowsPhone;
bool SystemIsWindowsStore;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c655f0c417f66096a62bb837e163ec636665dd69
commit c655f0c417f66096a62bb837e163ec636665dd69
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 26 10:12:31 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:52 2014 -0400
VS: Drop GenerateManifest from .vcxproj files for non-MS tools
The .vcxproj file content generated by OutputLinkIncremental is
specific to MS tools, so drop it when using other tools.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 3cb0c61..a13cbd2 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1593,6 +1593,10 @@ void
cmVisualStudio10TargetGenerator::
OutputLinkIncremental(std::string const& configName)
{
+ if(!this->MSTools)
+ {
+ return;
+ }
// static libraries and things greater than modules do not need
// to set this option
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=227a336714274992f90ad171bd6588d8dd17b76c
commit 227a336714274992f90ad171bd6588d8dd17b76c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 24 14:25:35 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:52 2014 -0400
VS: Use case-insensitive check for hlsl,jpg,png,xml file extensions
These "extra" sources should map to the proper tool even when they
are not in lower case.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 4b5c83f..3cb0c61 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1130,7 +1130,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
bool toolHasSettings = false;
std::string tool = "None";
std::string shaderType;
- std::string const& ext = sf->GetExtension();
+ std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
if(ext == "hlsl")
{
tool = "FXCompile";
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a24015afccfa71bed9ea741af38ef4463740074
commit 4a24015afccfa71bed9ea741af38ef4463740074
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 16 09:35:56 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 29 16:05:52 2014 -0400
Tests: Always detect VS and SDK availability on Windows
Move the detection block out of the Windows >= 8 conditional so it
can be used on other versions.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5b336ce..2b70f56 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1780,6 +1780,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
+ if(WIN32)
+ 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)
+ get_filename_component(r "${reg_${reg}}" ABSOLUTE)
+ if(IS_DIRECTORY "${r}")
+ set(${reg} 1)
+ else()
+ set(${reg} 0)
+ endif()
+ endforeach()
+ endif()
+
get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME)
if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0
macro(add_test_VSWinStorePhone name generator systemName systemVersion)
@@ -1796,20 +1813,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}")
endmacro()
- 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)
- get_filename_component(r "${reg_${reg}}" ABSOLUTE)
- if(IS_DIRECTORY "${r}")
- set(${reg} 1)
- else()
- set(${reg} 0)
- endif()
- endforeach()
if(vs11 AND ws80)
add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0)
add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012 ARM" WindowsStore 8.0)
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list