[host] compile NvFBC on mingw

This commit is contained in:
arcnmx 2017-12-16 13:19:34 -05:00 committed by Geoffrey McRae
parent 3784e9c06f
commit e6c6c16d56
3 changed files with 13 additions and 7 deletions

View File

@ -65,7 +65,7 @@ bool NvFBC::Initialize(CaptureOptions * options)
m_hDLL = LoadLibraryA(nvfbc.c_str()); m_hDLL = LoadLibraryA(nvfbc.c_str());
if (!m_hDLL) if (!m_hDLL)
{ {
DEBUG_ERROR("Failed to load the NvFBC library: %d - %s", GetLastError(), nvfbc.c_str()); DEBUG_ERROR("Failed to load the NvFBC library: %d - %s", (int)GetLastError(), nvfbc.c_str());
return false; return false;
} }

View File

@ -16,7 +16,6 @@ LD = $(CXX)
BUILD ?= .build BUILD ?= .build
BIN ?= bin BIN ?= bin
#CFLAGS += -DCONFIG_CAPTURE_NVFBC=1
CFLAGS += -DBUILD_VERSION='"$(shell git describe --always --long --dirty --abbrev=10 --tags)"' CFLAGS += -DBUILD_VERSION='"$(shell git describe --always --long --dirty --abbrev=10 --tags)"'
@ -26,6 +25,11 @@ OBJS = main.o \
Service.o \ Service.o \
Capture/DXGI.o Capture/DXGI.o
ifeq ($(CONFIG_CAPTURE_NVFBC),1)
CFLAGS += -DCONFIG_CAPTURE_NVFBC=1 -I../vendor
OBJS += Capture/NvFBC.o
endif
BUILD_OBJS = $(foreach obj,$(OBJS),$(BUILD)/$(obj)) BUILD_OBJS = $(foreach obj,$(OBJS),$(BUILD)/$(obj))
all: $(BIN)/$(BINARY) all: $(BIN)/$(BINARY)

View File

@ -23,8 +23,11 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <inttypes.h> #include <inttypes.h>
#include <tmmintrin.h> #include <tmmintrin.h>
#include "common\debug.h" #include "common/debug.h"
#if __MINGW32__
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
class Util class Util
{ {
@ -33,16 +36,15 @@ public:
{ {
std::string defaultPath; std::string defaultPath;
size_t pathSize; const char *libPath = getenv("SystemRoot");
char *libPath;
if (_dupenv_s(&libPath, &pathSize, "SystemRoot") != 0) if (!libPath)
{ {
DEBUG_ERROR("Unable to get the SystemRoot environment variable"); DEBUG_ERROR("Unable to get the SystemRoot environment variable");
return defaultPath; return defaultPath;
} }
if (!pathSize) if (!strlen(libPath))
{ {
DEBUG_ERROR("The SystemRoot environment variable is not set"); DEBUG_ERROR("The SystemRoot environment variable is not set");
return defaultPath; return defaultPath;