[build] Fix compilation on MSVC (#505)

* [build] do not use shared_library/objects property with MSVC

* [util] use ./com/com_include.h instead of windef.h

It is required for Windows 10 SDK.

* [util] store thread procedure lambda in std::function

* [dxgi] fix annoying MSVC warning

warning C4099: 'IDXGIVkInteropDevice': type name first seen using 'class' now seen using 'struct'
This commit is contained in:
Mikhail Paulyshka 2018-07-21 13:43:33 +03:00 committed by Philip Rebohle
parent c5a010a48c
commit f38ee85a39
6 changed files with 18 additions and 25 deletions

View File

@ -7,8 +7,10 @@ add_project_arguments('-DNOMINMAX', language : 'cpp')
dxvk_compiler = meson.get_compiler('cpp')
if dxvk_compiler.get_id() == 'msvc'
dxvk_cpp_std='c++latest'
dxvk_msvc=true
else
dxvk_cpp_std='c++1z'
dxvk_msvc=false
endif
if dxvk_compiler.get_id() == 'msvc'

View File

@ -34,7 +34,8 @@ d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src,
dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
objects : 'd3d11'+def_spec_ext,
objects : not dxvk_msvc ? 'd3d11'+def_spec_ext : [],
vs_module_defs : 'd3d11'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
d3d11_dep = declare_dependency(

View File

@ -13,7 +13,7 @@ namespace dxvk {
class DxvkImage;
}
class IDXGIVkInteropDevice;
struct IDXGIVkInteropDevice;
/**
* \brief Private DXGI device interface

View File

@ -22,7 +22,8 @@ dxgi_dll = shared_library('dxgi'+dll_ext, dxgi_src, glsl_generator.process(dxgi_
dependencies : [ dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
objects : 'dxgi'+def_spec_ext,
vs_module_defs : 'dxgi'+def_spec_ext,
objects : not dxvk_msvc ? 'dxgi'+def_spec_ext : [],
override_options : ['cpp_std='+dxvk_cpp_std])
dxgi_dep = declare_dependency(

View File

@ -2,8 +2,8 @@
#include "util_error.h"
#include <windef.h>
#include <winbase.h>
#include <functional>
#include "./com/com_include.h"
/*
* This is needed mostly for winelib builds. Wine needs to setup each thread that
@ -16,29 +16,18 @@ namespace dxvk {
class thread {
private:
HANDLE m_handle;
std::function<void()> proc;
template<typename T>
class thread_proc {
private:
T proc;
public:
thread_proc(T &proc) : proc(proc) {}
static DWORD WINAPI nativeProc(void *arg) {
thread_proc *proc = reinterpret_cast<thread_proc*>(arg);
proc->proc();
delete proc;
return 0;
}
};
static DWORD WINAPI nativeProc(void *arg) {
auto* proc = reinterpret_cast<thread*>(arg);
proc->proc();
return 0;
}
public:
template<class T>
explicit thread(T &&func) {
thread_proc<T> *proc = new thread_proc<T>(func);
m_handle = ::CreateThread(nullptr, 0, thread_proc<T>::nativeProc, proc, 0, nullptr);
explicit thread(std::function<void()> func) : proc(func) {
m_handle = ::CreateThread(nullptr, 0, thread::nativeProc, this, 0, nullptr);
if (!m_handle) {
delete proc;
throw DxvkError("Failed to create thread");
}
}

View File

@ -2,7 +2,7 @@
#include <string>
#include <sstream>
#include <windef.h>
#include "./com/com_include.h"
namespace dxvk::str {