Add premake scripts for projects

This commit is contained in:
Jan 2019-10-22 02:40:06 +02:00
parent cae05efb7b
commit 0d103e24a5
15 changed files with 361 additions and 12 deletions

View File

@ -68,19 +68,55 @@ workspace "OpenAssetTools"
-- ========================
-- ThirdParty
-- ========================
include "thirdparty/libtomcrypt.lua"
include "thirdparty/libtommath.lua"
include "thirdparty/salsa20.lua"
include "thirdparty/zlib.lua"
-- All projects here should be in the thirdparty folder
group "thirdparty"
-- ThirdParty group: All projects that are external dependencies
group "ThirdParty"
libtommath:project()
libtomcrypt:project()
salsa20:project()
zlib:project()
group ""
libtommath:project()
libtomcrypt:project()
salsa20:project()
zlib:project()
-- ========================
-- Projects
-- ========================
include "src/Crypto.lua"
include "src/Linker.lua"
include "src/Unlinker.lua"
include "src/Utils.lua"
include "src/ZoneCodeGenerator.lua"
include "src/ZoneCommon.lua"
include "src/ZoneLoading.lua"
include "src/ZoneWriting.lua"
-- Reset group
-- Components group: All projects assist or are part of a tool
group "Components"
Crypto:project()
Utils:project()
--ZoneCodeGenerator:project()
ZoneCommon:project()
ZoneLoading:project()
ZoneWriting:project()
group ""
-- Tools group: All projects that compile into the final tools
group "Tools"
Linker:project()
Unlinker:project()
group ""
-- ========================
-- Tests
-- ========================
include "test/ZoneCodeGeneratorTests.lua"
include "test/ZoneCommonTests.lua"
-- Tests group: Unit test and other tests projects
group "Tests"
--ZoneCodeGeneratorTests:project()
ZoneCommonTests:project()
group ""

36
src/Crypto.lua Normal file
View File

@ -0,0 +1,36 @@
Crypto = {}
function Crypto:include()
includedirs {
path.join(ProjectFolder(), "Crypto")
}
end
function Crypto:link()
libtomcrypt:link()
libtommath:link()
salsa20:link()
links {
"Crypto"
}
end
function Crypto:project()
local folder = ProjectFolder();
project "Crypto"
targetdir(TargetDirectoryLib)
location "%{wks.location}/src"
kind "StaticLib"
language "C++"
files {
path.join(folder, "Crypto/**.h"),
path.join(folder, "Crypto/**.cpp")
}
self:include()
libtomcrypt:include()
libtommath:include()
salsa20:include()
end

33
src/Linker.lua Normal file
View File

@ -0,0 +1,33 @@
Linker = {}
function Linker:include()
includedirs {
path.join(ProjectFolder(), "Linker")
}
end
function Linker:link()
end
function Linker:project()
local folder = ProjectFolder();
project "Linker"
targetdir(TargetDirectoryBin)
location "%{wks.location}/src"
kind "ConsoleApp"
language "C++"
files {
path.join(folder, "Linker/**.h"),
path.join(folder, "Linker/**.cpp")
}
self:include()
Utils:include()
ZoneWriting:include()
Utils:link()
--ZoneWriting:link()
end

33
src/Unlinker.lua Normal file
View File

@ -0,0 +1,33 @@
Unlinker = {}
function Unlinker:include()
includedirs {
path.join(ProjectFolder(), "Unlinker")
}
end
function Unlinker:link()
end
function Unlinker:project()
local folder = ProjectFolder();
project "Unlinker"
targetdir(TargetDirectoryBin)
location "%{wks.location}/src"
kind "ConsoleApp"
language "C++"
files {
path.join(folder, "Unlinker/**.h"),
path.join(folder, "Unlinker/**.cpp")
}
self:include()
Utils:include()
ZoneLoading:include()
Utils:link()
ZoneLoading:link()
end

30
src/Utils.lua Normal file
View File

@ -0,0 +1,30 @@
Utils = {}
function Utils:include()
includedirs {
path.join(ProjectFolder(), "Utils")
}
end
function Utils:link()
links {
"Utils"
}
end
function Utils:project()
local folder = ProjectFolder();
project "Utils"
targetdir(TargetDirectoryLib)
location "%{wks.location}/src"
kind "StaticLib"
language "C++"
files {
path.join(folder, "Utils/**.h"),
path.join(folder, "Utils/**.cpp")
}
self:include()
end

View File

30
src/ZoneCommon.lua Normal file
View File

