Load dependencies

This commit is contained in:
momo5502 2018-12-26 13:16:21 +01:00
parent c2c3cfd50f
commit 1ed00dcaf9
5 changed files with 228 additions and 0 deletions

39
deps/premake/libHDiffPatch.lua vendored Normal file
View File

@ -0,0 +1,39 @@
libHDiffPatch = {
source = path.join(dependencies.basePath, "HDiffPatch/libHDiffPatch"),
}
function libHDiffPatch.import()
links {
"libHDiffPatch"
}
libHDiffPatch.includes()
end
function libHDiffPatch.includes()
includedirs {
path.join(libHDiffPatch.source, "HDiff"),
path.join(libHDiffPatch.source, "HDiff"),
}
end
function libHDiffPatch.project()
project "libHDiffPatch"
language "C"
libHDiffPatch.includes()
files {
path.join(libHDiffPatch.source, "HDiff/**.h"),
path.join(libHDiffPatch.source, "HDiff/**.c"),
path.join(libHDiffPatch.source, "HDiff/**.cpp"),
path.join(libHDiffPatch.source, "HPatch/**.h"),
path.join(libHDiffPatch.source, "HPatch/**.c"),
}
warnings "Off"
kind "StaticLib"
end
table.insert(dependencies, libHDiffPatch)

61
deps/premake/libtomcrypt.lua vendored Normal file
View File

@ -0,0 +1,61 @@
libtomcrypt = {
source = path.join(dependencies.basePath, "libtomcrypt"),
}
function libtomcrypt.import()
links {
"libtomcrypt"
}
libtomcrypt.includes()
end
function libtomcrypt.includes()
includedirs {
path.join(libtomcrypt.source, "src/headers")
}
defines {
"LTC_NO_FAST",
"LTC_NO_PROTOTYPES",
"LTC_NO_RSA_BLINDING",
}
end
function libtomcrypt.project()
project "libtomcrypt"
language "C"
libtomcrypt.includes()
libtommath.import()
files {
path.join(libtomcrypt.source, "src/**.c"),
}
removefiles {
path.join(libtomcrypt.source, "src/**/*tab.c"),
path.join(libtomcrypt.source, "src/encauth/ocb3/**.c"),
}
defines {
"_CRT_SECURE_NO_WARNINGS",
"LTC_SOURCE",
"_LIB",
"USE_LTM"
}
removedefines {
"_DLL",
"_USRDLL"
}
linkoptions {
"-IGNORE:4221"
}
warnings "Off"
kind "StaticLib"
end
table.insert(dependencies, libtomcrypt)

51
deps/premake/libtommath.lua vendored Normal file
View File

@ -0,0 +1,51 @@
libtommath = {
source = path.join(dependencies.basePath, "libtommath"),
}
function libtommath.import()
links {
"libtommath"
}
libtommath.includes()
end
function libtommath.includes()
includedirs {
libtommath.source
}
defines {
"LTM_DESC",
"__STDC_IEC_559__",
}
end
function libtommath.project()
project "libtommath"
language "C"
libtommath.includes()
files {
path.join(libtommath.source, "*.c"),
}
defines {
"_LIB"
}
removedefines {
"_DLL",
"_USRDLL"
}
linkoptions {
"-IGNORE:4221"
}
warnings "Off"
kind "StaticLib"
end
table.insert(dependencies, libtommath)

40
deps/premake/zlib.lua vendored Normal file
View File

@ -0,0 +1,40 @@
zlib = {
source = path.join(dependencies.basePath, "zlib"),
}
function zlib.import()
links { "zlib" }
zlib.includes()
end
function zlib.includes()
includedirs {
zlib.source
}
defines {
"ZLIB_CONST",
}
end
function zlib.project()
project "zlib"
language "C"
zlib.includes()
files {
path.join(zlib.source, "*.h"),
path.join(zlib.source, "*.c"),
}
defines {
"ZLIB_DLL",
"_CRT_SECURE_NO_DEPRECATE",
}
warnings "Off"
kind "StaticLib"
end
table.insert(dependencies, zlib)

View File

@ -1,9 +1,41 @@
dependencies = {
basePath = "./deps"
}
function dependencies.load()
dir = path.join(dependencies.basePath, "premake/*.lua")
deps = os.matchfiles(dir)
for i, dep in pairs(deps) do
dep = dep:gsub(".lua", "")
require(dep)
end
end
function dependencies.imports()
for i, proj in pairs(dependencies) do
if type(i) == 'number' then
proj.import()
end
end
end
function dependencies.projects()
for i, proj in pairs(dependencies) do
if type(i) == 'number' then
proj.project()
end
end
end
newoption { newoption {
trigger = "copy-to", trigger = "copy-to",
description = "Optional, copy the EXE to a custom folder after build, define the path here if wanted.", description = "Optional, copy the EXE to a custom folder after build, define the path here if wanted.",
value = "PATH" value = "PATH"
} }
dependencies.load()
workspace "open-iw5" workspace "open-iw5"
location "./build" location "./build"
objdir "%{wks.location}/obj" objdir "%{wks.location}/obj"
@ -88,3 +120,8 @@ workspace "open-iw5"
"copy /y \"$(TargetDir)*.exe\" \"" .. _OPTIONS["copy-to"] .. "\"" "copy /y \"$(TargetDir)*.exe\" \"" .. _OPTIONS["copy-to"] .. "\""
} }
end end
dependencies.imports()
group "Dependencies"
dependencies.projects()