-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake_Base.lua
92 lines (74 loc) · 2.4 KB
/
premake_Base.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
80
81
82
83
84
85
86
87
88
89
90
91
92
function copyfile(source, target)
return "xcopy /y \"" .. select(1, (source .. "\" \"" .. target .. "\""):gsub("/", "\\"))
end
function copyfolder(source, target)
return "xcopy /y /s \"" .. select(1, (source .. "\" \"" .. target .. "\""):gsub("/", "\\"))
end
outputconfigname = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
outputbindir = "%{wks.location}/Out/Bin/" .. outputconfigname
outputintdir = "%{wks.location}/Out/Int/" .. outputconfigname
outputbindirproj = outputbindir .. "/%{prj.name}"
outputintdirproj = outputintdir .. "/%{prj.name}"
function createbaseprojectcpp(name, type)
project (name)
kind (type)
language "C++"
cppdialect "C++latest"
staticruntime "Off"
targetdir (outputbindir)
objdir (outputintdir)
files
{
"Source/**.h",
"Source/**.cpp",
"Source/**.hpp",
}
includedirs
{
"Source",
}
flags
{
"MultiProcessorCompile",
"UndefinedIdentifiers",
}
filter "configurations:Debug"
defines { "POG_DEBUG", "POG_ENABLE_ASSERT" }
runtime "Debug"
symbols "On"
filter "configurations:Release"
defines { "POG_RELEASE", "POG_ENABLE_VERIFY" }
runtime "Release"
optimize "On"
filter "configurations:Dist"
defines "POG_DIST"
runtime "Release"
optimize "On"
flags
{
"LinkTimeOptimization"
}
project (name)
end
-- https://github.com/premake/premake-core/issues/1061
require('vstudio')
premake.api.register {
name = "solutionitems",
scope = "workspace",
kind = "list:keyed:list:string",
}
premake.override(premake.vstudio.sln2005, "projects", function(base, wks)
for _, folder in ipairs(wks.solutionitems) do
for name, files in pairs(folder) do
premake.push('Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "'..name..'", "'..name..'", "{' .. os.uuid("Solution Items:"..wks.name) .. '}"')
premake.push("ProjectSection(SolutionItems) = preProject")
for _, file in ipairs(files) do
file = path.rebase(file, ".", wks.location)
premake.w(file.." = "..file)
end
premake.pop("EndProjectSection")
premake.pop("EndProject")
end
end
base(wks)
end)