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
|
workspace("Pong")
configurations {"Release"}
project("Pong")
newaction {
trigger = "install",
description = "Install the game to prefix.",
execute = function()
os.mkdir(string.format("%s/Pong/resources", prefix))
os.executef("cp -r resources/* %s/Pong/resources/", prefix)
os.executef("install -m755 bin/*/Pong %s/Pong/pong", prefix)
os.exit(0)
end
}
newaction {
trigger = "check_deps",
description = "Check if you have all the dependencies installed.",
execute = function()
io.write("Pkgconf: ")
io.flush()
Pkgconf_Result = os.executef("which pkgconf")
AllGood = true
if(Pkgconf_Result == nil)
then
print("You do not have pkgconf installed. Aborting.")
os.exit(1)
end
io.write("Raylib: ")
io.flush()
if(os.executef("pkgconf --modversion raylib") == nil)
then
print("Can't find raylib.")
AllGood = false
end
io.write("SDL2: ")
io.flush()
if(os.executef("pkgconf --modversion sdl2") == nil)
then
print("Can't find SDL2.")
AllGood = false
end
io.write("SDL2_mixer: ")
io.flush()
if (os.executef("pkgconf --modversion SDL2_mixer") == nil)
then
print("Can't find SDL2_mixer.")
AllGood = false
end
io.write("GLFW3: ")
io.flush()
if (os.executef("pkgconf --modversion glfw3") == nil)
then
print("Can't find GLFW.")
AllGood = false
end
io.write("GL: ")
io.flush()
if (os.executef("pkgconf --modversion gl") == nil)
then
print("Can't find OpenGL")
AllGood = false
end
io.write("GLU: ")
io.flush()
if (os.executef("pkgconf --modversion glu") == nil)
then
print("Can't find GLU")
AllGood = false
end
if(AllGood == true)
then
print("Found all dependencies!")
os.exit(0)
end
print("Failed to find all needed dependencies.")
os.exit(1)
end
}
kind("WindowedApp")
optimize("Debug")
language("C")
files {"src/*.c", "src/*.h", }
--libdirs {"/usr/local/lib", "/usr/pkg/lib", "/usr/X11R7/include"}
-- Prefix Option
newoption {
trigger = "prefix",
value = "path",
description = "Prefix for where the game is to be installed."
}
prefix = _OPTIONS["prefix"] or "app"
-- Flatpak
newoption {
trigger = "flatpak",
value = "bool",
description = "Build a flatpak."
}
flatpak = _OPTIONS["flatpak"] or "false"
if (flatpak == true)
then
else
buildoptions {"-g", "-ggdb", "`pkgconf --cflags raylib`", "`pkgconf --cflags glfw3`", "`pkgconf --cflags gl`", "`pkgconf --cflags sdl2`", "`pkgconf --cflags SDL2_mixer`", "`pkgconf --cflags glu`"}
linkoptions {"-g", "-ggdb", "`pkgconf --libs raylib`", "`pkgconf --libs glfw3`", "`pkgconf --libs gl`", "`pkgconf --libs sdl2`", "`pkgconf --libs SDL2_mixer`", "`pkgconf --libs glu`"}
end
|