This allows for building compiler-rt to target multiple android
architectures, by using a set of -DTARGET_<arch>_CFLAGS cmake arguments.
Details
- Reviewers
danalbert compnerd beanz srhines tberghammer
Diff Detail
Event Timeline
The various architecture spellings are available in config-ix.cmake, and it seems nicer to re-use those. Note that the alternate that I proposed I just wrote up, didnt actually run, so it probably requires tweaking :-)
cmake/Modules/CompilerRTUtils.cmake | ||
---|---|---|
147 | I think that this is better written as: set(SAVED_CMAKE_REQUIRED_FLAS "${CMAKE_REQUIRED_FLAGS}") foreach(arch ARM64;ARM32;X86;X86_64;MIPS32;MIPS64;S390X;WASM32;WASM64) set(CMAKE_REQUIRED_FLAGS "${SAVED_CMAKE_REQUIRED_FLAGS} ${${TARGET_${arch}_CFLAGS}}") foreach(spelling ${${arch}}) check_symbol_exists(__${spelling}__ "" __${arch}_${spelling}) if(__${arch}_${spelling}) add_default_target_arch("${arch}") break() endif() endforeach() endforeach() |
Multiple simultaneous architectures are not well-supported by cmake (for example, checks for existing headers only occur once).
In general we need to be moving compiler-rt into the direction of building one and only one architecture per CMake invocation except on platforms that support fat binaries, where we should support one target platform per invocation.
There is a lot of work to be done to get to that point, but it is the way to go so that we stop fighting with CMake trying to make it do things it isn't designed to do.
-Chris
I think that this is better written as: