-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake4.lua
101 lines (78 loc) · 2.61 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
local trans = path.translate;
local join = function(a,b) return trans(path.join(a,b)) end;
local dest = "game";
local src = "src";
local cdir = trans(path.getabsolute(os.getcwd()));
local destdir = join(cdir, dest);
local srcdir = join(cdir, src);
local newdir;
local copy;
if (os.get() == "windows") then
copy = "COPY /Y";
--newdir = "MKDIR";
newdir = function(path) return "IF NOT EXIST \"" .. path .. "\" MKDIR \"" .. path .. '"' end
else
copy = "cp -f";
newdir = "mkdir -p";
end
local function docmd(cmd, ...)
if (type(cmd) == "function") then
return cmd(...);
else
return cmd .. " \"" .. table.concat({...}, '" "') .. '"';
end
end
if (_ACTION == "vs2008" or _ACTION == "vs2005" or _ACTION == "vs2003" or _ACTION == "vs2002") then
error("This project needs VS2010 or later!", 0);
end
-- make /game
if (not os.isdir("game")) then
os.mkdir("game");
end
solution "Wulf2012"
configurations { "Debug", "Release" }
-- FORCE windows to be Win32: GLFW2.X doesn't support Win64
-- if (os.get == "windows") then
-- platforms { "x32" }
-- end
location "Build"
project "WulfGame"
location "Build"
kind "ConsoleApp"
language "C++"
files {
src .. "/**.h", src .. "/**.cpp";
src .. "/OpenGL/stb_image.cc"; -- Force C++ to avoid a mildly annoying issue with CFLAGS
src .. "/OpenGL/Shaders/*";
}
vpaths { [""] = src }
includedirs { src }
debugdir(dest)
targetdir(dest)
targetname("WulfGame")
prebuildcommands {
-- mkdir game/shaders
docmd(newdir, join(destdir, "shaders"));
}
postbuildcommands {
-- cp src/OpenGL/Shaders/* game/shaders
docmd(copy, join(srcdir, "OpenGL/Shaders/*"), join(destdir, "shaders"));
}
flags { "FatalWarnings" }
links { "glfw", "physfs" }
configuration "Debug"
defines { "DEBUG" }
flags { "Symbols" }
configuration "Release"
defines { "NDEBUG" }
flags { "Optimise" }
configuration "windows"
defines { "_CRT_SECURE_NO_WARNINGS" }
links { "opengl32", "glew32" }
configuration "linux"
buildoptions { "-std=c++0x", "-pedantic" }
links { "GL", "GLEW" }
configuration "macosx"
--links { "OpenGL.Framework", "CoreFoundation.Framework" }
linkoptions { "-stdlib=libc++", "-framework OpenGL", "-framework CoreFoundation" }
buildoptions { "-std=c++11", "-stdlib=libc++" }