-
Notifications
You must be signed in to change notification settings - Fork 4
/
premake5.lua
79 lines (62 loc) · 2.48 KB
/
premake5.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Solution = Solution or
{
NumProjects = 0,
Projects = {},
ActiveGroup = "",
BuildSystemGroup = "0. [Build System]",
ModuleGroup = "0. [Modules]",
TestGroup = "1. [Tests]",
DependencyGroup = "2. [Dependencies]"
}
local projectUtils = "Premake/ProjectUtil.lua"
include(projectUtils)
local projectName = "AssetConverter"
local projectIsRoot = Solution.NumProjects == 0
local project = Solution.Util.Create(projectName, projectIsRoot)
local submodules = { "Engine" }
project.Init = function(self, rootDir, buildDir, binDir)
Solution.Util.Print("-- Initializing (" .. self.Name .. ") --\n")
self.RootDir = rootDir
self.BuildDir = buildDir
self.BinDir = binDir .. "/" .. self.Name
self.DependencyDir = path.getabsolute("Dependencies/", self.RootDir)
self.ModulesDir = path.getabsolute("Source/", self.RootDir)
local buildSettings = path.getabsolute("Premake/BuildSettings.lua", self.RootDir)
local silentFailOnDuplicateSetting = not self.IsRoot
InitBuildSettings(silentFailOnDuplicateSetting)
include(buildSettings)
if self.IsRoot then
workspace (self.Name)
location (self.BuildDir)
configurations { "Debug", "RelDebug", "Release" }
Solution.Util.SetFilter("system:Windows", function()
system "windows"
platforms "Win64"
end)
Solution.Util.SetFilter("system:Unix", function()
system "linux"
platforms "Linux"
end)
end
for _, v in pairs(submodules) do
Solution.Util.Print("-- Initializing Submodule : " .. v)
Solution.Util.IncludeSubmodule(v, self.RootDir, self.BinDir)
end
Solution.Util.Print("\n-- Directory Info (" .. self.Name .. ") --")
Solution.Util.Print(" Root Directory : " .. self.RootDir)
Solution.Util.Print(" Build Directory : " .. self.BuildDir)
Solution.Util.Print(" Bin Directory : " .. self.BinDir)
Solution.Util.Print("--\n")
Solution.Projects.Current = project
local deps = path.getabsolute("Dependencies/Dependencies.lua", self.RootDir)
local projects = path.getabsolute("Source/Modules.lua", self.RootDir)
include(deps)
include(projects)
Solution.Util.Print("-- Done (" .. self.Name .. ") --")
end
if projectIsRoot then
local rootDir = path.getabsolute(".")
local buildDir = path.getabsolute("Build/", rootDir)
local binDir = path.getabsolute("Bin/", buildDir)
project:Init(rootDir, buildDir, binDir)
end