-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake4.lua
118 lines (91 loc) · 2.85 KB
/
premake4.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
-- Output directories option
newoption {
trigger = "output_directory",
value = "path",
description = "[Default=bin] Output directory for the executable"
}
if not _OPTIONS["output_directory"] then
_OPTIONS["output_directory"] = "bin"
end
-- Static or shared library
newoption {
trigger = "mw_shared",
value = "bool",
description = "[Default=false] Build MwUtils as a shared library",
allowed = {
{ "true", "Build as a shared library" },
{ "false", "Build as a static library" },
}
}
-- GNU GProf option
newoption {
trigger = "gprof",
value = "bool",
description = "[Default=false] Enable GNU Profiler file generation",
allowed = {
{ "true", "GNU Profiler enabled" },
{ "false", "GNU Profiler disabled" },
}
}
-- Static stdlib linkage option
newoption {
trigger = "stdlib_static",
value = "bool",
description = "[Default=false] Enable static linking of standard libraries",
allowed = {
{ "true", "Static linking of stdlib enabled" },
{ "false", "Static linking of stdlib disabled" },
}
}
-- ///////////////////////////////////////////////////// --
-- Lua directories and configuration
--dofile "make/Lua.lua"
-- Boost directories and configuration
dofile "make/Boost.lua"
-- ///////////////////////////////////////////////////// --
function bool_default(value, default)
if not value then return default end
if value:lower() == "true" then return true end
if value:lower() == "false" then return false end
error (value.." is not a valid boolean value")
end
-- Output directories
local BIN_DIR = _OPTIONS["output_directory"]
local OBJ_DIR = BIN_DIR.."/obj"
local MAKE_DIR = BIN_DIR.."/make"
-- MwUtil
local MW_SHARED = bool_default(_OPTIONS["mw_shared"], false)
local MW_KIND = MW_SHARED and "SharedLib" or "StaticLib"
local MW_SUFFIX = MW_SHARED and "" or "-s"
-- Enable profiling with gprof on GNU GCC
local GPROF = bool_default(_OPTIONS["gprof"], false)
-- Enable static linking of stdlib
local STDLIB_STATIC = bool_default(_OPTIONS["stdlib_static"], false)
-- ///////////////////////////////////////////////////// --
solution "MwUtil"
configurations { "Debug", "Release" }
targetdir(BIN_DIR)
objdir (OBJ_DIR)
flags { "ExtraWarnings", "FatalWarnings", "NoPCH" }
if STDLIB_STATIC then
flags { "StaticRuntime" }
end
if GPROF then
configuration "GMake"
buildoptions { "-pg" }
linkoptions { "-pg" }
end
configuration "Debug"
flags { "Symbols" }
configuration "Release"
flags { "Optimize" }
defines { "NDEBUG" }
-- ///////////////////////////////////////////////////// --
project "Test"
language "C++"
location (MAKE_DIR)
kind "ConsoleApp"
BOOST_LIBS = { "unit_test_framework" }
files { "test/Mw/**.cpp" }
includedirs { "src" }
use_Boost ( BOOST_LIBS )