-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake5.lua
84 lines (62 loc) · 2.15 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
80
81
82
83
84
require('gmake2')
local p = premake
local gmake2 = p.modules.gmake2
workspace "Fizz"
configurations {"Debug", "Release", "Dist"}
architecture "x86_64"
nutellaPath = "nutella/"
include "nutella/client-premake.lua"
IncludeDir = {}
IncludeDir["ImGui"] = "nutella/nutella/vendor/imgui"
IncludeDir["glm"] = "nutella/nutella/vendor/glm"
project "Fizz"
location "fizz"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
staticruntime "Off"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
links "Nutella"
runpathdirs "%{cfg.targetdir}" -- adds relatively (i.e. this is $ORIGIN)
files {
"%{prj.location}/src/**.cpp",
"%{prj.location}/src/**.hpp",
}
includedirs {
"%{prj.location}/src",
"nutella/nutella/src",
"nutella/nutella/vendor/spdlog/include",
"%{IncludeDir.ImGui}",
"%{IncludeDir.glm}"
}
filter "configurations:Debug"
defines {"NT_DEBUG", "NT_ENABLE_ASSERTS", "NT_PROFILE"}
runtime "Debug"
symbols "On"
filter "configurations:Release"
defines {"NT_RELEASE", "NT_PROFILE"}
runtime "Release"
optimize "On"
filter "configurations:Dist"
defines "NT_DIST"
runtime "Release"
optimize "On"
premake.override(gmake2, 'projectrules', function(base, wks)
local project = p.project
for prj in p.workspace.eachproject(wks) do
local deps = project.getdependencies(prj)
deps = table.extract(deps, "name")
_p('%s:%s', p.esc(prj.name), gmake2.list(deps))
local cfgvar = gmake2.tovar(prj.name)
_p('ifneq (,$(%s_config))', cfgvar)
_p(1,'@echo "==== Building %s ($(%s_config)) ===="', prj.name, cfgvar)
local prjpath = p.filename(prj, gmake2.getmakefilename(prj, true))
local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))
local prjname = path.getname(prjpath)
-- removed '--no-print-directory' here --
_x(1,'@${MAKE} -C %s -f %s config=$(%s_config)', prjdir, prjname, cfgvar)
_p('endif')
_p('')
end
end)