This allows to provide flags in the top-level CMake invocation for specifying e. g. a target processor to build builtins for, like this:
cmake -DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-mcpu=cortex-a15" ../llvm
Differential D66648
[compiler-rt] Respect CMAKE_C_FLAGS when building builtins in-tree broadwaylamb on Aug 23 2019, 5:57 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions Im not sure if this works. This sets the flags from the global flags, which may not be what we want as compiler-rt can be built as part of llvm itself. Comment Actions Building builtins as part of LLVM itself is exactly what I’m trying to accomplish. But it turns out there was no way to specify C flags just for builtins from the LLVM cmake invocation, which is what I’ve attempted to address here. The global CMAKE_C_FLAGS will not be caught by builtins with this change simply because they won’t be passed to the “nested” CMake invocation. Instead, to specify CMAKE_C_FLAGS for builtins, you’ll need to pass them like this: -DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=..." when building LLVM. This is assuming I got this whole CMake thing right (this is only my second contribution to LLVM). If not, I would appreciate any advice on how to pass C flags to builtins when building them as part of LLVM. |