From 1e6ee09b997f231435f676dfa4e319d1d9538cca Mon Sep 17 00:00:00 2001 From: Corey McNeish Date: Mon, 19 Feb 2024 00:07:54 -0800 Subject: [PATCH] Resolve "Error finding an LLVM build" (#1831) Pass through Visual Studio version from build.sh into build/LLVM.lua, so that the downloaded version is consistent with build.sh's view rather than the host command prompt's view. --- build/LLVM.lua | 7 ++++++- build/build.sh | 8 ++++---- build/llvm/LLVM.lua | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build/LLVM.lua b/build/LLVM.lua index 9ac89c54c..24efcbea4 100644 --- a/build/LLVM.lua +++ b/build/LLVM.lua @@ -9,6 +9,11 @@ local LLVMRootDirRelease = "" require "llvm/LLVM" +newoption { + trigger = "vs", + description = "Override Visual Studio version with particular version" +} + function SearchLLVM() LLVMRootDirDebug = builddir .. "/llvm/" .. get_llvm_package_name(nil, "Debug") LLVMRootDirRelease = builddir .. "/llvm/" .. get_llvm_package_name() @@ -20,7 +25,7 @@ function SearchLLVM() elseif os.isdir(LLVMRootDir) then print("Using LLVM build: " .. LLVMRootDir) else - error("Error finding an LLVM build") + error("Error finding an LLVM build. Tried: " .. LLVMRootDirDebug .. " and " .. LLVMRootDirRelease) end end diff --git a/build/build.sh b/build/build.sh index 5cd81557a..72a5c4588 100755 --- a/build/build.sh +++ b/build/build.sh @@ -129,22 +129,22 @@ download_premake() download_llvm() { - "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" download_llvm --os=$os --arch=$platform --configuration=$configuration + "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" download_llvm --vs=$vs --os=$os --arch=$platform --configuration=$configuration } clone_llvm() { - "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" clone_llvm --os=$os --arch=$platform --configuration=$configuration + "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" clone_llvm --vs=$vs --os=$os --arch=$platform --configuration=$configuration } build_llvm() { - "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" build_llvm --os=$os --arch=$platform --configuration=$configuration + "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" build_llvm --vs=$vs --os=$os --arch=$platform --configuration=$configuration } package_llvm() { - "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" package_llvm --os=$os --arch=$platform --configuration=$configuration + "$builddir/premake.sh" --file="$builddir/llvm/LLVM.lua" package_llvm --vs=$vs --os=$os --arch=$platform --configuration=$configuration } detect_os() diff --git a/build/llvm/LLVM.lua b/build/llvm/LLVM.lua index 0a08c0619..3d2b9fe02 100644 --- a/build/llvm/LLVM.lua +++ b/build/llvm/LLVM.lua @@ -52,6 +52,10 @@ function clone_llvm() end function get_vs_version() + if _OPTIONS["vs"] then + return _OPTIONS["vs"] + end + local function map_msvc_to_vs_version(major, minor) if major == "19" and minor >= "30" then return "vs2022" elseif major == "19" and minor >= "20" then return "vs2019"