mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 07:42:54 +00:00
Rework depedency management in premake lua scripts
This commit is contained in:
parent
1a45cf2107
commit
dc3fef5b0f
70
premake5.lua
70
premake5.lua
@ -1,68 +1,8 @@
|
||||
-- Functions for locating commonly used folders
|
||||
local _BuildFolder = path.getabsolute("build")
|
||||
function BuildFolder()
|
||||
return path.getrelative(os.getcwd(), _BuildFolder)
|
||||
end
|
||||
|
||||
local _ThirdPartyFolder = path.getabsolute("thirdparty")
|
||||
function ThirdPartyFolder()
|
||||
return path.getrelative(os.getcwd(), _ThirdPartyFolder)
|
||||
end
|
||||
|
||||
local _ProjectFolder = path.getabsolute("src")
|
||||
function ProjectFolder()
|
||||
return path.getrelative(os.getcwd(), _ProjectFolder)
|
||||
end
|
||||
|
||||
local _TestFolder = path.getabsolute("test")
|
||||
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}"
|
||||
TargetDirectoryTest = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}/tests"
|
||||
|
||||
-- Platform functions
|
||||
function ExecutableByOs(name)
|
||||
if os.host() == "windows" then
|
||||
return name .. ".exe"
|
||||
else
|
||||
return name
|
||||
end
|
||||
end
|
||||
include "tools/scripts/folders.lua"
|
||||
include "tools/scripts/including.lua"
|
||||
include "tools/scripts/linking.lua"
|
||||
include "tools/scripts/options.lua"
|
||||
include "tools/scripts/platform.lua"
|
||||
|
||||
-- ==================
|
||||
-- Workspace
|
||||
|
@ -1,31 +1,33 @@
|
||||
Crypto = {}
|
||||
|
||||
function Crypto:include()
|
||||
if References:include("Crypto") then
|
||||
function Crypto:include(includes)
|
||||
if includes:handle(self:name()) 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
|
||||
function Crypto:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(libtomcrypt)
|
||||
links:linkto(libtommath)
|
||||
links:linkto(salsa20)
|
||||
end
|
||||
|
||||
function Crypto:use()
|
||||
|
||||
end
|
||||
|
||||
function Crypto:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function Crypto:name()
|
||||
return "Crypto"
|
||||
end
|
||||
|
||||
project "Crypto"
|
||||
function Crypto:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -36,8 +38,8 @@ function Crypto:project()
|
||||
path.join(folder, "Crypto/**.cpp")
|
||||
}
|
||||
|
||||
self:include()
|
||||
libtomcrypt:include()
|
||||
libtommath:include()
|
||||
salsa20:include()
|
||||
self:include(includes)
|
||||
libtomcrypt:include(includes)
|
||||
libtommath:include(includes)
|
||||
salsa20:include(includes)
|
||||
end
|
||||
|
@ -1,26 +1,31 @@
|
||||
Linker = {}
|
||||
|
||||
function Linker:include()
|
||||
if References:include("Linker") then
|
||||
function Linker:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Linker")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Linker:link()
|
||||
function Linker:link(links)
|
||||
|
||||
end
|
||||
|
||||
function Linker:use()
|
||||
dependson "Linker"
|
||||
dependson(self:name())
|
||||
end
|
||||
|
||||
function Linker:name()
|
||||
return "Linker"
|
||||
end
|
||||
|
||||
function Linker:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project "Linker"
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryBin)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "ConsoleApp"
|
||||
@ -31,10 +36,12 @@ function Linker:project()
|
||||
path.join(folder, "Linker/**.cpp")
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
ZoneWriting:include()
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
ZoneWriting:include(includes)
|
||||
|
||||
Utils:link()
|
||||
--ZoneWriting:link()
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneWriting)
|
||||
--ZoneWriting:link(links)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,35 +1,35 @@
|
||||
ObjCommon = {}
|
||||
|
||||
function ObjCommon:include()
|
||||
if References:include("ObjCommon") then
|
||||
ZoneCommon:include()
|
||||
minizip:include()
|
||||
function ObjCommon:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ZoneCommon:include(includes)
|
||||
minizip:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjCommon")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjCommon:link()
|
||||
if References:link("ObjCommon") then
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
minizip:link()
|
||||
links {
|
||||
"ObjCommon"
|
||||
}
|
||||
end
|
||||
function ObjCommon:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(minizip)
|
||||
end
|
||||
|
||||
function ObjCommon:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjCommon:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function ObjCommon:name()
|
||||
return "ObjCommon"
|
||||
end
|
||||
|
||||
project "ObjCommon"
|
||||
function ObjCommon:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -46,6 +46,6 @@ function ObjCommon:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
end
|
||||
|
@ -1,38 +1,38 @@
|
||||
ObjLoading = {}
|
||||
|
||||
function ObjLoading:include()
|
||||
if References:include("ObjLoading") then
|
||||
ObjCommon:include()
|
||||
ZoneCommon:include()
|
||||
function ObjLoading:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ObjCommon:include(includes)
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjLoading")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjLoading:link()
|
||||
if References:link("ObjLoading") then
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
ZoneCommon:link()
|
||||
minilzo:link()
|
||||
minizip:link()
|
||||
zlib:link()
|
||||
links {
|
||||
"ObjLoading"
|
||||
}
|
||||
end
|
||||
function ObjLoading:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjCommon)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(minilzo)
|
||||
links:linkto(minizip)
|
||||
links:linkto(zlib)
|
||||
end
|
||||
|
||||
function ObjLoading:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjLoading:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function ObjLoading:name()
|
||||
return "ObjLoading"
|
||||
end
|
||||
|
||||
project "ObjLoading"
|
||||
function ObjLoading:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -49,10 +49,10 @@ function ObjLoading:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Crypto:include()
|
||||
Utils:include()
|
||||
minilzo:include()
|
||||
minizip:include()
|
||||
zlib:include()
|
||||
self:include(includes)
|
||||
Crypto:include(includes)
|
||||
Utils:include(includes)
|
||||
minilzo:include(includes)
|
||||
minizip:include(includes)
|
||||
zlib:include(includes)
|
||||
end
|
||||
|
@ -1,37 +1,37 @@
|
||||
ObjWriting = {}
|
||||
|
||||
function ObjWriting:include()
|
||||
if References:include("ObjWriting") then
|
||||
ObjCommon:include()
|
||||
ZoneCommon:include()
|
||||
function ObjWriting:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ObjCommon:include(includes)
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjWriting")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjWriting:link()
|
||||
if References:link("ObjWriting") then
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
ZoneCommon:link()
|
||||
minilzo:link()
|
||||
minizip:link()
|
||||
links {
|
||||
"ObjWriting"
|
||||
}
|
||||
end
|
||||
function ObjWriting:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjCommon)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(minilzo)
|
||||
links:linkto(minizip)
|
||||
end
|
||||
|
||||
function ObjWriting:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjWriting:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function ObjWriting:name()
|
||||
return "ObjWriting"
|
||||
end
|
||||
|
||||
project "ObjWriting"
|
||||
function ObjWriting:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -48,8 +48,8 @@ function ObjWriting:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
minilzo:include()
|
||||
minizip:include()
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
minilzo:include(includes)
|
||||
minizip:include(includes)
|
||||
end
|
||||
|
@ -1,26 +1,31 @@
|
||||
Unlinker = {}
|
||||
|
||||
function Unlinker:include()
|
||||
if References:include("Unlinker") then
|
||||
function Unlinker:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Unlinker")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Unlinker:link()
|
||||
function Unlinker:link(links)
|
||||
|
||||
end
|
||||
|
||||
function Unlinker:use()
|
||||
dependson "Unlinker"
|
||||
dependson(self:name())
|
||||
end
|
||||
|
||||
function Unlinker:name()
|
||||
return "Unlinker"
|
||||
end
|
||||
|
||||
function Unlinker:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project "Unlinker"
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryBin)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "ConsoleApp"
|
||||
@ -31,14 +36,15 @@ function Unlinker:project()
|
||||
path.join(folder, "Unlinker/**.cpp")
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
ZoneLoading:include()
|
||||
ObjLoading:include()
|
||||
ObjWriting:include()
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
ZoneLoading:include(includes)
|
||||
ObjLoading:include(includes)
|
||||
ObjWriting:include(includes)
|
||||
|
||||
Utils:link()
|
||||
ZoneLoading:link()
|
||||
ObjLoading:link()
|
||||
ObjWriting:link()
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneLoading)
|
||||
links:linkto(ObjLoading)
|
||||
links:linkto(ObjWriting)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,17 +1,15 @@
|
||||
Utils = {}
|
||||
|
||||
function Utils:include()
|
||||
if References:include(self:name()) then
|
||||
function Utils:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Utils")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Utils:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
end
|
||||
function Utils:link(links)
|
||||
links:add(self:name())
|
||||
end
|
||||
|
||||
function Utils:use()
|
||||
@ -23,8 +21,8 @@ function Utils:name()
|
||||
end
|
||||
|
||||
function Utils:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
@ -43,5 +41,5 @@ function Utils:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
end
|
||||
|
@ -145,8 +145,8 @@ function ZoneCode:allWriteFiles()
|
||||
return result
|
||||
end
|
||||
|
||||
function ZoneCode:include()
|
||||
if References:include("ZoneCode") then
|
||||
function ZoneCode:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCode"),
|
||||
"%{wks.location}/src/ZoneCode"
|
||||
@ -154,19 +154,22 @@ function ZoneCode:include()
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCode:link()
|
||||
function ZoneCode:link(links)
|
||||
|
||||
end
|
||||
|
||||
function ZoneCode:use()
|
||||
dependson "ZoneCode"
|
||||
dependson(self:name())
|
||||
end
|
||||
|
||||
function ZoneCode:name()
|
||||
return "ZoneCode"
|
||||
end
|
||||
|
||||
function ZoneCode:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
|
||||
project "ZoneCode"
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "Utility"
|
||||
|
@ -1,18 +1,16 @@
|
||||
ZoneCodeGenerator = {}
|
||||
|
||||
function ZoneCodeGenerator:include()
|
||||
if References:include(self:name()) then
|
||||
function ZoneCodeGenerator:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCodeGenerator")
|
||||
}
|
||||
Utils:include(includes)
|
||||
end
|
||||
Utils:include()
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
end
|
||||
function ZoneCodeGenerator:link(links)
|
||||
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:use()
|
||||
@ -24,8 +22,9 @@ function ZoneCodeGenerator:name()
|
||||
end
|
||||
|
||||
function ZoneCodeGenerator:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryBin)
|
||||
@ -43,9 +42,10 @@ function ZoneCodeGenerator:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
ZoneCodeGeneratorLib:include()
|
||||
self:include(includes)
|
||||
ZoneCodeGeneratorLib:include(includes)
|
||||
|
||||
ZoneCodeGeneratorLib:link()
|
||||
Utils:link()
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCodeGeneratorLib)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,19 +1,17 @@
|
||||
ZoneCodeGeneratorLib = {}
|
||||
|
||||
function ZoneCodeGeneratorLib:include()
|
||||
if References:include(self:name()) then
|
||||
function ZoneCodeGeneratorLib:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCodeGeneratorLib")
|
||||
}
|
||||
Utils:include(includes)
|
||||
end
|
||||
Utils:include()
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLib:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
Utils:link()
|
||||
end
|
||||
function ZoneCodeGeneratorLib:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLib:use()
|
||||
@ -25,8 +23,8 @@ function ZoneCodeGeneratorLib:name()
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLib:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
@ -39,7 +37,5 @@ function ZoneCodeGeneratorLib:project()
|
||||
path.join(folder, "ZoneCodeGeneratorLib/**.cpp")
|
||||
}
|
||||
|
||||
self:include()
|
||||
|
||||
Utils:link()
|
||||
self:include(includes)
|
||||
end
|
||||
|
@ -1,21 +1,19 @@
|
||||
ZoneCommon = {}
|
||||
|
||||
function ZoneCommon:include()
|
||||
if References:include(self:name()) then
|
||||
Utils:include()
|
||||
ObjCommon:include()
|
||||
function ZoneCommon:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
Utils:include(includes)
|
||||
ObjCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCommon")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommon:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
Utils:link()
|
||||
ObjCommon:link()
|
||||
end
|
||||
function ZoneCommon:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjCommon)
|
||||
end
|
||||
|
||||
function ZoneCommon:use()
|
||||
@ -27,8 +25,8 @@ function ZoneCommon:name()
|
||||
end
|
||||
|
||||
function ZoneCommon:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
@ -41,7 +39,5 @@ function ZoneCommon:project()
|
||||
path.join(folder, "ZoneCommon/**.cpp")
|
||||
}
|
||||
|
||||
self:include()
|
||||
|
||||
Utils:link()
|
||||
self:include(includes)
|
||||
end
|
||||
|
@ -1,35 +1,35 @@
|
||||
ZoneLoading = {}
|
||||
|
||||
function ZoneLoading:include()
|
||||
if References:include("ZoneLoading") then
|
||||
ZoneCommon:include()
|
||||
function ZoneLoading:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneLoading")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneLoading:link()
|
||||
if References:link("ZoneLoading") then
|
||||
Crypto:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
zlib:link()
|
||||
links {
|
||||
"ZoneLoading"
|
||||
}
|
||||
end
|
||||
function ZoneLoading:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Crypto)
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(zlib)
|
||||
end
|
||||
|
||||
function ZoneLoading:use()
|
||||
|
||||
end
|
||||
|
||||
function ZoneLoading:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function ZoneLoading:name()
|
||||
return "ZoneLoading"
|
||||
end
|
||||
|
||||
project "ZoneLoading"
|
||||
function ZoneLoading:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -48,11 +48,11 @@ function ZoneLoading:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Crypto:include()
|
||||
Utils:include()
|
||||
zlib:include()
|
||||
ZoneCode:include()
|
||||
self:include(includes)
|
||||
Crypto:include(includes)
|
||||
Utils:include(includes)
|
||||
zlib:include(includes)
|
||||
ZoneCode:include(includes)
|
||||
|
||||
ZoneCode:use()
|
||||
end
|
||||
|
@ -1,35 +1,35 @@
|
||||
ZoneWriting = {}
|
||||
|
||||
function ZoneWriting:include()
|
||||
if References:include("ZoneWriting") then
|
||||
ZoneCommon:include()
|
||||
function ZoneWriting:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneWriting")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneWriting:link()
|
||||
if References:link("ZoneWriting") then
|
||||
Crypto:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
zlib:link()
|
||||
links {
|
||||
"ZoneWriting"
|
||||
}
|
||||
end
|
||||
function ZoneWriting:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Crypto)
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(zlib)
|
||||
end
|
||||
|
||||
function ZoneWriting:use()
|
||||
|
||||
end
|
||||
|
||||
function ZoneWriting:project()
|
||||
References:reset()
|
||||
local folder = ProjectFolder();
|
||||
function ZoneWriting:name()
|
||||
return "ZoneWriting"
|
||||
end
|
||||
|
||||
project "ZoneWriting"
|
||||
function ZoneWriting:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -46,10 +46,10 @@ function ZoneWriting:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Crypto:include()
|
||||
Utils:include()
|
||||
zlib:include()
|
||||
self:include(includes)
|
||||
Crypto:include(includes)
|
||||
Utils:include(includes)
|
||||
zlib:include(includes)
|
||||
|
||||
ZoneCode:use()
|
||||
end
|
||||
|
@ -1,17 +1,15 @@
|
||||
ObjCommonTests = {}
|
||||
|
||||
function ObjCommonTests:include()
|
||||
if References:include(self:name()) then
|
||||
function ObjCommonTests:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(TestFolder(), "ObjCommonTests")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjCommonTests:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
end
|
||||
function ObjCommonTests:link(links)
|
||||
|
||||
end
|
||||
|
||||
function ObjCommonTests:use()
|
||||
@ -23,8 +21,9 @@ function ObjCommonTests:name()
|
||||
end
|
||||
|
||||
function ObjCommonTests:project()
|
||||
References:reset()
|
||||
local folder = TestFolder();
|
||||
local folder = TestFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryTest)
|
||||
@ -44,9 +43,10 @@ function ObjCommonTests:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
ObjCommon:include()
|
||||
catch2:include()
|
||||
self:include(includes)
|
||||
ObjCommon:include(includes)
|
||||
catch2:include(includes)
|
||||
|
||||
ObjCommon:link()
|
||||
links:linkto(ObjCommon)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,17 +1,15 @@
|
||||
ZoneCodeGeneratorLibTests = {}
|
||||
|
||||
function ZoneCodeGeneratorLibTests:include()
|
||||
if References:include(self:name()) then
|
||||
function ZoneCodeGeneratorLibTests:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(TestFolder(), "ZoneCodeGeneratorLibTests")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLibTests:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
end
|
||||
function ZoneCodeGeneratorLibTests:link(links)
|
||||
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLibTests:use()
|
||||
@ -23,8 +21,9 @@ function ZoneCodeGeneratorLibTests:name()
|
||||
end
|
||||
|
||||
function ZoneCodeGeneratorLibTests:project()
|
||||
References:reset()
|
||||
local folder = TestFolder();
|
||||
local folder = TestFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryTest)
|
||||
@ -43,9 +42,10 @@ function ZoneCodeGeneratorLibTests:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
ZoneCodeGeneratorLib:include()
|
||||
catch2:include()
|
||||
self:include(includes)
|
||||
ZoneCodeGeneratorLib:include(includes)
|
||||
catch2:include(includes)
|
||||
|
||||
ZoneCodeGeneratorLib:link()
|
||||
links:linkto(ZoneCodeGeneratorLib)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,17 +1,15 @@
|
||||
ZoneCommonTests = {}
|
||||
|
||||
function ZoneCommonTests:include()
|
||||
if References:include(self:name()) then
|
||||
function ZoneCommonTests:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(TestFolder(), "ZoneCommonTests")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommonTests:link()
|
||||
if References:link(self:name()) then
|
||||
links(self:name())
|
||||
end
|
||||
function ZoneCommonTests:link(links)
|
||||
|
||||
end
|
||||
|
||||
function ZoneCommonTests:use()
|
||||
@ -23,8 +21,9 @@ function ZoneCommonTests:name()
|
||||
end
|
||||
|
||||
function ZoneCommonTests:project()
|
||||
References:reset()
|
||||
local folder = TestFolder();
|
||||
local folder = TestFolder()
|
||||
local includes = Includes:create()
|
||||
local links = Links:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryTest)
|
||||
@ -45,11 +44,12 @@ function ZoneCommonTests:project()
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
ZoneCommon:include()
|
||||
catch2:include()
|
||||
self:include(includes)
|
||||
ZoneCommon:include(includes)
|
||||
catch2:include(includes)
|
||||
|
||||
ZoneCommon:link()
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkall()
|
||||
|
||||
ZoneCode:use()
|
||||
end
|
||||
|
5
thirdparty/catch2.lua
vendored
5
thirdparty/catch2.lua
vendored
@ -1,7 +1,7 @@
|
||||
catch2 = {}
|
||||
|
||||
function catch2:include()
|
||||
if References:include(self:name()) then
|
||||
function catch2:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "catch2", "single_include")
|
||||
}
|
||||
@ -20,5 +20,4 @@ function catch2:name()
|
||||
end
|
||||
|
||||
function catch2:project()
|
||||
References:reset()
|
||||
end
|
||||
|
27
thirdparty/libtomcrypt.lua
vendored
27
thirdparty/libtomcrypt.lua
vendored
@ -1,7 +1,7 @@
|
||||
libtomcrypt = {}
|
||||
|
||||
function libtomcrypt:include()
|
||||
if References:include("libtomcrypt") then
|
||||
function libtomcrypt:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
defines{
|
||||
"LTM_DESC"
|
||||
}
|
||||
@ -12,21 +12,24 @@ function libtomcrypt:include()
|
||||
end
|
||||
end
|
||||
|
||||
function libtomcrypt:link()
|
||||
if References:link("libtomcrypt") then
|
||||
links "libtomcrypt"
|
||||
end
|
||||
function libtomcrypt:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(libtommath)
|
||||
end
|
||||
|
||||
function libtomcrypt:use()
|
||||
|
||||
end
|
||||
|
||||
function libtomcrypt:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function libtomcrypt:name()
|
||||
return "libtomcrypt"
|
||||
end
|
||||
|
||||
project "libtomcrypt"
|
||||
function libtomcrypt:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -45,8 +48,8 @@ function libtomcrypt:project()
|
||||
"LTC_NO_PROTOTYPES"
|
||||
}
|
||||
|
||||
self:include()
|
||||
libtommath:include()
|
||||
self:include(includes)
|
||||
libtommath:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
24
thirdparty/libtommath.lua
vendored
24
thirdparty/libtommath.lua
vendored
@ -1,28 +1,30 @@
|
||||
libtommath = {}
|
||||
|
||||
function libtommath:include()
|
||||
if References:include("libtommath") then
|
||||
function libtommath:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "libtommath")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function libtommath:link()
|
||||
if References:link("libtommath") then
|
||||
links "libtommath"
|
||||
end
|
||||
function libtommath:link(links)
|
||||
links:add(self:name())
|
||||
end
|
||||
|
||||
function libtommath:use()
|
||||
|
||||
end
|
||||
|
||||
function libtommath:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function libtommath:name()
|
||||
return "libtommath"
|
||||
end
|
||||
|
||||
project "libtommath"
|
||||
function libtommath:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -33,7 +35,7 @@ function libtommath:project()
|
||||
path.join(folder, "libtommath/*.c")
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
24
thirdparty/minilzo.lua
vendored
24
thirdparty/minilzo.lua
vendored
@ -1,28 +1,30 @@
|
||||
minilzo = {}
|
||||
|
||||
function minilzo:include()
|
||||
if References:include("minilzo") then
|
||||
function minilzo:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "minilzo")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function minilzo:link()
|
||||
if References:link("minilzo") then
|
||||
links "minilzo"
|
||||
end
|
||||
function minilzo:link(links)
|
||||
links:add(self:name())
|
||||
end
|
||||
|
||||
function minilzo:use()
|
||||
|
||||
end
|
||||
|
||||
function minilzo:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function minilzo:name()
|
||||
return "minilzo"
|
||||
end
|
||||
|
||||
project "minilzo"
|
||||
function minilzo:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -33,7 +35,7 @@ function minilzo:project()
|
||||
path.join(folder, "minilzo/*.c")
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
28
thirdparty/minizip.lua
vendored
28
thirdparty/minizip.lua
vendored
@ -1,30 +1,32 @@
|
||||
minizip = {}
|
||||
|
||||
function minizip:include()
|
||||
if References:include("minizip") then
|
||||
zlib:include()
|
||||
function minizip:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
zlib:include(includes)
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "zlib/contrib/minizip")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function minizip:link()
|
||||
if References:link("minizip") then
|
||||
zlib:link()
|
||||
links "minizip"
|
||||
end
|
||||
function minizip:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(zlib)
|
||||
end
|
||||
|
||||
function minizip:use()
|
||||
|
||||
end
|
||||
|
||||
function minizip:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function minizip:name()
|
||||
return "minizip"
|
||||
end
|
||||
|
||||
project "minizip"
|
||||
function minizip:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -40,7 +42,7 @@ function minizip:project()
|
||||
path.join(folder, "zlib/contrib/minizip/crypt.h"),
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
24
thirdparty/salsa20.lua
vendored
24
thirdparty/salsa20.lua
vendored
@ -1,28 +1,30 @@
|
||||
salsa20 = {}
|
||||
|
||||
function salsa20:include()
|
||||
if References:include("salsa20") then
|
||||
function salsa20:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ThirdPartyFolder(), "salsa20")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function salsa20:link()
|
||||
if References:link("salsa20") then
|
||||
links "salsa20"
|
||||
end
|
||||
function salsa20:link(links)
|
||||
links:add(self:name())
|
||||
end
|
||||
|
||||
function salsa20:use()
|
||||
|
||||
end
|
||||
|
||||
function salsa20:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function salsa20:name()
|
||||
return "salsa20"
|
||||
end
|
||||
|
||||
project "salsa20"
|
||||
function salsa20:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -33,7 +35,7 @@ function salsa20:project()
|
||||
path.join(folder, "salsa20/*.c")
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
24
thirdparty/zlib.lua
vendored
24
thirdparty/zlib.lua
vendored
@ -1,7 +1,7 @@
|
||||
zlib = {}
|
||||
|
||||
function zlib:include()
|
||||
if References:include("zlib") then
|
||||
function zlib:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
defines {
|
||||
"ZLIB_CONST"
|
||||
}
|
||||
@ -12,21 +12,23 @@ function zlib:include()
|
||||
end
|
||||
end
|
||||
|
||||
function zlib:link()
|
||||
if References:link("zlib") then
|
||||
links "zlib"
|
||||
end
|
||||
function zlib:link(links)
|
||||
links:add(self:name())
|
||||
end
|
||||
|
||||
function zlib:use()
|
||||
|
||||
end
|
||||
|
||||
function zlib:project()
|
||||
References:reset()
|
||||
local folder = ThirdPartyFolder();
|
||||
function zlib:name()
|
||||
return "zlib"
|
||||
end
|
||||
|
||||
project "zlib"
|
||||
function zlib:project()
|
||||
local folder = ThirdPartyFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
@ -42,7 +44,7 @@ function zlib:project()
|
||||
"_CRT_NONSTDC_NO_DEPRECATE"
|
||||
}
|
||||
|
||||
self:include()
|
||||
self:include(includes)
|
||||
|
||||
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||
warnings "off"
|
||||
|
25
tools/scripts/folders.lua
Normal file
25
tools/scripts/folders.lua
Normal file
@ -0,0 +1,25 @@
|
||||
-- Functions for locating commonly used folders
|
||||
local _BuildFolder = path.getabsolute("../../build")
|
||||
function BuildFolder()
|
||||
return path.getrelative(os.getcwd(), _BuildFolder)
|
||||
end
|
||||
|
||||
local _ThirdPartyFolder = path.getabsolute("../../thirdparty")
|
||||
function ThirdPartyFolder()
|
||||
return path.getrelative(os.getcwd(), _ThirdPartyFolder)
|
||||
end
|
||||
|
||||
local _ProjectFolder = path.getabsolute("../../src")
|
||||
function ProjectFolder()
|
||||
return path.getrelative(os.getcwd(), _ProjectFolder)
|
||||
end
|
||||
|
||||
local _TestFolder = path.getabsolute("../../test")
|
||||
function TestFolder()
|
||||
return path.getrelative(os.getcwd(), _TestFolder)
|
||||
end
|
||||
|
||||
-- Target Directories
|
||||
TargetDirectoryBin = "%{wks.location}/bin/%{cfg.buildcfg}_%{cfg.platform}"
|
||||
TargetDirectoryLib = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}"
|
||||
TargetDirectoryTest = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}/tests"
|
20
tools/scripts/including.lua
Normal file
20
tools/scripts/including.lua
Normal file
@ -0,0 +1,20 @@
|
||||
-- Functions for including projects
|
||||
Includes = {}
|
||||
|
||||
function Includes:create()
|
||||
|
||||
list = {
|
||||
handles = {}
|
||||
}
|
||||
|
||||
function list:handle(name)
|
||||
if self.handles[name] == nil then
|
||||
self.handles[name] = true
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return list
|
||||
end
|
48
tools/scripts/linking.lua
Normal file
48
tools/scripts/linking.lua
Normal file
@ -0,0 +1,48 @@
|
||||
-- Functions for linking projects
|
||||
Links = {}
|
||||
|
||||
function Links:create()
|
||||
|
||||
list = {
|
||||
stack = {},
|
||||
dependencies = {}
|
||||
}
|
||||
|
||||
function list:linkto(project)
|
||||
local projectName = project:name()
|
||||
for i, dependency in ipairs(self.stack) do
|
||||
if dependency == projectName then
|
||||
print "Circular dependency detected:"
|
||||
local dependencyList = projectName
|
||||
for j = i + 1, #self.stack do
|
||||
dependencyList = dependencyList .. " -> " .. self.stack[j]
|
||||
end
|
||||
dependencyList = dependencyList .. " -> " .. projectName
|
||||
print(dependencyList)
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(self.stack, projectName)
|
||||
project:link(self)
|
||||
table.remove(self.stack)
|
||||
end
|
||||
|
||||
function list:add(name)
|
||||
for i = 1, #self.dependencies do
|
||||
if self.dependencies[i] == name then
|
||||
table.remove(self.dependencies, i)
|
||||
i = i - 1
|
||||
end
|
||||
end
|
||||
table.insert(self.dependencies, name)
|
||||
end
|
||||
|
||||
function list:linkall()
|
||||
for i, dependency in ipairs(self.dependencies) do
|
||||
links(dependency)
|
||||
end
|
||||
end
|
||||
|
||||
return list
|
||||
end
|
0
tools/scripts/options.lua
Normal file
0
tools/scripts/options.lua
Normal file
8
tools/scripts/platform.lua
Normal file
8
tools/scripts/platform.lua
Normal file
@ -0,0 +1,8 @@
|
||||
-- Platform functions
|
||||
function ExecutableByOs(name)
|
||||
if os.host() == "windows" then
|
||||
return name .. ".exe"
|
||||
else
|
||||
return name
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user