I’ve started migrating the runtime/stdlib build over locally. I currently have most of the main runtimes building (swift core, concurrency, distributed, differentiation, etc). I’ve successfully cross compiled those libraries from my Mac to iOS, Arch Linux, Oracle Linux 5 and run some simple programs (async Fibonacci, printing type names and command line arguments, and some simple linked lists) also cross-compiled to these systems. I still need to try building for windows and android. Windows is hard because it’s not exactly something I can cross compile to from a Mac legally.
In order to cross compile, you’ll need the sysroot, a cmake cache file with what functionality you want enabled, and a tool chain file specifying the compilers and such that you want to use.
One thing to note, like LLVM’s runtime builds and unlike Rust builds, we’ve decided that the compiler should be the thing that can build and run with older runtimes, while the stdlib can use new features that just landed in the compiler. For building them independently, this means that you will need a compiler that is at least as old as the stdlib to build the stdlib.
These two properties have an interesting interaction with the android support in CMake, which knows how to reach into the NDK and pull out the tools from the NDK itself so you don’t need to pass a toolchain file. The NDK toolchain is obviously missing a certain swift compiler and won’t have a clang with swift calling convention support, so I still need to make sure that we can override the toolchain pieces when working with the android support. Otherwise, it should be fairly straightforward to support android as well.
CMake 3.26 is the oldest version that has sufficient support for all of the pieces that we need (targets that can mix C, C++, and Swift being the main one). I am, however, enabling the new features coming in 3.29 in a backward compatible way, so if you have a newer CMake, you can use LSP support in the Swift portions of the project as well.
That seems to be within the policy recommended above and sounds completely reasonable to me.
I thought it needed at least 5.8 or 5.9 for the C++ interop support these days?