To enable cross-compiling, pass a CMake toolchain file to the script using
the -toolchain-file option.
For example:
./test-release.sh -release 16.0.0 -final -toolchain-file pwd/aarch64-redhat-linux.cmake -triple aarch64-redhat-linux -use-ninja
Differential D151385
test-release.sh: Add support for cross-compiling tstellar on May 24 2023, 4:01 PM. Authored by
Details
Diff Detail
Event TimelineComment Actions Looks fine to me. But I am unsure if we need to have the toolchain file checked into LLVM. Wouldn't that be up to the person cross-compiling? Going to be hard to assume stuff there?
Comment Actions
It could serve as an example. There is a bunch of CMake cache files in clang/cmake/caches and those are quite helpful in understanding how to build a toolchain.
Comment Actions I wanted to add cross-compile support so that we could build 'official' binaries using GitHub actions for other arches besides x86_64. For this scenario, I think it makes sense to have the toolchain file somewhere in tree, so that it is easy to reproduce the builds. This specific file works with a container image that I created with all the necessary cross-libs, which I would also like to put in tree somewhere. Comment Actions I guess this makes sense for that use. I wonder if we shouldn't start putting these files (all files related to release management) in a new top-level directory like release or utils instead of shoving them under the llvm directory. I think it might make more sense and be easier to understand that they are universal instead of just related to the llvm sub-project. |
How about splitting this into
CMAKE_SYSROOT and CMAKE_<LANG>_COMPILER_TARGET?
(This is what the CMake documentation suggests, I don't know if it works).