[llvm] Build clang with the latest released clang on Windows on Arm. (PR #116701)
Daniel Kiss via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 06:59:21 PST 2024
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/116701
>From 38d6e3f5e2a0fc930f12450d3a78d0705c72bb83 Mon Sep 17 00:00:00 2001
From: Daniel Kiss <daniel.kiss at arm.com>
Date: Mon, 18 Nov 2024 19:58:31 +0000
Subject: [PATCH 1/2] Build clang with the latest released clang on Windows on
Arm.
With this[1] build of clang out of the box cmake fails.
On a Windows on Arm with just cmake, ninja, git, python and clang[1] can be built with[2] this change.
check-clang doesn't work yet.
[1] https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/LLVM-19.1.2-woa64.exe
[2] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DLLVM_TARGETS_TO_BUILD="AArch64" -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF ../llvm && ninja clang compiler-rt
Change-Id: I8849489fc043e63efa57d2d45fb596d422d6baaf
---
llvm/cmake/modules/GetHostTriple.cmake | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake
index 1be13bc01ab9b2..2a10b1d256c7a0 100644
--- a/llvm/cmake/modules/GetHostTriple.cmake
+++ b/llvm/cmake/modules/GetHostTriple.cmake
@@ -42,7 +42,21 @@ function( get_host_triple var )
set( value "powerpc-ibm-aix" )
endif()
else( MSVC )
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS AND CMAKE_C_COMPILER_ID MATCHES "Clang" )
+ if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
+ set( value "aarch64-pc-windows-msvc" )
+ elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
+ set( value "armv7-pc-windows-msvc" )
+ elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
+ set( value "x86_64-pc-windows-msvc" )
+ elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
+ set( value "i686-pc-windows-msvc" )
+ elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+ set( value "x86_64-pc-windows-msvc" )
+ else()
+ set( value "i686-pc-windows-msvc" )
+ endif()
+ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
message(WARNING "unable to determine host target triple")
else()
set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
>From 48a57b2ee75374b6141e7a0a1e181914c28ebe22 Mon Sep 17 00:00:00 2001
From: Daniel Kiss <daniel.kiss at arm.com>
Date: Tue, 19 Nov 2024 15:58:52 +0100
Subject: [PATCH 2/2] simplify the controlflow
Change-Id: I6e4d6336f639ca4a55829ccd5beab35d5abad339
---
llvm/cmake/modules/GetHostTriple.cmake | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake
index 2a10b1d256c7a0..abf99cb327acff 100644
--- a/llvm/cmake/modules/GetHostTriple.cmake
+++ b/llvm/cmake/modules/GetHostTriple.cmake
@@ -2,7 +2,7 @@
# Invokes config.guess
function( get_host_triple var )
- if( MSVC )
+ if(MSVC OR (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_C_COMPILER_ID MATCHES "Clang"))
if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
set( value "aarch64-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
@@ -41,22 +41,8 @@ function( get_host_triple var )
else()
set( value "powerpc-ibm-aix" )
endif()
- else( MSVC )
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS AND CMAKE_C_COMPILER_ID MATCHES "Clang" )
- if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
- set( value "aarch64-pc-windows-msvc" )
- elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
- set( value "armv7-pc-windows-msvc" )
- elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
- set( value "x86_64-pc-windows-msvc" )
- elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
- set( value "i686-pc-windows-msvc" )
- elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
- set( value "x86_64-pc-windows-msvc" )
- else()
- set( value "i686-pc-windows-msvc" )
- endif()
- elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
+ else()
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
message(WARNING "unable to determine host target triple")
else()
set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
More information about the llvm-commits
mailing list