Fixed compile and linking under mingw environment

This commit is contained in:
Miodrag Milanovic 2014-12-24 11:46:49 +01:00
parent 857a2b18f1
commit 3df7041cba
4 changed files with 25 additions and 14 deletions

View File

@ -13,6 +13,13 @@ function bgfxProject(_name, _kind, _defines)
defines {
"BGFX_SHARED_LIB_BUILD=1",
}
configuration { "mingw*" }
linkoptions {
"-shared",
}
links {
"gdi32",
}
end
includedirs {

View File

@ -27,6 +27,11 @@ project ("example-common")
}
end
configuration { "mingw* or vs2008" }
includedirs {
"$(DXSDK_DIR)/include",
}
configuration { "xcode4" }
includedirs {
BX_DIR .. "include/compat/osx",

View File

@ -171,11 +171,6 @@ function exampleProject(_name)
targetdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/bin/" .. _name)
objdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/obj/" .. _name)
configuration { "mingw*" }
links {
"dxguid",
}
configuration { "mingw-clang" }
kind "ConsoleApp"

View File

@ -338,6 +338,10 @@ namespace bgfx
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration");
static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } };
static const GUID IID_IDXGIDevice = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } };
static const GUID IID_IDXGIAdapter = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } };
template <typename Ty>
static BX_NO_INLINE void setDebugObjectName(Ty* _interface, const char* _format, ...)
@ -487,7 +491,7 @@ namespace bgfx
hr = CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void**)&factory);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create DXGI factory.");
#else
hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&factory);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create DXGI factory.");
#endif // BX_PLATFORM_WINRT
@ -567,10 +571,10 @@ namespace bgfx
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
IDXGIDevice* device;
hr = m_device->QueryInterface(__uuidof(IDXGIDevice), (void**)&device);
hr = m_device->QueryInterface(IID_IDXGIDevice, (void**)&device);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
hr = device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter);
hr = device->GetParent(IID_IDXGIAdapter, (void**)&adapter);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
// GPA increases device ref count.
@ -609,7 +613,7 @@ namespace bgfx
, &m_swapChain
);
#else
hr = adapter->GetParent(__uuidof(IDXGIFactory), (void**)&m_factory);
hr = adapter->GetParent(IID_IDXGIFactory, (void**)&m_factory);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
DX_RELEASE(adapter, 2);
@ -913,7 +917,7 @@ namespace bgfx
void saveScreenShot(const char* _filePath) BX_OVERRIDE
{
ID3D11Texture2D* backBuffer;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer));
D3D11_TEXTURE2D_DESC backBufferDesc;
backBuffer->GetDesc(&backBufferDesc);
@ -1086,7 +1090,7 @@ namespace bgfx
void postReset()
{
ID3D11Texture2D* color;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&color) );
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color));
DX_CHECK(m_device->CreateRenderTargetView(color, NULL, &m_backBufferColor) );
DX_RELEASE(color, 0);
@ -1843,7 +1847,7 @@ namespace bgfx
if (m_flags&BGFX_RESET_CAPTURE)
{
ID3D11Texture2D* backBuffer;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer));
D3D11_TEXTURE2D_DESC backBufferDesc;
backBuffer->GetDesc(&backBufferDesc);
@ -1889,7 +1893,7 @@ namespace bgfx
if (NULL != m_captureTexture)
{
ID3D11Texture2D* backBuffer;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer));
if (NULL == m_captureResolve)
{
@ -2884,7 +2888,7 @@ namespace bgfx
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain.");
ID3D11Resource* ptr;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&ptr) );
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&ptr));
DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(ptr, NULL, &m_rtv[0]) );
DX_RELEASE(ptr, 0);
m_srv[0] = NULL;