[CMake] [CMAKE] - custom compiler for Android

ramya.gopalkrishna at accoliteindia.com ramya.gopalkrishna at accoliteindia.com
Wed Dec 6 11:39:06 EST 2017


HI Brad,

Thank you for the response
However we want more guidance on how do we start with the changes needed for
the compiler support

To be more clear, we are trying to build support for the embarcadero
compilers bccaarm.exe. To give more insight on the work and our query, we
have attached a working toolchain that we created and works fine with CMAKE
and the compiler. But we have given the system name CMAKE_SYSTEM_NAME as
"_Android"
Since we havent given it as "Android", it reads all the libraries and the
compilers from our toolchain file and gives the desired output. 

Can you please give us some guidance to achieve the same with
CMAKE_SYSTEM_NAME as "Android"

Thanks & Regards,
Ramya

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Wednesday, December 06, 2017 1:24 AM
To: ramya.gopalkrishna at accoliteindia.com
Cc: CMake at cmake.org; 'Sumit Chourasia' <sumit.chourasia at accoliteindia.com>
Subject: Re: [CMAKE] - custom compiler for Android

On 12/05/2017 12:05 PM, ramya.gopalkrishna at accoliteindia.com wrote:
> Please validate our current understanding when a toolchain file or 
> command-line option sets CMAKE_SYSTEM_NAME to "Android"

You may find this note helpful:

  https://gitlab.kitware.com/cmake/cmake/issues/16708#note_300971

> Ideally, we want our toolchain file to tell cmake the libraries to 
> include/link and the compilers to use.

Toolchain files can set the path to compilers on the host, but
target-platform-wide information like the set of libraries and include
directories to use typically belongs in platform information modules (e.g.
`Platform/Android-...` and the like).

> But once, System has been determined as android, cmake goes through 
> the above sequence of events and expects toolchains to be specified 
> for either clang, gcc or llvm compilers.

We try to support the compilers that come with the NDK out of the box.
More work may be needed to support other compilers, just as would be the
case for any new platform or new compiler.

> Determine-Compiler-NDK.cmake  - We would need to add support for an 
> "NewCompiler Toolchain" which would contain android libraries and
compilers.

Since your compiler doesn't come with the NDK, perhaps you could look at
using the standalone toolchain mode.

> New Android-{NewCompiler}-C.cmake, Android-{ NewCompiler }-CXX.cmake, 
> Android-{ NewCompiler }.cmake and another appropriate toolchain file 
> to set target architecture and compiler flags.

If you have some new compiler then something like that would be needed.
This would be the case for a new compiler on any platform.

-Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bccaarm.cmake
Type: application/octet-stream
Size: 1193 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171206/5fd4ea87/attachment-0001.obj>


More information about the CMake mailing list