@@ -438,10 +438,44 @@ function build_llvm(llvm_build)
438
438
local options = os .ishost (" macosx" ) and
439
439
" -DLLVM_ENABLE_LIBCXX=true" or " "
440
440
local is32bits = target_architecture () == " x86"
441
+ local targetIsArm64 = target_architecture () == " arm64"
442
+
441
443
if is32bits then
442
444
options = options .. (is32bits and " -DLLVM_BUILD_32_BITS=true" or " " )
443
445
end
444
446
447
+ if targetIsArm64 then
448
+ if os .host () == " linux" then
449
+ local host_arch = unix_host_architecture ()
450
+ if host_arch ~= " aarch64" then
451
+ options = options .. " "
452
+ .. ' -DCMAKE_SYSTEM_NAME=Linux'
453
+ .. ' -DCMAKE_SYSTEM_PROCESSOR=aarch64'
454
+ .. ' -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc'
455
+ .. ' -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++'
456
+ .. ' -DCMAKE_ASM_COMPILER=/usr/bin/aarch64-linux-gnu-as'
457
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER'
458
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY'
459
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY'
460
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY'
461
+ .. ' ' .. options
462
+ end
463
+ end
464
+ if os .host () == " macosx" then
465
+ local host_arch = unix_host_architecture ()
466
+ if host_arch ~= " arm64" then
467
+ options = options .. " "
468
+ .. ' -DCMAKE_SYSTEM_NAME=Darwin'
469
+ .. ' -DCMAKE_SYSTEM_PROCESSOR=arm64'
470
+ .. ' -DCMAKE_C_COMPILER_TARGET=arm64-apple-darwin21.6.0'
471
+ .. ' -DCMAKE_CXX_COMPILER_TARGET=arm64-apple-darwin21.6.0'
472
+ .. ' -DCMAKE_ASM_COMPILER_TARGET=arm64-apple-darwin21.6.0'
473
+ .. ' ' .. options
474
+ end
475
+ end
476
+ end
477
+
478
+
445
479
cmake (" Ninja" , conf , llvm_build , options )
446
480
ninja (' "' .. llvm_build .. ' "' )
447
481
ninja (' "' .. llvm_build .. ' "' , " clang-headers" )
0 commit comments