-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
129 lines (112 loc) · 3.05 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
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
---@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/build/"
objdir "BUILD/build/obj"
targetname "log"
files {"deps/log.c"}
-- 🔹 Rxi INI Library
project "mk_ini"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/build/"
objdir "BUILD/build/obj"
targetname "ini"
files {"deps/ini.c"}
-- 🔹 Sokol Library
project "mk_sokol"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/build/"
objdir "BUILD/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/build/"
objdir "BUILD/build/obj"
targetname "hmm"
files {"deps/hmm.c"}
-- 🔹 STB Library
project "mk_stb"
kind "StaticLib"
language "C"
location "BUILD"
targetdir "BUILD/build/"
objdir "BUILD/build/obj"
targetname "stb"
buildoptions { "-Wno-deprecated-declarations" }
files {"deps/stb.c"}
-- 🔹 Main Application
project "mk_sqv"
kind "ConsoleApp"
language "C"
location "BUILD"
targetdir "BUILD/build/"
objdir "BUILD/build/obj"
targetname "sqv"
files {"src/*.c", "src/qk/*.c"}
includedirs {"src", "deps"}
links { "mk_log:static", "mk_ini:static", "mk_stb:static", "mk_sokol:static", "mk_hmm:static" }
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
}
-- 🔹 Run Action
newaction {
trigger = "run",
description = "Execute the program with optional arguments",
execute = function()
-- Capture additional command-line arguments
local args = _ARGS
local args_str = table.concat(args, " ")
-- Execute the program with arguments
os.execute("BUILD/build/sqv " .. args_str)
end
}
-- 🔹 Quick Run Action
newaction {
trigger = "r",
description = "Execute the program with optional arguments",
execute = function()
os.execute("BUILD/build/sqv -m=KEEP/armor.mdl")
end
}