MantisBT - CMake
View Issue Details
0015562CMakeCMakepublic2015-05-11 01:322016-06-10 14:31
Gopi Krishnan 
Kitware Robot 
highmajorunable to reproduce
closedmoved 
Android
 
 
0015562: Generate the Android Make file
I am Having C/C++ source file and trying to generate the Android Make file. But in Cmake tool seems it is not available .

It is Possible to generate the Android Makefile for my C/C++ source.

No tags attached.
Issue History
2015-05-11 01:32Gopi KrishnanNew Issue
2015-08-31 08:08Gregor JasnyNote Added: 0039358
2015-08-31 08:11Gregor JasnyAssigned To => Gregor Jasny
2015-08-31 08:11Gregor JasnyStatusnew => assigned
2015-08-31 08:12Gregor JasnyAssigned ToGregor Jasny =>
2015-08-31 08:14Gregor JasnyNote Added: 0039359
2015-10-19 17:37John AndersonNote Added: 0039649
2015-10-19 18:17Ben BoeckelNote Added: 0039652
2015-10-20 08:22Brad KingNote Added: 0039653
2016-06-10 14:29Kitware RobotNote Added: 0042775
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039358)
Gregor Jasny   
2015-08-31 08:08   
I have a function for this available:
.. command:: generate_android_mk

  Generates an Android.mk file for a target. If APPEND is set the target is appended to the 
  file. That way you can make multiple calls to generate_android_mk for one single file.

  This file could be used by the Android NDK build system. Usage::

    generate_android_mk(TARGET <target> FILE <output> [APPEND]
                        [CPPFLAGS <flag1> ...]
                        [LIBRARIES <lib1> ...])

  Example::

      generate_android_mk(
        FILE "${MY_ANDROID_MK}"
        TARGET mylib
        LIBRARIES boost_chrono-gcc-mt boost_date_time-gcc-mt boost_thread-gcc-mt boost_system-gcc-mt
        
CPPFLAGS -frtti)

      install(FILES "${MY_ANDROID_MK}" DESTINATION "/")


I will polish it within the next two weeks.
(0039359)
Gregor Jasny   
2015-08-31 08:14   
I think I misread your request. What do you want to achieve? Compiling some libraries with the help of CMake or make a CMake generated library consumable by plain Android NDK?
(0039649)
John Anderson   
2015-10-19 17:37   
Any news on this? I'm hoping to see a generator that outputs Android.mk files to be consumed by ndk-build.
(0039652)
Ben Boeckel   
2015-10-19 18:17   
That is unlikely. The NDK would need to document and stabilize internal semantics related to the Android.mk files. For example, how does CMake add/remove -fPIC? Change the output name of a library? The soversion? How to get ndk-build to rerun CMake when the relevant CMake files change? The ndk-build tool also (AFAIK) uses a strict directory format whereas CMake tends to mirror the source tree layout.

All of these things can probably be done by setting internal variables used by the NDK, but it is also easily broken by even minor NDK bumps.

I think the best way to do it is have CMake build your libraries, drop them in a directory for the NDK to use and then have a target which runs ndk-build.
(0039653)
Brad King   
2015-10-20 08:22   
Another possibility is to have the export() and install(EXPORT) commands support generating Android.mk files that import the results of a CMake-based build into the NDK build as prebuilt binaries.
(0042775)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.