@ -0,0 +1,30 @@
ZoneCommon = {}
function ZoneCommon:include()
includedirs {
path.join(ProjectFolder(), "ZoneCommon")
}
end
function ZoneCommon:link()
links {
"ZoneCommon"
}
end
function ZoneCommon:project()
local folder = ProjectFolder();
project "ZoneCommon"
targetdir(TargetDirectoryLib)
location "%{wks.location}/src"
kind "StaticLib"
language "C++"
files {
path.join(folder, "ZoneCommon/**.h"),
path.join(folder, "ZoneCommon/**.cpp")
}
self:include()
end

38
src/ZoneLoading.lua Normal file
View File

@ -0,0 +1,38 @@
ZoneLoading = {}
function ZoneLoading:include()
ZoneCommon:include()
includedirs {
path.join(ProjectFolder(), "ZoneLoading")
}
end
function ZoneLoading:link()
Crypto:link()
Utils:link()
ZoneCommon:link()
zlib:link()
links {
"ZoneLoading"
}
end
function ZoneLoading:project()
local folder = ProjectFolder();
project "ZoneLoading"
targetdir(TargetDirectoryLib)
location "%{wks.location}/src"
kind "StaticLib"
language "C++"
files {
path.join(folder, "ZoneLoading/**.h"),
path.join(folder, "ZoneLoading/**.cpp")
}
self:include()
Crypto:include()
Utils:include()
zlib:include()
end

38
src/ZoneWriting.lua Normal file
View File

@ -0,0 +1,38 @@
ZoneWriting = {}
function ZoneWriting:include()
ZoneCommon:include()
includedirs {
path.join(ProjectFolder(), "ZoneWriting")
}
end
function ZoneWriting:link()
Crypto:link()
Utils:link()
ZoneCommon:link()
zlib:link()
links {
"ZoneWriting"
}
end
function ZoneWriting:project()
local folder = ProjectFolder();
project "ZoneWriting"
targetdir(TargetDirectoryLib)
location "%{wks.location}/src"
kind "StaticLib"
language "C++"
files {
path.join(folder, "ZoneWriting/**.h"),
path.join(folder, "ZoneWriting/**.cpp")
}
self:include()
Crypto:include()
Utils:include()
zlib:include()
end

View File

@ -0,0 +1,38 @@
ZoneCodeGeneratorTests = {}
function ZoneCodeGeneratorTests:include()
end
function ZoneCodeGeneratorTests:link()
end
function ZoneCodeGeneratorTests:project()
local folder = TestFolder();
project "ZoneCodeGeneratorTests"
targetdir(TargetDirectoryTest)
location "%{wks.location}/test"
kind "SharedLib"
language "C#"
files {
path.join(folder, "Zone/src/**.h"),
path.join(folder, "libtomcrypt/src/**.c")
}
defines {
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
"LTC_SOURCE",
"LTC_NO_TEST",
"LTC_NO_PROTOTYPES"
}
self:include()
libtommath:include()
-- Disable warnings. They do not have any value to us since it is not our code.
warnings "off"
end

32
test/ZoneCommonTests.lua Normal file
View File

@ -0,0 +1,32 @@
ZoneCommonTests = {}
function ZoneCommonTests:include()
end
function ZoneCommonTests:link()
end
function ZoneCommonTests:project()
local folder = TestFolder();
project "ZoneCommonTests"
targetdir(TargetDirectoryTest)
location "%{wks.location}/test"
kind "SharedLib"
language "C++"
files {
path.join(folder, "ZoneCommonTests/**.h"),
path.join(folder, "ZoneCommonTests/**.cpp")
}
self:include()
ZoneCommon:include()
ZoneCommon:link()
-- Disable warnings. They do not have any value to us since it is not our code.
warnings "off"
end

View File

@ -1,13 +1,16 @@
libtomcrypt = {}
function libtomcrypt:include()
defines{
"LTM_DESC"
}
includedirs {
path.join(ThirdPartyFolder(), "libtomcrypt/src/headers")
}
end
function libtomcrypt:link()
self:include()
links {
"libtomcrypt"
}

View File

@ -7,7 +7,6 @@ function libtommath:include()
end
function libtommath:link()
self:include()
links {
"libtommath"
}

View File

@ -7,7 +7,6 @@ function salsa20:include()
end
function salsa20:link()
self:include()
links {
"salsa20"
}

6
thirdparty/zlib.lua vendored
View File

@ -1,13 +1,17 @@
zlib = {}
function zlib:include()
defines {
"ZLIB_CONST"
}
includedirs {
path.join(ThirdPartyFolder(), "zlib")
}
end
function zlib:link()
self:include()
links {
"zlib"
}