Browse Source

Update Premake build files to latest syntax.

pull/838/merge
Joao Matos 8 years ago
parent
commit
b52ad8b43f
  1. 43
      build/Helpers.lua
  2. 34
      build/LLVM.lua
  3. 4
      build/Tests.lua
  4. 4
      build/premake5.lua
  5. 8
      build/scripts/LLVM.lua
  6. 2
      build/scripts/Utils.lua
  7. 6
      src/CppParser/Bindings/CLI/premake5.lua
  8. 20
      src/CppParser/Bindings/CSharp/premake5.lua
  9. 11
      src/CppParser/premake5.lua
  10. 4
      src/Runtime/premake5.lua

43
build/Helpers.lua

@ -22,7 +22,7 @@ function target_architecture() @@ -22,7 +22,7 @@ function target_architecture()
if explicit_target_architecture ~= nil then
return explicit_target_architecture
end
if os.is("windows") then return "x86" end
if os.istarget("windows") then return "x86" end
return is_64_bits_mono_runtime() and "x64" or "x86"
end
@ -64,20 +64,20 @@ end @@ -64,20 +64,20 @@ end
function SetupNativeProject()
location ("%{wks.location}/projects")
local c = configuration "Debug"
filter { "configurations:Debug" }
defines { "DEBUG" }
configuration "Release"
filter { "configurations:Release" }
defines { "NDEBUG" }
optimize "On"
-- Compiler-specific options
configuration "vs*"
filter { "action:vs*" }
buildoptions { msvc_buildflags }
defines { msvc_cpp_defines }
configuration { "gmake" }
filter { "action:gmake" }
buildoptions { gcc_buildflags }
filter { "system:macosx", "language:C++" }
@ -89,41 +89,37 @@ function SetupNativeProject() @@ -89,41 +89,37 @@ function SetupNativeProject()
-- OS-specific options
configuration "Windows"
filter { "system:windows" }
defines { "WIN32", "_WINDOWS" }
configuration(c)
filter {}
end
function SetupManagedProject()
language "C#"
location ("%{wks.location}/projects")
if not os.is("macosx") then
local c = configuration { "vs*" }
if not os.istarget("macosx") then
filter { "action:vs*" }
location "."
configuration(c)
filter {}
end
if action == "vs2017" then
filter { "action:vs2017" }
framework "4.6"
elseif action == "vs2015" then
filter { "action:vs2015" }
framework "4.6"
end
configuration "vs2017"
framework "4.6"
elseif action == "vs2015" then
configuration "vs2015"
framework "4.6"
end
configuration "vs2013"
filter { "action:vs2013" }
framework "4.5"
configuration "vs2012"
filter { "action:vs2012" }
framework "4.5"
configuration {}
filter {}
end
function IncludeDir(dir)
@ -149,7 +145,6 @@ function IncludeDir(dir) @@ -149,7 +145,6 @@ function IncludeDir(dir)
end
function StaticLinksOpt(libnames)
local cc = configuration()
local path = table.concat(cc.configset.libdirs, ";")
local formats

34
build/LLVM.lua

