Browse Source

Added support for multiple configurations of the LLVM binary dependency packages.

pull/605/head
Joao Matos 11 years ago
parent
commit
cc87e09cff
  1. 86
      build/LLVM.lua
  2. 9
      build/scripts/LLVM.lua

86
build/LLVM.lua

@ -2,18 +2,26 @@
LLVMRootDir = depsdir .. "/llvm/" LLVMRootDir = depsdir .. "/llvm/"
local LLVMDirPerConfiguration = false
local LLVMRootDirDebug = ""
local LLVMRootDirRelease = ""
require "scripts/LLVM" require "scripts/LLVM"
function SearchLLVM() function SearchLLVM()
local pkg_path = basedir .. "/scripts/" .. get_llvm_package_name() LLVMRootDirDebug = basedir .. "/scripts/" .. get_llvm_package_name(nil, "Debug")
if os.isdir(pkg_path) then LLVMRootDirRelease = basedir .. "/scripts/" .. get_llvm_package_name()
LLVMRootDir = pkg_path
if os.isdir(LLVMRootDirDebug) or os.isdir(LLVMRootDirRelease) then
LLVMDirPerConfiguration = true
print("Using debug LLVM build: " .. LLVMRootDirDebug)
print("Using release LLVM build: " .. LLVMRootDirRelease)
elseif os.isdir(LLVMRootDir) then elseif os.isdir(LLVMRootDir) then
print("Using LLVM build: " .. LLVMRootDir)
else else
error("Error finding an LLVM build") error("Error finding an LLVM build")
end end
print("Using LLVM build: " .. LLVMRootDir)
end end
function get_llvm_build_dir() function get_llvm_build_dir()
@ -23,15 +31,37 @@ end
function SetupLLVMIncludes() function SetupLLVMIncludes()
local c = configuration() local c = configuration()
local LLVMBuildDir = get_llvm_build_dir() if LLVMDirPerConfiguration then
includedirs configuration { "Debug" }
{ includedirs
path.join(LLVMRootDir, "include"), {
path.join(LLVMRootDir, "tools/clang/include"), path.join(LLVMRootDirDebug, "include"),
path.join(LLVMRootDir, "tools/clang/lib"), path.join(LLVMRootDirDebug, "tools/clang/include"),
path.join(LLVMBuildDir, "include"), path.join(LLVMRootDirDebug, "tools/clang/lib"),
path.join(LLVMBuildDir, "tools/clang/include"), path.join(LLVMRootDirDebug, "build/include"),
} path.join(LLVMRootDirDebug, "build/tools/clang/include"),
}
configuration { "Release" }
includedirs
{
path.join(LLVMRootDirRelease, "include"),
path.join(LLVMRootDirRelease, "tools/clang/include"),
path.join(LLVMRootDirRelease, "tools/clang/lib"),
path.join(LLVMRootDirRelease, "build/include"),
path.join(LLVMRootDirRelease, "build/tools/clang/include"),
}
else
local LLVMBuildDir = get_llvm_build_dir()
includedirs
{
path.join(LLVMRootDir, "include"),
path.join(LLVMRootDir, "tools/clang/include"),
path.join(LLVMRootDir, "tools/clang/lib"),
path.join(LLVMBuildDir, "include"),
path.join(LLVMBuildDir, "tools/clang/include"),
}
end
configuration(c) configuration(c)
end end
@ -39,21 +69,31 @@ end
function SetupLLVMLibs() function SetupLLVMLibs()
local c = configuration() local c = configuration()
local LLVMBuildDir = get_llvm_build_dir()
libdirs { path.join(LLVMBuildDir, "lib") }
configuration { "Debug", "vs*" }
libdirs { path.join(LLVMBuildDir, "Debug/lib") }
configuration { "Release", "vs*" }
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
configuration "not vs*" configuration "not vs*"
defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" } defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" }
configuration "macosx" configuration "macosx"
links { "c++", "curses", "pthread", "z" } links { "c++", "curses", "pthread", "z" }
configuration {}
if LLVMDirPerConfiguration then
configuration { "Debug" }
libdirs { path.join(LLVMRootDirDebug, "build/lib") }
configuration { "Release" }
libdirs { path.join(LLVMRootDirRelease, "build/lib") }
else
local LLVMBuildDir = get_llvm_build_dir()
libdirs { path.join(LLVMBuildDir, "lib") }
configuration { "Debug", "vs*" }
libdirs { path.join(LLVMBuildDir, "Debug/lib") }
configuration { "Release", "vs*" }
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
end
configuration "*" configuration "*"
links links
{ {

9
build/scripts/LLVM.lua

@ -10,8 +10,6 @@ if is_vagrant() then
llvm = os.getenv("HOME") .. "/llvm" llvm = os.getenv("HOME") .. "/llvm"
end end
local llvm_build = llvm .. "/" .. os.get()
function get_llvm_rev() function get_llvm_rev()
return cat(basedir .. "/LLVM-commit") return cat(basedir .. "/LLVM-commit")
end end
@ -62,7 +60,10 @@ function get_llvm_package_name(rev, conf)
return table.concat({"llvm", rev, os.get(), conf}, "-") return table.concat({"llvm", rev, os.get(), conf}, "-")
end end
function get_llvm_configuration_name() function get_llvm_configuration_name(debug)
if debug == true then
return "Debug"
end
return os.is("windows") and "RelWithDebInfo" or "Release" return os.is("windows") and "RelWithDebInfo" or "Release"
end end
@ -273,6 +274,7 @@ if _ACTION == "clone_llvm" then
end end
if _ACTION == "build_llvm" then if _ACTION == "build_llvm" then
local llvm_build = path.join(llvm, get_llvm_package_name())
clean_llvm(llvm_build) clean_llvm(llvm_build)
build_llvm(llvm_build) build_llvm(llvm_build)
os.exit() os.exit()
@ -280,6 +282,7 @@ end
if _ACTION == "package_llvm" then if _ACTION == "package_llvm" then
local conf = get_llvm_configuration_name() local conf = get_llvm_configuration_name()
local llvm_build = path.join(llvm, get_llvm_package_name())
local pkg = package_llvm(conf, llvm, llvm_build) local pkg = package_llvm(conf, llvm, llvm_build)
archive_llvm(pkg) archive_llvm(pkg)
os.exit() os.exit()

Loading…
Cancel
Save