-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpremake5.lua
More file actions
163 lines (144 loc) · 3.42 KB
/
premake5.lua
File metadata and controls
163 lines (144 loc) · 3.42 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---@diagnostic disable: undefined-global
workspace "ProjectWorkspace"
configurations { "Debug", "Release" }
location "."
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
optimize "Off"
buildoptions { "-fsanitize=address" }
linkoptions { "-fsanitize=address" }
filter "configurations:Release"
defines { "NDEBUG" }
optimize "Speed"
-- Rxi Log Library
project "mk_log"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "log"
files {"deps/log.c"}
-- Rxi INI Library
project "mk_ini"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "ini"
files {"deps/ini.c"}
-- Sokol Library
project "mk_sokol"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "sokol"
files {"deps/sokol.c"}
filter "system:macosx"
defines { "SOKOL_GLCORE" }
links { "Cocoa.framework", "OpenGL.framework", "IOKit.framework" }
buildoptions { "-x objective-c" }
filter "system:linux"
defines { "SOKOL_GLCORE" }
links { "X11", "Xi", "Xcursor", "GL", "m" }
-- Handmade Math (HMM) Library
project "mk_hmm"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "hmm"
files {"deps/hmm.c"}
-- STB Library
project "mk_stb"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "stb"
buildoptions { "-Wno-deprecated-declarations" }
files {"deps/stb.c"}
-- STB Library
project "mk_sepi"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "sepi"
buildoptions { "-Wno-deprecated-declarations" }
files {"deps/sepi.c"}
-- Main Application
project "mk_sqv"
kind "ConsoleApp"
language "C"
location "BUILD"
targetdir "BUILD/"
objdir "BUILD/obj"
targetname "sqv"
includedirs {"src", "deps"}
libdirs { "BUILD" }
links {
"log:static",
"ini:static",
"stb:static",
"hmm:static",
"sepi:static",
"sokol:static",
}
files {
"src/app.c",
"src/draw_model.c",
"src/draw_ui.c",
"src/draw_bsp.c",
"src/draw_texture.c",
}
buildoptions { "-std=c2x" }
defines { "SOKOL_GLCORE" }
defines { "_POSIX_C_SOURCE=199309L" } -- Needed for some C23 features
filter "system:macosx"
links { "Cocoa.framework", "OpenGL.framework", "IOKit.framework" }
filter "system:linux"
links { "X11", "Xi", "Xcursor", "GL", "m" }
-- GLSL Shader Compilation Action
newaction {
trigger = "glsl",
description = "Compile shaders into C headers",
execute = function()
os.execute("sokol-shdc -i res/shaders/default.glsl -l glsl410 -f sokol -o src/glsl_default.h")
end
}
-- Clean SQV Action
newaction {
trigger = "c",
description = "Execute the program with optional arguments",
execute = function()
os.execute("make --no-print-directory -C BUILD -f mk_sqv.make clean")
end
}
-- Run Action 1
newaction {
trigger = "r",
description = "quick execute",
execute = function()
os.execute("BUILD/sqv -i=KEEP/dog.mdl")
end
}
-- Run Action 2
newaction {
trigger = "rr",
description = "execute with args",
execute = function()
-- Capture additional command-line arguments
local args = _ARGS
local args_str = table.concat(args, " ")
-- Execute the program with arguments
os.execute("BUILD/sqv -i=" .. args_str)
end
}