Skip to content

Commit

Permalink
Resolve "Error finding an LLVM build" (#1831)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmcneish committed Feb 19, 2024
1 parent f2f48dc commit 1e6ee09
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion build/LLVM.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions build/llvm/LLVM.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1e6ee09

Please sign in to comment.