-
Notifications
You must be signed in to change notification settings - Fork 81
CrossCompile
doe300 edited this page Feb 14, 2021
·
4 revisions
Configure CMake:
- Set
CROSS_COMPILE
toON
- Set
SYSROOT_CROSS
to the path containing your library for the target platform - Set
CROSS_COMPILER_PATH
to the path containing the cross-compiler (e.g.usr/bin
) - Set
CROSS_COMPILER_PREFIX
to the prefix all command of the cross-compiler have (e.g.armv6-rpi-linux-gnueabihf-
) or set to empty for no prefix
Assumptions:
- The Khronos SPIRV-LLVM was built (for the host-architecture!) into path
/opt/SPIRV-LLVM/build
- The SPIRV-LLVM source is in
/opt/SPIRV-LLVM/
- The Raspberry Pi cross-compiler is in
/opt/rasperrypi/tools
- Run this command (adjust if necessary) in the directory to build the cross-compiled tools (i.e.
/tmp/SPIRV-LLVM
):cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=/opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_FIND_ROOT_PATH="/opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64 /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf" -DCMAKE_CROSSCOMPILING=True -DLLVM_TABLEGEN=/opt/SPIRV-LLVM/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/opt/SPIRV-LLVM/build/bin/clang-tblgen -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_TARGET_ARCH=ARM /opt/SPIRV-LLVM/
- Run
make clang llvm-as llvm-spirv
- Copy destination directory to Raspberry Pi
- Set correct path to cross-compiled SPIRV-LLVM in VC4C
CMakeLists.txt
(settingSPIRV_COMPILER_ROOT
)