[cmake-developers] cmake's built-in support for android using nvidia nsight tegra

Peter List pem.list at gmail.com
Mon Aug 24 21:20:05 EDT 2015


Per Brad's suggestion, I removed this line from my CMakeLists.txt:

add_library(${PROJECT_NAME} SHARED ${SRC_LIST})

And I added these lines:

set(CMAKE_ANDROID_GUI TRUE)
set(CMAKE_ANDROID_API 19) # Kindle Fire HD 6
set(CMAKE_ANDROID_API_MIN 19) # Kindle Fire HD 6
add_executable(${PROJECT_NAME} ${SRC_LIST})

I am now able to generate a Visual Studio 2010 pemDemos.sln that includes a
pemDemos.vcxproj with a configuration properties section "Ant Built".  From
inside Visual Studio, I'm able to build an APK and then ctrl+F5 to run it
on my device.

Unfortunately, cmake did not generate AndroidManifest.xml, so I had to
supply my own using the aforementioned execute_process() with android.bat.

At this point my app just displays a "Hello World, PemActivity" message
that it gets from "build-android\android\res\layout\main.xml".  So it's not
using "android_native_app_glue.c,h" to point to my "main.cpp" code in
"libpemDemos.so" yet.  So maybe cmake doesn't do that part automatically
for me?  I also don't see a tutorial or simple hello world demo project for
this...  However, I can at least use AndroidNativeApp.vcxproj as a
reference.

thank you & best regards











On Mon, Aug 24, 2015 at 9:49 AM, Brad King <brad.king at kitware.com> wrote:

> On 08/23/2015 04:44 PM, Peter List wrote:
> > How do I tell cmake to include "Ant Build" in my vcxproj, so that
> > it will package my project into an APK?  I can generate vcxproj
> > that builds a Tegra-Android *.so file, but it does not build me
> > an APK, and my vcxproj is missing the "Ant Build" property section.
>
> You need to set the ANDROID_GUI target property on an exe:
>
>  http://www.cmake.org/cmake/help/v3.3/prop_tgt/ANDROID_GUI.html
>
> Additional settings have been added in post-3.3 development:
>
>  VS: Add more Nsight Tegra generator Android property settings
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c0afaf4
>
> -Brad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150824/be2ce459/attachment.html>


More information about the cmake-developers mailing list