@@ -423,6 +423,7 @@ function build_llvm(llvm_build)
423
423
424
424
os .mkdir (llvm_build )
425
425
426
+ print (" starting llvm build process... " .. target_architecture ())
426
427
local conf = get_llvm_configuration_name ()
427
428
local use_msbuild = true
428
429
if os .ishost (" windows" ) and use_msbuild then
@@ -438,10 +439,46 @@ function build_llvm(llvm_build)
438
439
local options = os .ishost (" macosx" ) and
439
440
" -DLLVM_ENABLE_LIBCXX=true" or " "
440
441
local is32bits = target_architecture () == " x86"
442
+ local targetIsArm64 = target_architecture () == " arm64"
443
+
441
444
if is32bits then
442
445
options = options .. (is32bits and " -DLLVM_BUILD_32_BITS=true" or " " )
443
446
end
444
447
448
+ if targetIsArm64 then
449
+ if os .host () == " linux" then
450
+ local host_arch = unix_host_architecture ()
451
+ print (" XXXX Found host arch " .. host_arch )
452
+ if host_arch ~= " aarch64" then
453
+ print (" XXXX DOING CROSS COMPILE!!! XXXX" )
454
+ options = " "
455
+ .. ' -DCMAKE_SYSTEM_NAME=Linux'
456
+ .. ' -DCMAKE_SYSTEM_PROCESSOR=aarch64'
457
+ .. ' -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc'
458
+ .. ' -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++'
459
+ .. ' -DCMAKE_ASM_COMPILER=/usr/bin/aarch64-linux-gnu-as'
460
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER'
461
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY'
462
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY'
463
+ .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY'
464
+ .. ' ' .. options
465
+ end
466
+ end
467
+ if os .host () == " macos" then
468
+ local host_arch = unix_host_architecture ()
469
+ if host_arch ~= " arm64" then
470
+ options = " "
471
+ .. ' -DCMAKE_SYSTEM_NAME=Darwin'
472
+ .. ' -DCMAKE_SYSTEM_PROCESSOR=arm64'
473
+ .. ' -DCMAKE_C_COMPILER_TARGET=arm64-apple-darwin21.6.0'
474
+ .. ' -DCMAKE_CXX_COMPILER_TARGET=arm64-apple-darwin21.6.0'
475
+ .. ' -DCMAKE_ASM_COMPILER_TARGET=arm64-apple-darwin21.6.0'
476
+ .. ' ' .. options
477
+ end
478
+ end
479
+ end
480
+
481
+
445
482
cmake (" Ninja" , conf , llvm_build , options )
446
483
ninja (' "' .. llvm_build .. ' "' )
447
484
ninja (' "' .. llvm_build .. ' "' , " clang-headers" )
0 commit comments