mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Premake: Add include guard to make sure dependencies do not include themselves in an infinite chain when two components depend on each other
This commit is contained in:
parent
55d5746650
commit
f73c27a7dc
31
premake5.lua
31
premake5.lua
@ -19,6 +19,37 @@ function TestFolder()
|
||||
return path.getrelative(os.getcwd(), _TestFolder)
|
||||
end
|
||||
|
||||
-- Functions for including projects
|
||||
References = {
|
||||
includeList = {},
|
||||
linkList = {}
|
||||
}
|
||||
|
||||
function References:include(name)
|
||||
result = self.includeList[name] == nil
|
||||
|
||||
if result then
|
||||
self.includeList[name] = true
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function References:link(name)
|
||||
result = self.linkList[name] == nil
|
||||
|
||||
if result then
|
||||
self.linkList[name] = true
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function References:reset()
|
||||
self.includeList = {}
|
||||
self.linkList = {}
|
||||
end
|
||||
|
||||
-- Target Directories
|
||||
TargetDirectoryBin = "%{wks.location}/bin/%{cfg.buildcfg}_%{cfg.platform}"
|
||||
TargetDirectoryLib = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}"
|
||||
|
@ -1,16 +1,20 @@
|
||||
Crypto = {}
|
||||
|
||||
function Crypto:include()
|
||||
if References:include("Crypto") then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Crypto")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Crypto:link()
|
||||
if References:link("Crypto") then
|
||||
libtomcrypt:link()
|
||||
libtommath:link()
|
||||
salsa20:link()
|
||||
links "Crypto"
|
||||
end
|
||||
end
|
||||
|
||||
function Crypto:use()
|
||||
@ -18,6 +22,7 @@ function Crypto:use()
|
||||
end
|
||||
|
||||
function Crypto:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "Crypto"
|
||||
|
@ -1,9 +1,11 @@
|
||||
Linker = {}
|
||||
|
||||
function Linker:include()
|
||||
if References:include("Linker") then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Linker")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Linker:link()
|
||||
@ -15,6 +17,7 @@ function Linker:use()
|
||||
end
|
||||
|
||||
function Linker:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "Linker"
|
||||
|
@ -1,20 +1,24 @@
|
||||
ObjCommon = {}
|
||||
|
||||
function ObjCommon:include()
|
||||
if References:include("ObjCommon") then
|
||||
ZoneCommon:include()
|
||||
minizip:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjCommon")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjCommon:link()
|
||||
if References:link("ObjCommon") then
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
minizip:link()
|
||||
links {
|
||||
"ObjCommon"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjCommon:use()
|
||||
@ -22,6 +26,7 @@ function ObjCommon:use()
|
||||
end
|
||||
|
||||
function ObjCommon:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ObjCommon"
|
||||
|
@ -1,14 +1,17 @@
|
||||
ObjLoading = {}
|
||||
|
||||
function ObjLoading:include()
|
||||
if References:include("ObjLoading") then
|
||||
ObjCommon:include()
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjLoading")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjLoading:link()
|
||||
if References:link("ObjLoading") then
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
ZoneCommon:link()
|
||||
@ -18,6 +21,7 @@ function ObjLoading:link()
|
||||
links {
|
||||
"ObjLoading"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjLoading:use()
|
||||
@ -25,6 +29,7 @@ function ObjLoading:use()
|
||||
end
|
||||
|
||||
function ObjLoading:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ObjLoading"
|
||||
|
@ -1,14 +1,17 @@
|
||||
ObjWriting = {}
|
||||
|
||||
function ObjWriting:include()
|
||||
if References:include("ObjWriting") then
|
||||
ObjCommon:include()
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjWriting")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjWriting:link()
|
||||
if References:link("ObjWriting") then
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
ZoneCommon:link()
|
||||
@ -17,6 +20,7 @@ function ObjWriting:link()
|
||||
links {
|
||||
"ObjWriting"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjWriting:use()
|
||||
@ -24,6 +28,7 @@ function ObjWriting:use()
|
||||
end
|
||||
|
||||
function ObjWriting:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ObjWriting"
|
||||
|
@ -1,9 +1,11 @@
|
||||
Unlinker = {}
|
||||
|
||||
function Unlinker:include()
|
||||
if References:include("Unlinker") then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Unlinker")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Unlinker:link()
|
||||
@ -15,6 +17,7 @@ function Unlinker:use()
|
||||
end
|
||||
|
||||
function Unlinker:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "Unlinker"
|
||||
|
@ -1,13 +1,17 @@
|
||||
Utils = {}
|
||||
|
||||
function Utils:include()
|
||||
if References:include("Utils") then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Utils")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Utils:link()
|
||||
if References:link("Utils") then
|
||||
links "Utils"
|
||||
end
|
||||
end
|
||||
|
||||
function Utils:use()
|
||||
@ -15,6 +19,7 @@ function Utils:use()
|
||||
end
|
||||
|
||||
function Utils:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "Utils"
|
||||
|
@ -108,10 +108,12 @@ function ZoneCode:allWriteFiles()
|
||||
end
|
||||
|
||||
function ZoneCode:include()
|
||||
if References:include("ZoneCode") then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCode"),
|
||||
"%{wks.location}/src/ZoneCode"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCode:link()
|
||||
@ -123,6 +125,7 @@ function ZoneCode:use()
|
||||
end
|
||||
|
||||
function ZoneCode:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ZoneCode"
|
||||
|
@ -5,7 +5,9 @@ function ZoneCodeGenerator:include()
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:link()
|
||||
if References:link("ZoneCodeGenerator") then
|
||||
links "ZoneCodeGenerator"
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:use()
|
||||
@ -13,6 +15,7 @@ function ZoneCodeGenerator:use()
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ZoneCodeGenerator"
|
||||
|
@ -1,17 +1,23 @@
|
||||
ZoneCommon = {}
|
||||
|
||||
function ZoneCommon:include()
|
||||
if References:include("ZoneCommon") then
|
||||
Utils:include()
|
||||
ObjCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCommon")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommon:link()
|
||||
if References:link("ZoneCommon") then
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
links {
|
||||
"ZoneCommon"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommon:use()
|
||||
@ -19,6 +25,7 @@ function ZoneCommon:use()
|
||||
end
|
||||
|
||||
function ZoneCommon:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ZoneCommon"
|
||||
|
@ -1,13 +1,16 @@
|
||||
ZoneLoading = {}
|
||||
|
||||
function ZoneLoading:include()
|
||||
if References:include("ZoneLoading") then
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneLoading")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneLoading:link()
|
||||
if References:link("ZoneLoading") then
|
||||
Crypto:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
@ -15,6 +18,7 @@ function ZoneLoading:link()
|
||||
links {
|
||||
"ZoneLoading"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneLoading:use()
|
||||
@ -22,6 +26,7 @@ function ZoneLoading:use()
|
||||
end
|
||||
|
||||
function ZoneLoading:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ZoneLoading"
|
||||
|
@ -1,13 +1,16 @@
|
||||
ZoneWriting = {}
|
||||
|
||||
function ZoneWriting:include()
|
||||
if References:include("ZoneWriting") then
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneWriting")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneWriting:link()
|
||||
if References:link("ZoneWriting") then
|
||||
Crypto:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
@ -15,6 +18,7 @@ function ZoneWriting:link()
|
||||
links {
|
||||
"ZoneWriting"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneWriting:use()
|
||||
@ -22,6 +26,7 @@ function ZoneWriting:use()
|
||||
end
|
||||
|
||||
function ZoneWriting:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ZoneWriting"
|
||||
|
@ -5,7 +5,9 @@ function ZoneCodeGeneratorTests:include()
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorTests:link()
|
||||
links "ZoneCommonTests"
|
||||
if References:link("ZoneCodeGeneratorTests") then
|
||||
links "ZoneCodeGeneratorTests"
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorTests:use()
|
||||
@ -13,6 +15,7 @@ function ZoneCodeGeneratorTests:use()
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorTests:project()
|
||||
References:reset()
|
||||
local folder = TestFolder();
|
||||
|
||||
project "ZoneCodeGeneratorTests"
|
||||
|
@ -5,7 +5,9 @@ function ZoneCommonTests:include()
|
||||
end
|
||||
|
||||
function ZoneCommonTests:link()
|
||||
if References:link("ZoneCommonTests") then
|
||||
links "ZoneCommonTests"
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommonTests:use()
|
||||
@ -13,6 +15,7 @@ function ZoneCommonTests:use()
|
||||
end
|
||||
|
||||
function ZoneCommonTests:project()
|
||||
References:reset()
|
||||
local folder = TestFolder();
|
||||
|
||||
project "ZoneCommonTests"
|
||||
|
5
thirdparty/libtomcrypt.lua
vendored
5
thirdparty/libtomcrypt.lua
vendored
@ -1,6 +1,7 @@
|
||||
libtomcrypt = {}
|
||||
|
||||
function libtomcrypt:include()
|
||||
if References:include("libtomcrypt") then
|
||||
defines{
|
||||
"LTM_DESC"
|
||||
}
|
||||
@ -8,10 +9,13 @@ function libtomcrypt:include()
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "libtomcrypt/src/headers")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function libtomcrypt:link()
|
||||
if References:link("libtomcrypt") then
|
||||
links "libtomcrypt"
|
||||
end
|
||||
end
|
||||
|
||||
function libtomcrypt:use()
|
||||
@ -19,6 +23,7 @@ function libtomcrypt:use()
|
||||
end
|
||||
|
||||
function libtomcrypt:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "libtomcrypt"
|
||||
|
5
thirdparty/libtommath.lua
vendored
5
thirdparty/libtommath.lua
vendored
@ -1,13 +1,17 @@
|
||||
libtommath = {}
|
||||
|
||||
function libtommath:include()
|
||||
if References:include("libtommath") then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "libtommath")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function libtommath:link()
|
||||
if References:link("libtommath") then
|
||||
links "libtommath"
|
||||
end
|
||||
end
|
||||
|
||||
function libtommath:use()
|
||||
@ -15,6 +19,7 @@ function libtommath:use()
|
||||
end
|
||||
|
||||
function libtommath:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "libtommath"
|
||||
|
5
thirdparty/minilzo.lua
vendored
5
thirdparty/minilzo.lua
vendored
@ -1,13 +1,17 @@
|
||||
minilzo = {}
|
||||
|
||||
function minilzo:include()
|
||||
if References:include("minilzo") then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "minilzo")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function minilzo:link()
|
||||
if References:link("minilzo") then
|
||||
links "minilzo"
|
||||
end
|
||||
end
|
||||
|
||||
function minilzo:use()
|
||||
@ -15,6 +19,7 @@ function minilzo:use()
|
||||
end
|
||||
|
||||
function minilzo:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "minilzo"
|
||||
|
5
thirdparty/minizip.lua
vendored
5
thirdparty/minizip.lua
vendored
@ -1,15 +1,19 @@
|
||||
minizip = {}
|
||||
|
||||
function minizip:include()
|
||||
if References:include("minizip") then
|
||||
zlib:include()
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "zlib/contrib/minizip")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function minizip:link()
|
||||
if References:link("minizip") then
|
||||
zlib:link()
|
||||
links "minizip"
|
||||
end
|
||||
end
|
||||
|
||||
function minizip:use()
|
||||
@ -17,6 +21,7 @@ function minizip:use()
|
||||
end
|
||||
|
||||
function minizip:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "minizip"
|
||||
|
5
thirdparty/salsa20.lua
vendored
5
thirdparty/salsa20.lua
vendored
@ -1,13 +1,17 @@
|
||||
salsa20 = {}
|
||||
|
||||
function salsa20:include()
|
||||
if References:include("salsa20") then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "salsa20")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function salsa20:link()
|
||||
if References:link("salsa20") then
|
||||
links "salsa20"
|
||||
end
|
||||
end
|
||||
|
||||
function salsa20:use()
|
||||
@ -15,6 +19,7 @@ function salsa20:use()
|
||||
end
|
||||
|
||||
function salsa20:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "salsa20"
|
||||
|
6
thirdparty/zlib.lua
vendored
6
thirdparty/zlib.lua
vendored
@ -1,7 +1,7 @@
|
||||
zlib = {}
|
||||
|
||||
function zlib:include()
|
||||
|
||||
if References:include("zlib") then
|
||||
defines {
|
||||
"ZLIB_CONST"
|
||||
}
|
||||
@ -9,10 +9,13 @@ function zlib:include()
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "zlib")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function zlib:link()
|
||||
if References:link("zlib") then
|
||||
links "zlib"
|
||||
end
|
||||
end
|
||||
|
||||
function zlib:use()
|
||||
@ -20,6 +23,7 @@ function zlib:use()
|
||||
end
|
||||
|
||||
function zlib:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
|
||||
project "zlib"
|
||||
|
Loading…
x
Reference in New Issue
Block a user