-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrenderer_bgfx.lua
136 lines (109 loc) · 3.45 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
function createRendererProject(engine, bgfxPath, bxPath, rendererPath, sdlIncludeDir, sdlLib32, sdlLib64)
project "renderer_bgfx"
kind "SharedLib"
language "C++"
rtti "Off"
targetprefix ""
defines
{
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
"__STDC_LIMIT_MACROS",
"BGFX_CONFIG_RENDERER_OPENGL=31",
"USE_RENDERER_DLOPEN"
}
files
{
path.join(bgfxPath, "src/amalgamated.cpp"),
path.join(rendererPath, "code/math/*.cpp"),
path.join(rendererPath, "code/math/*.h"),
path.join(rendererPath, "code/renderer_bgfx/*.cpp"),
path.join(rendererPath, "code/renderer_bgfx/*.h"),
path.join(rendererPath, "shaders/*.sc"),
path.join(rendererPath, "shaders/*.sh"),
}
includedirs
{
path.join(bxPath, "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.is("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 "gmake"
buildoptions "-std=c++11"
configuration "linux"
buildoptions
{
linuxSdlCflags,
"-std=c++11"
}
defines(linuxArchDefine)
links
{
"dl",
"GL",
"pthread",
"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"
defines { "BGFX_CONFIG_RENDERER_DIRECT3D11=1", "BGFX_CONFIG_RENDERER_DIRECT3D12=1" }
includedirs(sdlIncludeDir)
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 { "windows", "x86" }
links(sdlLib32)
configuration { "windows", "x86_64" }
links(sdlLib64)
configuration {}
filter("files:not " .. path.getrelative(path.getabsolute("."), path.join(rendererPath, "code/renderer_bgfx/*.cpp")))
flags "NoPCH"
filter {}
end