[CMake] CMake, Android, and Eclipse ADT Integration

Parag Chandra parag at ionicsecurity.com
Thu Apr 30 23:11:37 EDT 2015


Hi Robert,

This will be a bit long-winded, so bear with me. I¹m also cross-compiling
for Android with CMake, and am currently using Eclipse ADT for much of my
development. I have tried hard to make Eclipse work for both the Java and
the C++ portions of my libraries and applications, but gave up after a few
months when it became apparent that Eclipse¹s support for Android¹s C++
toolchain is horribly broken. Essentially, I got it to work for brief
periods of time, with concurrent Java/C++ debugging, but then Eclipse
would inexplicably forget all of the library/include paths, display
thousands of red squiggles all over my code, and then refuse to launch my
application. The only Œsolution¹ was to completely strip the project of
its C++ nature, add it back in, and then reconfigure all the
library/include paths, at which point everything would work again for a
few hours or a couple of days. Add to this the fact that Google has
officially deprecated Ant+Eclipse in favor of IntelliJ+Gradle, and it¹s
become clear that my time will be better spent migrating to Android Studio.

Of course, Android Studio has absolutely no support for C/C++ at the
moment, but at least it won¹t get in the way like Eclipse did. So I think
a near-term solution is to use Android Studio for all of the Java code, in
conjunction with one of several different Visual Studio-based offerings
for all the C++ code:

Visual Studio 2015
WinGDB
VisualGDB
Android++

Somewhere around the CMake 3.1 timeframe, they introduced a small feature
that enables the Visual Studio generator to support any arbitrary
cross-toolchain, instead of just a few hardcoded ones. I¹ve been using
this to generate VS solutions that target Native Client as well as Windows
Phone. Although I haven¹t yet had a chance to play around with any of the
offerings I mentioned previously, I believe you will be able to use this
same feature to target Android, after you have installed one of these
plug-ins in Visual Studio.

Probably not the answer you wanted to hear, but I thought I would share my
experience and hopefully save you some trouble.

Parag Chandra
Senior Software Engineer, Mobile Team
Mobile: +1.919.824.1410

 <https://ionic.com>

Ionic Security Inc.
1170 Peachtree St. NE STE 400, Atlanta, GA 30309











On 4/30/15, 4:46 PM, "Robert Dailey" <rcdailey.lists at gmail.com> wrote:

>On Wed, Mar 11, 2015 at 11:42 AM, Robert Dailey
><rcdailey.lists at gmail.com> wrote:
>> I am implementing support for Android in my CMake scripts by using
>> custom commands to invoke 'ant' to build the final APK. If I do it
>> this way, and I generate for eclipse, how can I make sure it will
>> integrate with the ADT plugin?
>>
>> Basically I want to be able to right-click my project in Eclipse
>> (generated by CMake) and "Run as Android Application" and have it
>> deploy to the device. What is required to make this happen?
>>
>> Also any idea how debugging will be impacted?
>>
>> Thanks.
>
>No help or advice on this?
>-- 
>
>Powered by www.kitware.com
>
>Please keep messages on-topic and check the CMake FAQ at:
>http://www.cmake.org/Wiki/CMake_FAQ
>
>Kitware offers various services to support the CMake community. For more
>information on each offering, please visit:
>
>CMake Support: http://cmake.org/cmake/help/support.html
>CMake Consulting: http://cmake.org/cmake/help/consulting.html
>CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list