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
|
--[[ project solution / workspace, global configuration ]]--
solution "flatland"
configurations { "debug", "release" }
-- build configurations
flags { "ExtraWarnings" }
buildoptions { "-std=c++17" }
--- for linux specifically
configuration { "linux", "gmake" }
buildoptions {
"-pedantic", "-Wall", "-Wextra", "-Wcast-qual", "-Wcast-align",
"-Wpointer-arith", "-Winit-self", "-Wshadow", "-Wswitch-enum",
"-Wredundant-decls", "-Wfloat-equal", "-Wundef", "-Wvla",
"-Wconversion", "-Wstrict-aliasing"
}
--[[ custom lua code ]]--
local test = {
add_specific = function(name, src, tested_src)
local sources = {}
table.insert(sources, src)
io.write("Added specific test " .. src .. " to test { ")
for k, v in pairs(tested_src) do
io.write(v .. " " )
table.insert(sources, v)
end
print("}")
project("libflatland-test-" .. name)
language("C++")
kind("ConsoleApp")
location("build/")
includedirs({ "engine/include", "lib/include" })
files(sources)
configuration("debug")
targetdir("build/debug")
defines({ "DEBUG" })
flags({ "Symbols" })
end
}
local dependency = {
build = function(path, commands)
print("Building dependency under " .. path)
for k, cmd in pairs(commands) do
print(" Running " .. cmd)
os.execute("cd " .. path .. "; " .. cmd)
end
end
}
--[[ dependencies ]]--
dependency.build("lib/libwsdl2", { "./configure.py", "ninja" })
dependency.build("lib/libmm", { "ninja" })
--[[ main project ]]--
project "libflatland"
-- project
language "C++"
kind "SharedLib"
location "build/"
-- source code
files { "engine/**.cpp" }
includedirs { "lib/include", "engine/include" }
configuration "debug"
targetdir "build/debug"
defines { "DEBUG" }
flags { "Symbols" }
configuration "release"
targetdir "build/release"
flags { "Optimize" }
-- add tests
test.add_specific("task", "test/task_test.cpp", {
"engine/task.cpp"
})
|