@ -29,10 +29,10 @@ function get_llvm_build_dir() @@ -29,10 +29,10 @@ function get_llvm_build_dir()
end
function SetupLLVMIncludes()
local c = configuration()
local c = filter()
if LLVMDirPerConfiguration then
configuration { "Debug" }
filter { "configurations:Debug" }
includedirs
{
path.join(LLVMRootDirDebug, "include"),
@ -42,7 +42,7 @@ function SetupLLVMIncludes() @@ -42,7 +42,7 @@ function SetupLLVMIncludes()
path.join(LLVMRootDirDebug, "build/tools/clang/include"),
}
configuration { "Release" }
filter { "configurations:Release" }
includedirs
{
path.join(LLVMRootDirRelease, "include"),
@ -63,7 +63,7 @@ function SetupLLVMIncludes() @@ -63,7 +63,7 @@ function SetupLLVMIncludes()
}
end
configuration(c)
filter(c)
end
function CopyClangIncludes()
@ -88,37 +88,38 @@ function CopyClangIncludes() @@ -88,37 +88,38 @@ function CopyClangIncludes()
end
function SetupLLVMLibs()
local c = configuration()
local c = filter()
configuration "not vs*"
filter { "action:not vs*" }
defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" }
configuration "macosx"
filter { "system:macosx" }
links { "c++", "curses", "pthread", "z" }
configuration "vs*"
filter { "action:vs*" }
links { "version" }
configuration {}
filter {}
if LLVMDirPerConfiguration then
configuration { "Debug" }
filter { "configurations:Debug" }
libdirs { path.join(LLVMRootDirDebug, "build/lib") }
configuration { "Release" }
filter { "configurations:Release" }
libdirs { path.join(LLVMRootDirRelease, "build/lib") }
else
local LLVMBuildDir = get_llvm_build_dir()
libdirs { path.join(LLVMBuildDir, "lib") }
configuration { "Debug", "vs*" }
filter { "configurations:Debug", "action:vs*" }
libdirs { path.join(LLVMBuildDir, "Debug/lib") }
configuration { "Release", "vs*" }
filter { "configurations:Release", "actoin:vs*" }
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
end
configuration "*"
filter {}
links
{
"clangFrontend",
@ -162,10 +163,9 @@ function SetupLLVMLibs() @@ -162,10 +163,9 @@ function SetupLLVMLibs()
"LLVMSupport",
}
if os.is("windows") then
configuration "*"
if os.istarget("windows") then
links { "LLVMBinaryFormat" }
end
configuration(c)
filter(c)
end

4
build/Tests.lua

@ -83,7 +83,7 @@ end @@ -83,7 +83,7 @@ end
function SetupTestGeneratorBuildEvent(name)
local monoExe = get_mono_exe()
local runtimeExe = os.is("windows") and "" or monoExe .. " --debug "
local runtimeExe = os.ishost("windows") and "" or monoExe .. " --debug "
if string.starts(action, "vs") then
local exePath = SafePath("$(TargetDir)" .. name .. ".Gen.exe")
prebuildcommands { runtimeExe .. exePath }
@ -163,7 +163,7 @@ function SetupTestProjectsCSharp(name, depends) @@ -163,7 +163,7 @@ function SetupTestProjectsCSharp(name, depends)
end
function SetupTestProjectsCLI(name, extraFiles)
if not os.is("windows") then
if not os.ishost("windows") then
return
end

4
build/premake5.lua

@ -20,10 +20,10 @@ solution "CppSharp" @@ -20,10 +20,10 @@ solution "CppSharp"
targetdir (libdir)
debugdir (bindir)
configuration "windows"
filter "system:windows"
defines { "WINDOWS" }
configuration {}
filter {}
group "Libraries"
include (srcdir .. "/Core")

8
build/scripts/LLVM.lua

@ -67,7 +67,7 @@ function get_toolset_configuration_name(arch) @@ -67,7 +67,7 @@ function get_toolset_configuration_name(arch)
arch = target_architecture()
end
if os.is("windows") then
if os.istarget("windows") then
local vsver = _ACTION
if not string.starts(vsver, "vs") then
@ -88,7 +88,7 @@ function get_llvm_package_name(rev, conf, arch) @@ -88,7 +88,7 @@ function get_llvm_package_name(rev, conf, arch)
end
rev = string.sub(rev, 0, 6)
local components = {"llvm", rev, os.get()}
local components = {"llvm", rev, os.target()}
local toolset = get_toolset_configuration_name(arch)
table.insert(components, toolset)
@ -106,7 +106,7 @@ function get_llvm_configuration_name(debug) @@ -106,7 +106,7 @@ function get_llvm_configuration_name(debug)
if debug == true then
return "Debug"
end
return os.is("windows") and "RelWithDebInfo" or "Release"
return os.istarget("windows") and "RelWithDebInfo" or "Release"
end
function get_7z_path()
@ -127,7 +127,7 @@ function extract_tar_xz(archive, dest_dir) @@ -127,7 +127,7 @@ function extract_tar_xz(archive, dest_dir)
return execute_or_die(string.format("tar xJf %s -C %s", archive, dest_dir), true)
end
local use_7zip = os.is("windows")
local use_7zip = os.ishost("windows")
local archive_ext = use_7zip and ".7z" or ".tar.xz"
function download_llvm()

2
build/scripts/Utils.lua

@ -48,7 +48,7 @@ end @@ -48,7 +48,7 @@ end
git = {}
-- Remove once https://github.com/premake/premake-core/pull/307 is merged.
local sep = os.is("windows") and "\\" or "/"
local sep = os.ishost("windows") and "\\" or "/"
function git.clone(dir, url, target)
local cmd = "git clone " .. url .. " " .. path.translate(dir, sep)

