-
Notifications
You must be signed in to change notification settings - Fork 35
/
renderer_bgfx.lua
158 lines (131 loc) · 4.08 KB
/
renderer_bgfx.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
function rendererProject(engine, rendererPath)
project "renderer_bgfx"
kind "SharedLib"
language "C++"
cppdialect "C++14"
rtti "Off"
targetprefix ""
defines
{
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
"__STDC_LIMIT_MACROS",
"BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION=32",
"BGFX_CONFIG_RENDERDOC_LOG_FILEPATH=\"ioq3-renderer-bgfx\"",
"BIMG_DECODE_ENABLE=0",
"USE_RENDERER_DLOPEN"
}
local bxPath = path.join(rendererPath, "code/bx")
local bimgPath = path.join(rendererPath, "code/bimg")
local bgfxPath = path.join(rendererPath, "code/bgfx")
files
{
path.join(bxPath, "src/*.cpp"),
path.join(bimgPath, "src/*.cpp"),
path.join(bgfxPath, "src/*.cpp"),
path.join(rendererPath, "code/math/*.cpp"),
path.join(rendererPath, "code/renderer_bgfx/*.cpp")
}
configuration "vs*"
files
{
path.join(bxPath, "include/bx/*.h"),
path.join(bxPath, "include/bx/inline/*.inl"),
path.join(bimgPath, "include/bimg/*.h"),
path.join(bimgPath, "src/*.h"),
path.join(bgfxPath, "include/bgfx/*.h"),
path.join(bgfxPath, "src/*.h"),
path.join(rendererPath, "code/math/*.h"),
path.join(rendererPath, "code/renderer_bgfx/*.h"),
path.join(rendererPath, "shaders/*.sc"),
path.join(rendererPath, "shaders/*.sh")
}
configuration {}
excludes
{
path.join(bxPath, "src/amalgamated.cpp"),
path.join(bxPath, "src/crtnone.cpp"),
path.join(bgfxPath, "src/amalgamated.cpp")
}
includedirs
{
path.join(bxPath, "include"),
path.join(bxPath, "3rdparty"),
path.join(bimgPath, "include"),
path.join(bimgPath, "3rdparty"),
path.join(bimgPath, "3rdparty/nvtt"),
path.join(bimgPath, "3rdparty/iqa/include"),
path.join(bgfxPath, "include"),
path.join(bgfxPath, "3rdparty"),
path.join(bgfxPath, "3rdparty/dxsdk/include"),
path.join(bgfxPath, "3rdparty/khronos"),
path.join(rendererPath, "code/stb")
}
vpaths
{
["shaders"] = path.join(rendererPath, "shaders/*.*"),
["*"] = path.join(rendererPath, "code")
}
-- Workaround os.outputof always being evaluated, even if in a configuration block that doesn't apply to the current environment.
local linuxSdlCflags = nil
local linuxArchDefine = nil
if os.ishost("linux") then
linuxSdlCflags = os.outputof("pkg-config --silence-errors --cflags sdl2")
linuxArchDefine = "ARCH_STRING=" .. os.outputof("uname -m")
end
if engine == "ioq3" then
defines "ENGINE_IOQ3"
configuration "x86"
targetname "renderer_bgfx_x86"
configuration "x86_64"
targetname "renderer_bgfx_x86_64"
elseif engine == "iortcw" then
defines "ENGINE_IORTCW"
configuration "x86"
targetname "renderer_sp_bgfx_x86"
configuration "x86_64"
targetname "renderer_sp_bgfx_x86_64"
end
configuration "Debug"
defines "BGFX_CONFIG_DEBUG=1"
configuration "linux"
buildoptions
{
linuxSdlCflags
}
defines(linuxArchDefine)
links
{
"dl",
"GL",
"pthread",
"rt",
"SDL2",
"X11"
}
linkoptions "-Wl,--no-undefined"
configuration "vs*"
buildoptions { "/wd\"4316\"", "/wd\"4351\"" } -- Silence some warnings
includedirs(path.join(bxPath, "include/compat/msvc"))
pchheader "Precompiled.h"
pchsource(path.join(rendererPath, "code/renderer_bgfx/Precompiled.cpp"))
configuration "windows"
links { "d3dcompiler", "gdi32", "OpenGL32", "psapi" }
configuration { "windows", "gmake" }
includedirs(path.join(bxPath, "include/compat/mingw"))
linkoptions { "-static-libgcc", "-static-libstdc++", "-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic" }
configuration { "windows", "gmake", "mingw=mingw" }
gccprefix "mingw32-"
configuration { "windows", "gmake", "mingw=mingw-pc", "x86" }
gccprefix "i686-pc-mingw32-"
configuration { "windows", "gmake", "mingw=mingw-w64", "x86" }
gccprefix "i686-w64-mingw32-"
configuration { "windows", "gmake", "mingw=mingw-pc", "x86_64" }
gccprefix "x86_64-pc-mingw32-"
configuration { "windows", "gmake", "mingw=mingw-w64", "x86_64" }
gccprefix "x86_64-w64-mingw32-"
configuration {}
filter("files:not " .. path.getrelative(path.getabsolute("."), path.join(rendererPath, "code/renderer_bgfx/*.cpp")))
flags "NoPCH"
filter {}
end