cmake, ldc, and cross compiling

Dan Olson zans.is.for.cans at yahoo.com
Tue Jan 21 00:23:44 PST 2014


When I build ldc as cross compiler to iOS (armv7-apple-darwin), I'd like
to:

- use gcc-4.8 to compile ldc to host
- use clang llvm to cross compile runtime C code to iOS

cmake seems to only have room from one C compiler.  Is there a way
around this?

I was initially able to get away with using clang for both since I built
it with all targets enabled.  Now I switched from clang to gcc for ldc
build since llvm trunk insists on a newer stdc++.  Installing gcc-4.8
from macports was my solution.

I think supporting different compilers for ldc and runtime/phobos should
be expected when cross compiling though.

Also, I'd like to add something like CACHE to RT_CFLAGS so that it can
be set with cmake.  This will let the runtime C compiler be invoked with
cross compile flags  like this:

set(RT_CFLAGS "-target armv7-apple-darwin -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk")

I have just been editing the CMakeLists.txt for now to set these flags.

-- 
Dan


More information about the digitalmars-d-ldc mailing list