[CMake] CMake & Android NDK projects with Eclipse

J Decker d3ck0r at gmail.com
Tue Feb 25 00:43:12 EST 2014


This is my toolchain..

https://code.google.com/p/c-system-abstraction-component-gui/source/browse/a2_toolchain.txt

# sample invokation sorta...
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug
-DCMAKE_TOOLCHAIN_FILE=.../a2_toolchain.txt -D__ANDROID__=1
-DANDROID_DIR=j:/general/android/android-ndk-r9
-DANDROID_NDK_VERSION=android-ndk-r9 ${project_root}

make

-----------------------
after getting it all compiled to build the package..

https://code.google.com/p/c-system-abstraction-component-gui/source/browse/android_build/intershell/CMakeLists.txt

Copies a lot of files into various places.
What files do you need?

https://code.google.com/p/c-system-abstraction-component-gui/wiki/BuildingForAndroid#Building_Details

After getting the files in the right places building boils down to..


set( Project Dekware )
   add_custom_target( package
       COMMAND android.bat update project --target "android-14" --path .
       COMMAND ant.bat ${CMAKE_BUILD_TYPE}
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/package
   )


    add_custom_target( install
    COMMAND echo adb install command...
                     COMMAND adb install
package/bin/${Project}-${CMAKE_BUILD_TYPE}.apk
 )
    add_custom_target( uninstall
    COMMAND echo adb uninstall command...
                     COMMAND adb uninstall org.d3x0r.sack.${Project}
 )



On Mon, Feb 24, 2014 at 6:08 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> Doesn't anyone have any guidance on this? Either this list is dead or
> I'm asking the wrong questions. However I find it hard to believe that
> people do not use CMake with Android NDK projects.
>
> The key piece I need to figure out is that after I define a library
> target using NDK, how do I setup the java package stuff as a post
> build even or custom target?
>
> On Thu, Feb 20, 2014 at 10:04 PM, Robert Dailey
> <rcdailey.lists at gmail.com> wrote:
>> Thanks, this does help with the toolchain part of it (I had already
>> seen the one you linked), however I'm concerned about actually
>> building the APK. Do I need to just create a custom target that
>> invokes 'ant debug' and 'ant release'? Or is there more granular
>> control I need to have?
>>
>> On Thu, Feb 20, 2014 at 12:58 PM, Aashish Chaudhary
>> <aashish.chaudhary at kitware.com> wrote:
>>> Have a look here:
>>>
>>> http://vtk.org/gitweb?p=VES.git;a=tree;f=CMake/toolchains;h=c09a5c6933cf04fec83fe94afcea2e47afbce9e7;hb=HEAD
>>>
>>> Corresponding blog: http://www.kitware.com/blog/home/post/546
>>>
>>> - Aashish
>>>
>>>
>>>
>>> On Thu, Feb 20, 2014 at 9:21 AM, Robert Dailey <rcdailey.lists at gmail.com>
>>> wrote:
>>>>
>>>> After a bit of research I found out you can create a toolchain file
>>>> for Android NDK, however I'm not sure how to plug in the java files.
>>>> It looks like it must be done separately after the C++ target is
>>>> added, so I was hoping maybe a post-build event could tie in the logic
>>>> to build the complete package. Any tips on how to do this? I'm sure
>>>> someone here has done it before... Information on the web seems
>>>> limited.
>>>>
>>>> On Mon, Feb 17, 2014 at 10:29 AM, Robert Dailey
>>>> <rcdailey.lists at gmail.com> wrote:
>>>> > Using the very latest & greatest CMake, is there built in support for
>>>> > Android NDK projects using Eclipse? I think this might involve cross
>>>> > compilation too.
>>>> >
>>>> > Basically it'd be nice if there was a wiki (up to date with latest
>>>> > CMake features) that walks through the setup process. What environment
>>>> > variables to set, what specialized CMake script logic must be setup
>>>> > per platform (host machine), how to properly include java files into
>>>> > those projects, etc etc...
>>>> >
>>>> > Any walkthroughs 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://www.cmake.org/mailman/listinfo/cmake
>>>
>>>
>>>
>>>
>>> --
>>> | Aashish Chaudhary
>>> | R&D Engineer
>>> | Kitware Inc.
>>> | www.kitware.com
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list