<div dir="ltr">> Can you explain more why this generator is needed?<div><br></div><div>There are a handful of different reasons.</div><div><br></div><div>It's true that generic makefiles can be made used to generate binaries for pretty much any platform.  That said, cmake still has non-make generators like Xcode and Visual Studio.  I consider this another example of that.</div>
<div><br></div><div>If your cmake-based project needs to interoperate with other projects that use Visual Studio projects, it is most convenient to generate Visual Studio project files from cmake</div><div><br></div><div>
Similarly, if your cmake-based project needs to interoperate with other projects that use Android.mk files, it is most convenient to generate Android.mk files from cmake.</div><div><br></div><div>Android.mk files allow you to target multiple processor architectures/variants in one make invocation without any reconfiguring or multiple build folders.  All of those binaries are embedded into one "fat" apk file that will run on any supported Android device.  This is important to the processor independence goals of the Android project.  It also lets you switch between different clang/gcc compilers trivially, which helps significantly when testing code across multiple compilers.</div>
<div><br></div><div>This method of building modules is also used in building Android itself.  Instead of a collection of recursive makefiles, all modules are built in a single make invocation, which is faster.<br></div><div>
<br></div><div>Read "Recursive Make Considered Harmful" if you're interested in learning more.</div><div><a href="http://aegis.sourceforge.net/auug97.pdf">http://aegis.sourceforge.net/auug97.pdf</a><br></div>
<div><br></div><div>> Modules/Platform/Android.cmake</div><div><br></div><div>I've just started playing with it like this as my Android.cmake</div><div><br></div><div>include(Platform/Linux)</div><div><br></div><div>
But it's critical to have Android as a separate CMAKE_SYSTEM_NAME because there are many differences that you might want to switch on.</div><div><br></div><div>> Why does that link also say that Android.mk files are only for creating shared and static libraries? Am I missing something here?</div>
<div><br></div><div>All Android applications start life as Java processes.  A java process can load a native shared library and invoke code within it.  To emit a C/C++ executable on Android is the same as to emit a shared library, but linked to something called the native_app_glue module.<br>
</div><div><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Date: Tue, 07 Jan 2014 17:12:29 +0100<br>
From: Stephen Kelly <<a href="mailto:steveire@gmail.com">steveire@gmail.com</a>><br>
Subject: Re: [cmake-developers] [Generator] Android.mk<br>
To: <a href="mailto:cmake-developers@cmake.org">cmake-developers@cmake.org</a><br>
Message-ID: <lah910$8q8$<a href="mailto:1@ger.gmane.org">1@ger.gmane.org</a>><br>
Content-Type: text/plain; charset="ISO-8859-1"<br>
<br>
Vince Harron wrote:<br>
<br>
> Hi all,<br>
><br>
> Thomas Richard asked this question a while back.<br>
><br>
> <a href="http://public.kitware.com/pipermail/cmake-developers/2013-March/006825.html" target="_blank">http://public.kitware.com/pipermail/cmake-developers/2013-March/006825.html</a><br>
><br>
> I would also like to see support for generating Android.mk files from<br>
> CMake.<br>
<br>
Hi,<br>
<br>
Thanks for offering this. I'm no Android expert, but I've built applications<br>
and libraries for android with normal makefiles, as have others. Can you<br>
explain more why this generator is needed?<br>
<br>
This is a bit orthogonal but it seems to me that it would be worthwhile to<br>
create an Modules/Platform/Android.cmake file to make it easier to target<br>
Android with existing generators. Is there some way that that is too<br>
limited?> <br>
<br>
[aside: I see on <a href="http://www.kandroid.org/ndk/docs/ANDROID-MK.html" target="_blank">http://www.kandroid.org/ndk/docs/ANDROID-MK.html</a> that there<br>
is a LOCAL_CPP_FEATURES API. That's good independent validation of my design<br>
for cmake compiler features<br>
<a href="http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/6726/focus=7746" target="_blank">http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/6726/focus=7746</a><br>
]<br>
<br>
Why does that link also say that Android.mk files are only for creating<br>
shared and static libraries? Am I missing something here?<br>
<br>
Thanks,<br>
<br>
Steve.<br></blockquote></div>
</div></div></div></div>