Browse Source

Use MSBuild when building LLVM on Windows due to PDB issues with Ninja.

pull/1179/head
Joao Matos 6 years ago committed by João Matos
parent
commit
5c4f3be5fb
  1. 2
      build/scripts/Build.lua
  2. 16
      build/scripts/LLVM.lua

2
build/scripts/Build.lua

@ -14,7 +14,7 @@ function get_msbuild_path() @@ -14,7 +14,7 @@ function get_msbuild_path()
end
function msbuild(sln, conf)
local msbuild_path = path.normalize(path.join(get_msbuild_path(), "msbuild.exe"))
local msbuild_path = "msbuild.exe"
local sln = path.normalize(sln)
local cmd = msbuild_path .. " " .. sln

16
build/scripts/LLVM.lua

@ -221,6 +221,10 @@ function cmake(gen, conf, builddir, options) @@ -221,6 +221,10 @@ function cmake(gen, conf, builddir, options)
options = options .. " -DLLVM_USE_LINKER=/usr/bin/ld.lld"
end
if os.ishost("windows") then
options = options .. "-Thost=x64"
end
local cmd = cmake .. " -G " .. '"' .. gen .. '"'
.. ' -DLLVM_BUILD_TOOLS=false'
.. ' -DLLVM_ENABLE_DUMP=true'
@ -360,7 +364,7 @@ function build_llvm(llvm_build) @@ -360,7 +364,7 @@ function build_llvm(llvm_build)
os.mkdir(llvm_build)
local conf = get_llvm_configuration_name()
local use_msbuild = false
local use_msbuild = true
if os.ishost("windows") and use_msbuild then
cmake(get_cmake_generator(), conf, llvm_build)
local llvm_sln = path.join(llvm_build, "LLVM.sln")
@ -372,6 +376,7 @@ function build_llvm(llvm_build) @@ -372,6 +376,7 @@ function build_llvm(llvm_build)
if is32bits then
options = options .. (is32bits and " -DLLVM_BUILD_32_BITS=true" or "")
end
cmake("Ninja", conf, llvm_build, options)
ninja('"' .. llvm_build .. '"')
ninja('"' .. llvm_build .. '"', "clang-headers")
@ -393,25 +398,26 @@ function package_llvm(conf, llvm, llvm_build) @@ -393,25 +398,26 @@ function package_llvm(conf, llvm, llvm_build)
os.copydir(llvm_build .. "/include", out .. "/build/include")
local llvm_msbuild_libdir = "/" .. conf .. "/lib"
local lib_dir = os.ishost("windows") and os.isdir(llvm_msbuild_libdir)
local lib_dir = (os.ishost("windows") and os.isdir(llvm_build .. llvm_msbuild_libdir))
and llvm_msbuild_libdir or "/lib"
local llvm_build_libdir = llvm_build .. lib_dir
if os.ishost("windows") and os.isdir(llvm_build_libdir) then
os.copydir(llvm_build_libdir, out .. "/build" .. lib_dir, "*.lib")
os.copydir(llvm_build_libdir, out .. "/build/lib", "*.lib")
else
os.copydir(llvm_build_libdir, out .. "/build/lib", "*.a")
end
os.copydir(llvm .. "/tools/clang/include", out .. "/tools/clang/include")
os.copydir(llvm_build .. "/tools/clang/include", out .. "/build/tools/clang/include")
os.copydir(llvm_build .. "/lib/clang", out .. "/lib/clang")
os.copydir(llvm_build_libdir .. "/clang", out .. "/lib/clang")
os.copydir(llvm .. "/tools/clang/lib/CodeGen", out .. "/tools/clang/lib/CodeGen", "*.h")
os.copydir(llvm .. "/tools/clang/lib/Driver", out .. "/tools/clang/lib/Driver", "*.h")
os.copydir(llvm .. "/tools/clang/lib/Driver/ToolChains", out .. "/tools/clang/lib/Driver/ToolChains", "*.h")
local out_lib_dir = out .. "/build" .. lib_dir
local out_lib_dir = out .. "/build/lib"
if os.ishost("windows") then
os.rmfiles(out_lib_dir, "LLVM*ObjCARCOpts*.lib")
os.rmfiles(out_lib_dir, "clang*ARC*.lib")

Loading…
Cancel
Save