[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] CMAKE custom compiler for Android
From:       Ramya G via CMake <cmake () cmake ! org>
Date:       2017-11-29 6:44:03
Message-ID: 02cc01d368db$c6fa5f20$54ef1d60$ () accoliteindia ! com
[Download RAW message or body]

This is a multipart message in MIME format.

[Attachment #2 (multipart/alternative)]
This is a multipart message in MIME format.


HI All,

 

We are working towards creating a toolchain file for an ANDROID compiler

 

We understand that the flow in CMAKE, when CMAKE_SYSTEM_NAME is specified in
Android is different when compared to specifying CMAKE_SYSTEM_NAME as IOS or
LINUX

 

Please validate our current understanding when a toolchain file or
command-line option sets CMAKE_SYSTEM_NAME to "Android" 

 

*	CMakeDetermineSystem.cmake loads this file:
Android-Determine.cmake
*	Next is the platform-specific initialization step:
CMakeSystemSpecificInitialize.cmake which loads Android-Initialize.cmake to
select the sysroot.
*	A "determine" step also runs for each language when it is first
enabled in a new build tree:

 

Android-Determine-C.cmake

Android-Determine-CXX.cmake

 

*	The language files go here:

 

Determine-Compiler.cmake

Determine-Compiler-NDK.cmake

 

*	The latter file is where we parse a bunch of information from the
NDK.

The results persist in CMakeFiles/$v/CMake${lang}Compiler.cmake for future
runs.

 

Next is the language-specific initialization step. For  Example - in case
{lang} is C :     CMakeCInformation.cmake

 

That loads one of these:

 

Android-GNU-C.cmake

Android-Clang-C.cmake

 

which loads one of these:

 

Android-GNU.cmake

Android-Clang.cmake  

 

Determine-Compiler-NDK.cmake is where cmake looks for versions of clang or
gcc or llvm toolchains and sets the appropriate compiler.

 

 

Our Requirement and Problem statement

When we tried manually setting a c and cxx compiler from a toolchain file,
cmake would not allow us to point to our own compilers. Ideally, we want our
toolchain file to tell cmake the libraries to include/link and the compilers
to use. 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 would probably need to make changes in the following files to accommodate
cmake to use our own compilers.

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

 

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

 

 

Can you please provide your suggestions and validate the understanding as
well

 

Thanks & Regards,

Ramya

 

 


[Attachment #5 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:x="urn:schemas-microsoft-com:office:excel" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" \
CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:1152868207;
	mso-list-type:hybrid;
	mso-list-template-ids:1550879954 67698689 67698691 67698693 67698689 67698691 \
67698693 67698689 67698691 67698693;} @list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l0:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l0:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" \
vlink="#954F72"><div class=WordSection1><p class=MsoNormal>HI All,<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>We are working towards \
creating a toolchain file for an ANDROID compiler<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>We understand that the flow \
in CMAKE, when CMAKE_SYSTEM_NAME is specified in Android is different when compared \
to specifying CMAKE_SYSTEM_NAME as IOS or LINUX<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Please validate our current \
understanding when a toolchain file or command-line option sets CMAKE_SYSTEM_NAME to \
&quot;Android&quot; <o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><ul \
style='margin-top:0in' type=disc><li class=MsoNormal style='mso-list:l0 level1 \
lfo1'>CMakeDetermineSystem.cmake loads this file: \
&nbsp;&nbsp;Android-Determine.cmake<o:p></o:p></li><li class=MsoNormal \
style='mso-list:l0 level1 lfo1'>Next is the platform-specific initialization \
step:&nbsp;&nbsp; CMakeSystemSpecificInitialize.cmake which loads \
Android-Initialize.cmake to select the sysroot.<o:p></o:p></li><li class=MsoNormal \
style='mso-list:l0 level1 lfo1'>A &quot;determine&quot; step also runs for each \
language when it is first enabled in a new build tree:<o:p></o:p></li></ul><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:.5in'>Android-Determine-C.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:.5in'>Android-Determine-CXX.cmake<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><ul style='margin-top:0in' type=disc><li \
class=MsoNormal style='mso-list:l0 level1 lfo1'>The language files go \
here:<o:p></o:p></li></ul><p class=MsoNormal \
style='margin-left:.5in'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:.5in'>Determine-Compiler.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:.5in'>Determine-Compiler-NDK.cmake<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><ul style='margin-top:0in' type=disc><li \
class=MsoNormal style='mso-list:l0 level1 lfo1'>The latter file is where we parse a \
bunch of information from the NDK.<o:p></o:p></li></ul><p class=MsoNormal \
style='margin-left:.5in;text-indent:.5in'>The results persist in \
CMakeFiles/$v/CMake${lang}Compiler.cmake for future runs.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>Next is the language-specific initialization step.&nbsp;For \
&nbsp;Example &#8211; in case {lang} is C : \
&nbsp;&nbsp;&nbsp;&nbsp;CMakeCInformation.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>That loads one of these:<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>Android-GNU-C.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>Android-Clang-C.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>which loads one of these:<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>Android-GNU.cmake<o:p></o:p></p><p class=MsoNormal \
style='margin-left:1.0in'>Android-Clang.cmake&nbsp;&nbsp;<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='text-indent:.5in'>Determine-Compiler-NDK.cmake is where cmake looks for \
versions of clang or gcc or llvm toolchains and sets the appropriate \
compiler.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><b><u>Our Requirement and \
Problem statement<o:p></o:p></u></b></p><p class=MsoNormal>When we tried manually \
setting a c and cxx compiler from a toolchain file, cmake would not allow us to point \
to our own compilers. Ideally, we want our toolchain file to tell cmake the libraries \
to include/link and the compilers to use. 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.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>We would probably need to \
make changes in the following files to accommodate cmake to use our own \
compilers.<o:p></o:p></p><p class=MsoNormal>Determine-Compiler-NDK.cmake&nbsp; - We \
would need to add support for an &quot;NewCompiler Toolchain&quot; which would \
contain android libraries and compilers.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>New \
Android-{NewCompiler}-C.cmake, Android-{ NewCompiler }-CXX.cmake, Android-{ \
NewCompiler }.cmake and another appropriate toolchain file to set target architecture \
and compiler flags.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Can you please provide your \
suggestions and validate the understanding as well<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Thanks &amp; \
Regards,<o:p></o:p></p><p class=MsoNormal>Ramya<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>



-- 

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://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic