Add a clang-specific cross-compilation toolchain for AArch64.

A separate toolchain is needed as we cannot simply set CMAKE_C_COMPILER
to clang - it requires specifying the target triple using the --target
flag.
---
 build/aarch64-linux-clang/crosscompile.cmake | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 build/aarch64-linux-clang/crosscompile.cmake

diff --git a/build/aarch64-linux-clang/crosscompile.cmake 
b/build/aarch64-linux-clang/crosscompile.cmake
new file mode 100644
index 000000000..c0fb8a3cd
--- /dev/null
+++ b/build/aarch64-linux-clang/crosscompile.cmake
@@ -0,0 +1,26 @@
+# CMake toolchain file for cross compiling x265 for AArch64, using Clang.
+
+set(CROSS_COMPILE_ARM64 1)
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR aarch64)
+
+set(TARGET_TRIPLE aarch64-linux-gnu)
+
+# specify the cross compiler (giving precedence to user-supplied CC/CXX)
+if(NOT DEFINED CMAKE_C_COMPILER)
+    set(CMAKE_C_COMPILER clang)
+endif()
+if(NOT DEFINED CMAKE_CXX_COMPILER)
+    set(CMAKE_CXX_COMPILER clang++)
+endif()
+
+# specify compiler target
+set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
+set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
+
+# specify assembler target
+list(APPEND ASM_FLAGS "--target=${TARGET_TRIPLE}")
+
+# specify the target environment
+SET(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
+
--
2.42.1

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to