bgfx/scripts/bgfx.lua

228 lines
4.8 KiB
Lua
Raw Normal View History

2013-05-17 19:39:08 -07:00
--
2017-01-01 00:18:41 -08:00
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
2016-01-01 00:11:04 -08:00
-- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
2013-05-17 19:39:08 -07:00
--
2016-10-04 22:48:59 -07:00
function filesexist(_srcPath, _dstPath, _files)
for _, file in ipairs(_files) do
file = path.getrelative(_srcPath, file)
local filePath = path.join(_dstPath, file)
if not os.isfile(filePath) then return false end
end
return true
end
2016-09-29 21:23:07 -07:00
function overridefiles(_srcPath, _dstPath, _files)
local remove = {}
local add = {}
for _, file in ipairs(_files) do
file = path.getrelative(_srcPath, file)
2016-10-04 22:48:59 -07:00
local filePath = path.join(_dstPath, file)
2016-09-30 20:03:16 -07:00
if not os.isfile(filePath) then return end
2016-09-29 21:23:07 -07:00
table.insert(remove, path.join(_srcPath, file))
table.insert(add, filePath)
end
removefiles {
remove,
}
files {
add,
}
end
2014-09-10 23:01:22 -07:00
function bgfxProject(_name, _kind, _defines)
2013-02-21 21:13:56 -08:00
2014-07-31 22:00:36 -07:00
project ("bgfx" .. _name)
2014-09-10 23:01:22 -07:00
uuid (os.uuid("bgfx" .. _name))
2014-07-31 22:00:36 -07:00
kind (_kind)
2013-02-21 21:13:56 -08:00
2014-07-31 22:00:36 -07:00
if _kind == "SharedLib" then
defines {
"BGFX_SHARED_LIB_BUILD=1",
}
2014-12-25 14:51:11 -08:00
2017-01-08 17:07:29 -08:00
links {
2017-04-03 22:42:27 -07:00
"bimg",
2017-01-08 17:07:29 -08:00
"bx",
}
2015-02-11 22:19:49 -08:00
configuration { "vs20* or mingw*" }
links {
"gdi32",
"psapi",
}
configuration { "mingw*" }
linkoptions {
"-shared",
}
2014-12-25 14:51:11 -08:00
configuration { "linux-*" }
2015-03-24 23:21:32 -07:00
buildoptions {
"-fPIC",
}
2014-12-25 14:51:11 -08:00
configuration {}
2014-07-31 22:00:36 -07:00
end
2013-02-21 21:13:56 -08:00
includedirs {
path.join(BGFX_DIR, "3rdparty"),
2015-08-19 18:33:56 -07:00
path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
2016-01-19 20:04:25 -08:00
path.join(BX_DIR, "include"),
2017-04-03 22:42:27 -07:00
path.join(BIMG_DIR, "include"),
2013-02-21 21:13:56 -08:00
}
2014-07-31 22:00:36 -07:00
defines {
2014-09-03 00:29:54 -07:00
_defines,
2013-02-21 21:13:56 -08:00
}
2017-01-08 15:15:22 -08:00
links {
"bx",
}
2015-03-24 23:21:32 -07:00
if _OPTIONS["with-glfw"] then
defines {
"BGFX_CONFIG_MULTITHREADED=0",
}
end
2014-10-19 21:29:27 -07:00
if _OPTIONS["with-ovr"] then
defines {
2016-04-05 19:32:27 -07:00
-- "BGFX_CONFIG_MULTITHREADED=0",
2014-10-19 21:29:27 -07:00
"BGFX_CONFIG_USE_OVR=1",
}
includedirs {
"$(OVR_DIR)/LibOVR/Include",
}
configuration { "x32" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) }
configuration { "x64" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) }
configuration { "x32 or x64" }
links { "libovr" }
configuration {}
2014-10-19 21:29:27 -07:00
end
2014-07-31 22:00:36 -07:00
configuration { "Debug" }
defines {
"BGFX_CONFIG_DEBUG=1",
}
2013-02-21 21:13:56 -08:00
2014-07-31 22:00:36 -07:00
configuration { "android*" }
links {
"EGL",
"GLESv2",
}
2013-02-21 21:13:56 -08:00
2015-09-22 15:19:39 -07:00
configuration { "winphone8* or winstore8*" }
linkoptions {
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
}
2015-09-22 15:19:39 -07:00
configuration { "*clang*" }
buildoptions {
"-Wno-microsoft-enum-value", -- enumerator value is not representable in the underlying type 'int'
"-Wno-microsoft-const-init", -- default initialization of an object of const type '' without a user-provided default constructor is a Microsoft extension
}
2014-07-31 22:00:36 -07:00
configuration { "osx" }
2015-10-20 21:15:28 -07:00
linkoptions {
"-framework Cocoa",
"-framework QuartzCore",
"-framework OpenGL",
"-weak_framework Metal",
"-weak_framework MetalKit",
2014-07-31 22:00:36 -07:00
}
2014-06-01 15:26:36 -07:00
2016-02-15 19:45:58 +01:00
configuration { "not nacl", "not linux-steamlink" }
2014-07-31 22:00:36 -07:00
includedirs {
--nacl has GLES2 headers modified...
2016-02-15 19:45:58 +01:00
--steamlink has EGL headers modified...
path.join(BGFX_DIR, "3rdparty/khronos"),
2014-07-31 22:00:36 -07:00
}
2014-06-01 15:26:36 -07:00
2016-02-15 19:45:58 +01:00
configuration { "linux-steamlink" }
defines {
"EGL_API_FB",
}
2014-07-31 22:00:36 -07:00
configuration {}
2014-06-01 15:26:36 -07:00
includedirs {
path.join(BGFX_DIR, "include"),
2014-06-01 15:26:36 -07:00
}
files {
path.join(BGFX_DIR, "include/**.h"),
path.join(BGFX_DIR, "src/**.cpp"),
path.join(BGFX_DIR, "src/**.h"),
2014-07-07 19:53:00 -07:00
}
removefiles {
path.join(BGFX_DIR, "src/**.bin.h"),
2014-06-01 15:26:36 -07:00
}
2016-09-29 21:23:07 -07:00
overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
path.join(BGFX_DIR, "src/renderer_gnm.cpp"),
path.join(BGFX_DIR, "src/renderer_gnm.h"),
})
if _OPTIONS["with-amalgamated"] then
excludes {
path.join(BGFX_DIR, "src/bgfx.cpp"),
2016-09-19 10:53:05 -07:00
path.join(BGFX_DIR, "src/debug_**.cpp"),
path.join(BGFX_DIR, "src/glcontext_**.cpp"),
path.join(BGFX_DIR, "src/image.cpp"),
2016-09-19 10:53:05 -07:00
path.join(BGFX_DIR, "src/hmd**.cpp"),
path.join(BGFX_DIR, "src/renderer_**.cpp"),
2016-09-22 22:16:54 -07:00
path.join(BGFX_DIR, "src/shader**.cpp"),
2016-09-19 10:53:05 -07:00
path.join(BGFX_DIR, "src/topology.cpp"),
path.join(BGFX_DIR, "src/vertexdecl.cpp"),
}
2015-06-19 17:34:01 -07:00
configuration { "xcode* or osx or ios*" }
2015-06-20 00:22:36 -07:00
files {
path.join(BGFX_DIR, "src/amalgamated.mm"),
}
2015-06-19 17:34:01 -07:00
excludes {
2016-09-19 10:53:05 -07:00
path.join(BGFX_DIR, "src/glcontext_**.mm"),
path.join(BGFX_DIR, "src/renderer_**.mm"),
2015-06-19 17:34:01 -07:00
path.join(BGFX_DIR, "src/amalgamated.cpp"),
}
2015-06-19 19:55:23 -07:00
2016-09-22 22:16:54 -07:00
configuration { "not (xcode* or osx or ios*)" }
excludes {
path.join(BGFX_DIR, "src/**.mm"),
}
2015-06-19 19:55:23 -07:00
configuration {}
else
configuration { "xcode* or osx or ios*" }
2015-06-19 17:34:01 -07:00
files {
2016-09-19 10:53:05 -07:00
path.join(BGFX_DIR, "src/glcontext_**.mm"),
path.join(BGFX_DIR, "src/renderer_**.mm"),
2015-06-19 17:34:01 -07:00
}
2015-06-19 19:55:23 -07:00
configuration {}
excludes {
2015-06-19 19:55:23 -07:00
path.join(BGFX_DIR, "src/amalgamated.**"),
}
end
2014-07-31 22:00:36 -07:00
configuration {}
2014-06-01 15:26:36 -07:00
2014-07-31 22:00:36 -07:00
copyLib()
end