[Patch] Improvements for CMake cross compilation on OS X

Chris Bieneman beanz at apple.com
Tue Sep 2 13:56:02 PDT 2014


Thanks for the feedback Brad.

The iOS support is definitely "Works for Me". My hope is this would also work for Android, but I'm not setup to build for Android.

The CMake command I'm using is:

cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="armv7" -DCMAKE_TOOLCHAIN_FILE=../llvm/cmake/platforms/iOS.cmake ../llvm/

How does this revised patch look?

Thanks,
-Chris


On Sep 2, 2014, at 6:35 AM, Brad King <brad.king at kitware.com> wrote:

> On 8/28/2014 4:22 PM, Chandler Carruth wrote:
>> Adding folks with specific knowledge of the compiler-rt and cmake and
>> the trickiness there...
>> 
>> On Thu, Aug 28, 2014 at 1:13 PM, Chris Bieneman wrote:
>> 
>>    The attached patch modifies how cross compiling is handled with
>>    CMake to make it possible to cross compile LLVM and Clang using a
>>    single CMake invocation. This patch works for LLVM & Clang with no
>>    additional patches required. It does not work for compiler-rt
>>    because of how compiler-rt's CMake configuration is implemented.
> 
> Thanks for working on this.  I've glanced through the patch and
> it looks correct for the approach intended.  I'm not set up to
> apply and test the patch with an iOS toolchain so I cannot confirm
> that it works.
> 
>> COMMAND ${CMAKE_BUILD_TOOL} ${target}
>> ...
>> COMMAND ${CMAKE_BUILD_TOOL} llvm-config
> 
> FYI, these custom commands may be better written with the form
> 
> cmake --build . --target ${target} --config $<CONFIGURATION>
> 
> in order to work across all CMake generators (note that the
> $<CONFIGURATION> is literal: it is a generator expression).
> 
> Another completely different approach is to use the ExternalProject
> module to create a "superbuild" from a tiny source tree that does
> nothing but use ExternalProject_Add to configure the host and target
> builds separately and in order.
> 
> -Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140902/3df37d35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cross-compile-revised.diff
Type: application/octet-stream
Size: 7923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140902/3df37d35/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140902/3df37d35/attachment-0001.html>


More information about the llvm-commits mailing list