This is an archive of the discontinued LLVM Phabricator instance.

cmake: Use custom target to compile timeit/fpcmp
AbandonedPublic

Authored by MatzeB on Nov 25 2015, 7:46 PM.

Details

Reviewers
rengolin
beanz
Summary

When cross compiling the testsuite we still need to compile timeit/fpcmp
for the host machine. These two files are extremely simple C files so adding a custom
command that just runs "cc timeit.c -o timeit" should do the trick.

Diff Detail

Event Timeline

MatzeB updated this revision to Diff 41205.Nov 25 2015, 7:46 PM
MatzeB retitled this revision from to cmake: Use custom target to compile timeit/fpcmp.
MatzeB updated this object.
MatzeB added reviewers: jmolloy, rengolin, beanz.
MatzeB added a subscriber: llvm-commits.
beanz edited edge metadata.Nov 30 2015, 9:24 AM

Since these are really simple source files, it is probably better to check CMAKE_CROSSCOMPILING and when cross-compiling use ExternalProject to configure host versions of the tools.

Since these are really simple source files, it is probably better to check CMAKE_CROSSCOMPILING and when cross-compiling use ExternalProject to configure host versions of the tools.

Looks like my cmake-foo is not strong enough for ExternalProject_Add.

For one CMAKE_CROSSCOMPILING is not set for me even though I am happily crosscompiling to aarch64 by just passing the respective -arch arm64 CFLAGS. Apart from that AddExternalProject_Add has a LOT of options and I am not really sure which ones I need or what to set them to. Are you sure this is better/simpler than two simple custom commands?

beanz added a comment.Dec 1 2015, 8:58 AM

CMAKE_CROSSCOMPILING is set by CMake when you explicitly set CMAKE_SYSTEM_NAME. Instead of setting the -arch flag, try setting CMAKE_TOOLCHAIN_FILE to point to the ios.cmake file in LLVM trunk, and set CMAKE_OSX_ARCHITECTURES to arm64.

There is an example of cross compiling LLVM here: http://llvm.org/docs/GettingStarted.html#cross-compiling-llvm

jmolloy resigned from this revision.Apr 27 2016, 6:32 AM
jmolloy removed a reviewer: jmolloy.

Resigning from this as it's stalled.

MatzeB abandoned this revision.Jul 20 2016, 8:20 PM

Abandoning this for now as the current solution seems to work good enough.