MSW compatibility

This commit is contained in:
Martin Pulec
2014-10-16 17:34:12 +02:00
parent 7849d4fcbe
commit 67fbd9dbae
6 changed files with 46 additions and 4 deletions

View File

@@ -210,6 +210,9 @@ $(REFLECTOR_TARGET): $(OBJS) $(GENERATED_HEADERS) $(REFLECTOR_OBJS)
"$(NVCC)" $(NVCCFLAGS) $(INC) -c $< -o $@
%.cu.lib: %.cu $(ALL_INCLUDES)
"$(NVCC)" $(NVCCFLAGS) -DEXPORT_DLL_SYMBOLS $(INC) --shared $< -o $<.dll
ldgm-coding/ldgm-session-gpu.o: ldgm-coding/ldgm-session-gpu.cpp $(ALL_INCLUDES)
$(CXX) $(CXXFLAGS) -Isrc/cuda_wrapper -DEXPORT_DLL_SYMBOLS $(INC) -c $< -o $@
SPEEX_FLAGS=-Wno-sign-compare -Wno-unused-parameter -Wno-bad-function-cast -Wno-missing-prototypes -Wno-missing-declarations
src/audio/resample.o:

View File

@@ -2708,11 +2708,14 @@ if test $ldgm_gpu_req != no -a $FOUND_CUDA = yes
then
CUDA_MESSAGE
AC_DEFINE([HAVE_LDGM_GPU], [1], [Build with GPU accelerated LDGM])
LDGM_GPU_OBJS="ldgm-coding/ldgm-session-gpu.o ldgm-coding/gpu.cu.o src/rtp/ldgm_gpu.o"
LDGM_GPU_OBJS="ldgm-coding/ldgm-session-gpu.o ldgm-coding/gpu.$CU_SUFFIX src/rtp/ldgm_gpu.o"
if test $system = Windows; then
DLL_LIBS="$DLL_LIBS ldgm-coding/gpu.cu.dll"
fi
AC_SUBST(LDGM_GPU_LIB_TARGET, "lib/ultragrid/module_ldgm_gpu.so")
LIB_TARGETS="$LIB_TARGETS $LDGM_GPU_LIB_TARGET"
LIB_OBJS="$LIB_OBJS $LDGM_GPU_OBJS"
LDGM_GPU_LIBS=$JPEG_LIB
LDGM_GPU_LIBS=$CUDA_LIB
ldgm_gpu=yes
else
ldgm_gpu=no

View File

@@ -88,6 +88,16 @@ CUDA_DLL_API int cuda_wrapper_free(void *buffer)
return map_cuda_error(cudaFree(buffer));
}
CUDA_DLL_API int cuda_wrapper_free_host(void *buffer)
{
return map_cuda_error(cudaFreeHost(buffer));
}
CUDA_DLL_API int cuda_wrapper_host_alloc(void **pHost, size_t size, unsigned int flags)
{
return map_cuda_error(cudaHostAlloc(pHost, size, flags));
}
CUDA_DLL_API int cuda_wrapper_malloc(void **buffer, size_t data_len)
{
return map_cuda_error(cudaMalloc(buffer, data_len));
@@ -111,6 +121,16 @@ CUDA_DLL_API const char *cuda_wrapper_last_error_string(void)
return cudaGetErrorString(cudaGetLastError());
}
CUDA_DLL_API int cuda_wrapper_get_last_error(void)
{
return map_cuda_error(cudaGetLastError());
}
CUDA_DLL_API const char *cuda_wrapper_get_error_string(int error)
{
return "not implemented";
}
CUDA_DLL_API int cuda_wrapper_set_device(int index)
{
return map_cuda_error(

View File

@@ -67,12 +67,16 @@ extern "C" {
typedef void *cuda_wrapper_stream_t;
CUDA_DLL_API int cuda_wrapper_free(void *buffer);
CUDA_DLL_API int cuda_wrapper_free_host(void *buffer);
CUDA_DLL_API int cuda_wrapper_host_alloc(void **pHost, size_t size, unsigned int flags);
CUDA_DLL_API int cuda_wrapper_malloc(void **buffer, size_t data_len);
CUDA_DLL_API int cuda_wrapper_malloc_host(void **buffer, size_t data_len);
CUDA_DLL_API int cuda_wrapper_memcpy(void *dst, const void *src,
size_t count, int kind);
CUDA_DLL_API const char *cuda_wrapper_last_error_string(void);
CUDA_DLL_API int cuda_wrapper_set_device(int index);
CUDA_DLL_API int cuda_wrapper_get_last_error(void);
CUDA_DLL_API const char * cuda_wrapper_get_error_string(int error);
#ifdef __cplusplus
}

View File

@@ -168,13 +168,18 @@ static struct item *qinit(int qsize)
return queue;
}
#ifdef _WIN32
typedef char sockopt_t;
#else
typedef void sockopt_t;
#endif
static int buffer_size(int sock, int optname, int size)
{
socklen_t len = sizeof(int);
if (setsockopt(sock, SOL_SOCKET, optname, (void *) &size, len)
|| getsockopt(sock, SOL_SOCKET, optname, (void *) &size, &len)) {
if (setsockopt(sock, SOL_SOCKET, optname, (const sockopt_t *) &size, len)
|| getsockopt(sock, SOL_SOCKET, optname, (sockopt_t *) &size, &len)) {
perror("[sg]etsockopt()");
return -1;
}

View File

@@ -41,9 +41,11 @@
#include "config_win32.h"
#endif // HAVE_CONFIG_H
#ifdef BUILD_LIBRARIES
#include <dlfcn.h>
#include <glob.h>
#include <libgen.h>
#endif
#include <iostream>
#include <map>
@@ -85,6 +87,7 @@ void open_all(const char *pattern) {
void *open_library(const char *name)
{
#ifdef BUILD_LIBRARIES
void *handle = NULL;
struct stat buf;
char kLibName[128];
@@ -125,6 +128,10 @@ void *open_library(const char *name)
}
return handle;
#else
UNUSED(name);
return NULL;
#endif
}
static map<enum library_class, map<string, pair<void *, int>>> *libraries = nullptr;