[PATCH] D11082: [CMake] Adding some utility functions for Darwin builds into a new CompilerRTDarwinUtils.cmake module

Chris Bieneman beanz at apple.com
Tue Jul 21 12:23:39 PDT 2015

beanz added a comment.

I'll send updated patches shortly that fix some of the small issues. I have some big comments inline that regarding your suggestion about `COMPILER_RT_SUPPORTED_ARCH`. I think this may need more discussion before landing these patches.

Comments inline below.


Comment at: cmake/Modules/CompilerRTDarwinUtils.cmake:4
@@ +3,3 @@
+# the current Xcode.
+function(find_darwin_sdk_dir var sdk_name)
+  # Let's first try the internal SDK, otherwise use the public SDK.
samsonov wrote:
> Please actually use this function in `CMakeLists.txt` (and delete macro used there).
Sure. I can move that into this patch. I was doing that in D11083.

Comment at: cmake/Modules/CompilerRTDarwinUtils.cmake:26
@@ +25,3 @@
+# link for.
+function(darwin_get_toolchain_supported_archs output_var)
+  execute_process(
samsonov wrote:
> Looks like this should be the Darwin version of the complex code that generates `COMPILER_RT_SUPPORTED_ARCH`. Can you just call it from there?
Hooking this into where we setup `COMPILER_RT_SUPPORTED_ARCH` would be pretty complicated. Much of that code in config-ix.cmake is based around the idea of building compiler-rt for a single target. Also `darwin_get_toolchain_supported_archs` returns a long list of architectures we don't care about. On the latest Xcode the list is: `armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7m armv7em`.

For Darwin we currently build for //n// architectures and //m// platforms generating an //n// x //m// configuration matrix. To take the architectures returned by `ld -v` and group them into platform-architecture pairs we'd also need all the compiler flags properly setup for each platform. Currently that is all done in `CMakeLists.txt:272-315` well after config-ix is processed.

In order to do this work in config-ix, we would need to shift all of that around, which would make these patches quite substantial. I'd like to avoid doing that because I really want to get rid of all of that, but I don't yet have a sane transition strategy yet.


Comment at: cmake/Modules/CompilerRTDarwinUtils.cmake:79
@@ +78,1 @@
\ No newline at end of file

samsonov wrote:
> please fix
Will do in my next update.


More information about the llvm-commits mailing list