-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpremake4.lua
More file actions
110 lines (95 loc) · 3.39 KB
/
premake4.lua
File metadata and controls
110 lines (95 loc) · 3.39 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
-- Copyright 2012 Jose L. Hidalgo <pplux@pplux.com>
-- Script to generate SLB solution/makefile/...
-- Used manily for SLB's development and testing
config = {
location = "build/",
target = "build/bin/",
debug_level = 5,
valgrind = true,
}
function run_tests(program_prefix)
print("RUNNING TESTS...........")
local count, failed = 0,0
local failed_tests = ""
for k,v in pairs(os.matchfiles("tests/scripts/*.lua")) do
count = count +1
print("\n")
print("_______________________________________________________________")
print("***************************************************************")
print("** Running Test: ("..k..")",v)
print("***************************************************************")
if os.execute(program_prefix.." build/bin/SLB-test "..v) ~= 0 then
print("***************************************************************")
print("** FAIL:", v)
print("***************************************************************")
print("_______________________________________________________________")
failed = failed +1
failed_tests = failed_tests..v.."\n"
else
print("***************************************************************")
print("** OK:", v)
print("***************************************************************")
print("_______________________________________________________________")
end
end
print("RESULTS: total tests:",count," failed: ", failed)
if failed > 0 then
print("Failed tests:")
print(failed_tests)
end
os.exit(0)
end
if _ACTION == "test" then
if config.valgrind then
run_tests("valgrind --leak-check=full -v")
else
run_tests("")
end
end
solution "SLB"
language "c++"
configurations {"Debug", "Release"}
includedirs("include")
location(config.location)
targetdir(config.target)
configuration "Debug"
flags { "Symbols" }
configuration "Release"
flags { "Optimize" }
project "SLB-static"
targetname("SLB")
targetdir(config.target.."static/")
defines { "SLB_LIBRARY", "SLB_DYNAMIC_LIBRARY=0" }
kind "StaticLib"
files { "src/*.c*" , "include/SLB/*.hpp" }
project "SLB-dynamic"
targetname("SLB")
targetdir(config.target.."dynamic/")
defines { "SLB_LIBRARY", "SLB_DYNAMIC_LIBRARY=1" }
kind "SharedLib"
files { "src/*.c*" , "include/SLB/*.hpp" }
project "SLB-static-verbose"
targetname("SLB")
targetdir(config.target.."static/")
defines { "SLB_LIBRARY", "SLB_DYNAMIC_LIBRARY=0" }
kind "StaticLib"
defines { "SLB_DEBUG_LEVEL="..config.debug_level }
files { "src/*.c*" , "include/SLB/*.hpp" }
project "SLB-test"
kind "ConsoleApp"
files { "tests/src/*.cpp", "tests/src/*.h" }
if config.valgrind then
defines {"USE_VALGRIND=1"}
includedirs {"/opt/local/include"}
end
defines { "SLB_DEBUG_LEVEL="..config.debug_level }
links "SLB-static-verbose"
-- examples
do
for _, example in pairs(os.matchdirs("examples/*")) do
project(path.getname(example))
kind "ConsoleApp"
files { example.."/**.cpp", example.."/**.h" }
links "SLB-static"
end
end