5

I have a big C++ project that has about hundred source files that are located in a bunch of sub folders. They were initially developed using Xcode IDE, so there are no makefiles there.

Now I need to build it for Android using NDK. I understand how to create Android.mk but I wonder is there any visual tool or maybe script that can do this (or at least basic structure) automatically (maybe smth. like cmake) or do I have to do everything manually (I'll spend a lot of time for this...) ?

givi
  • 1,883
  • 4
  • 22
  • 32

2 Answers2

4

Well you actually can use cmake. I do so in several projects using android ndk toolchain and a modified script that I took from this project that comes from the initial port to android of OpenCV library.

If you don't want to use those scripts as a CMAKE_TOOLCHAIN_FILE (I did not want too) you can do something like:

# Setting android build
SET(CMAKE_TOOLCHAIN_FILE ${CMAKE_MODULE}/android.toolchain.cmake)
# Project name 
PROJECT (YOUR_PROJECT CXX C)

.. configure your project here
javier-sanz
  • 2,504
  • 23
  • 23
  • Do we need to add the above lines of the code in Makefile? (or) do we need to write script file with above line and the last line as you mentioned ".. configure your project here"; do we need to call configure at this line? – Suman Apr 23 '14 at 07:14
  • Yes you need to add the above lines in you CMakeLists.txt or in you CMake scripts – javier-sanz Apr 29 '14 at 08:38
1

I have created a simple to script to generate Android.mk, you can see more information from here.

You can use the option -s|--scan to add all your sources in your sub folders to your LOCAL_SRC_FILES in Android.mk.

alijandro
  • 11,627
  • 2
  • 58
  • 74