6
src/CppParser/Bindings/CLI/premake5.lua

@ -10,10 +10,10 @@ project "CppSharp.Parser.CLI" @@ -10,10 +10,10 @@ project "CppSharp.Parser.CLI"
dependson { "CppSharp.CppParser" }
flags { common_flags, "Managed" }
configuration "vs*"
filter "action:vs*"
buildoptions { clang_msvc_flags }
configuration "*"
filter {}
files
{
@ -28,7 +28,7 @@ project "CppSharp.Parser.CLI" @@ -28,7 +28,7 @@ project "CppSharp.Parser.CLI"
"../../../../src/CppParser/"
}
configuration "*"
filter {}
links { "CppSharp.CppParser" }

20
src/CppParser/Bindings/CSharp/premake5.lua

@ -13,9 +13,9 @@ project "CppSharp.Parser.CSharp" @@ -13,9 +13,9 @@ project "CppSharp.Parser.CSharp"
links { "CppSharp.Runtime" }
if os.is("windows") then
if os.istarget("windows") then
files { "i686-pc-win32-msvc/**.cs" }
elseif os.is("macosx") then
elseif os.istarget("macosx") then
local file = io.popen("lipo -info `which mono`")
local output = file:read('*all')
if string.find(output, "x86_64") or _OPTIONS["arch"] == "x64" then
@ -24,13 +24,13 @@ project "CppSharp.Parser.CSharp" @@ -24,13 +24,13 @@ project "CppSharp.Parser.CSharp"
files { "i686-apple-darwin12.4.0/**.cs" }
end
elseif os.is("linux") then
elseif os.istarget("linux") then
files { "x86_64-linux-gnu/**.cs" }
else
print "Unknown architecture"
end
configuration ""
filter {}
project "Std-symbols"
@ -39,14 +39,14 @@ project "Std-symbols" @@ -39,14 +39,14 @@ project "Std-symbols"
SetupNativeProject()
rtti "Off"
configuration "vs*"
filter { "action:vs*" }
buildoptions { clang_msvc_flags }
configuration "*"
filter {}
if os.is("windows") then
if os.istarget("windows") then
files { "i686-pc-win32-msvc/Std-symbols.cpp" }
elseif os.is("macosx") then
elseif os.istarget("macosx") then
local file = io.popen("lipo -info `which mono`")
local output = file:read('*all')
if string.find(output, "x86_64") then
@ -55,13 +55,13 @@ project "Std-symbols" @@ -55,13 +55,13 @@ project "Std-symbols"
files { "i686-apple-darwin12.4.0/Std-symbols.cpp" }
end
elseif os.is("linux") then
elseif os.istarget("linux") then
files { "x86_64-linux-gnu/Std-symbols.cpp" }
else
print "Unknown architecture"
end
configuration "*"
filter {}
function SetupParser()
links

11
src/CppParser/premake5.lua

@ -15,17 +15,17 @@ project "CppSharp.CppParser" @@ -15,17 +15,17 @@ project "CppSharp.CppParser"
SetupNativeProject()
rtti "Off"
configuration "vs*"
filter "action:vs*"
buildoptions { clang_msvc_flags }
if os.getenv("APPVEYOR") then
linkoptions { "/ignore:4099" } -- LNK4099: linking object as if no debug info
end
configuration "linux"
filter "system:linux"
defines { "_GLIBCXX_USE_CXX11_ABI=0" }
configuration "*"
filter {}
files
{
@ -33,12 +33,11 @@ project "CppSharp.CppParser" @@ -33,12 +33,11 @@ project "CppSharp.CppParser"
"*.cpp",
"*.lua"
}
SearchLLVM()
SetupLLVMIncludes()
SetupLLVMLibs()
CopyClangIncludes()
configuration "*"
filter {}
end

4
src/Runtime/premake5.lua

@ -10,8 +10,8 @@ project "CppSharp.Runtime" @@ -10,8 +10,8 @@ project "CppSharp.Runtime"
links { "System" }
configuration "vs*"
filter { "action:vs*" }
defines { "MSVC" }
configuration "macosx"
filter { "system:macosx" }
defines { "LIBCXX" }

Loading…
Cancel
Save