win32: request UTF-16 API variants, Vista+ APIs, and COM C macros

Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
This commit is contained in:
wm4 2015-01-07 21:33:14 +01:00
parent 5f398831d2
commit f61b8b312d
13 changed files with 11 additions and 28 deletions

View File

@ -228,7 +228,7 @@ static int LoadDirectSound(struct ao *ao)
struct priv *p = ao->priv;
// initialize directsound
p->hdsound_dll = LoadLibrary("DSOUND.DLL");
p->hdsound_dll = LoadLibrary(L"DSOUND.DLL");
if (p->hdsound_dll == NULL) {
MP_ERR(ao, "cannot load DSOUND.DLL\n");
return 0;

View File

@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#define COBJMACROS 1
#define _WIN32_WINNT 0x600
#include <stdlib.h>
#include <inttypes.h>
#include <process.h>

View File

@ -20,9 +20,6 @@
#ifndef MP_AO_WASAPI_H_
#define MP_AO_WASAPI_H_
#define COBJMACROS 1
#define _WIN32_WINNT 0x600
#include <audioclient.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>

View File

@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#define COBJMACROS 1
#define _WIN32_WINNT 0x600
#include <initguid.h>
#include <audioclient.h>
#include <endpointvolume.h>

View File

@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#define COBJMACROS 1
#define _WIN32_WINNT 0x600
#include <math.h>
#include <libavutil/common.h>
#include <initguid.h>

View File

@ -15,7 +15,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <string.h>

View File

@ -21,12 +21,7 @@
#include <windows.h>
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0600
#define DXVA2API_USE_BITFIELDS
#define COBJMACROS
#include <stdint.h>
@ -360,12 +355,12 @@ static int dxva2_init(struct lavc_ctx *s)
ctx->deviceHandle = INVALID_HANDLE_VALUE;
ctx->d3dlib = LoadLibrary("d3d9.dll");
ctx->d3dlib = LoadLibrary(L"d3d9.dll");
if (!ctx->d3dlib) {
MP_ERR(ctx, "Failed to load D3D9 library\n");
goto fail;
}
ctx->dxva2lib = LoadLibrary("dxva2.dll");
ctx->dxva2lib = LoadLibrary(L"dxva2.dll");
if (!ctx->dxva2lib) {
MP_ERR(ctx, "Failed to load DXVA2 library\n");
goto fail;

View File

@ -34,7 +34,7 @@
#ifdef _WIN32
# include <windows.h>
# define DLLOpen(name) LoadLibrary(name)
# define DLLOpen(name) LoadLibraryA(name)
# define DLLClose(handle) FreeLibrary(handle)
# define DLLSymbol(handle, name) ((void *)GetProcAddress(handle, name))
#else

View File

@ -81,7 +81,7 @@ static void *w32gpa(const GLubyte *procName)
void *res = wglGetProcAddress(procName);
if (res)
return res;
oglmod = GetModuleHandle("opengl32.dll");
oglmod = GetModuleHandle(L"opengl32.dll");
return GetProcAddress(oglmod, procName);
}

View File

@ -16,8 +16,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define COBJMACROS
#define _WIN32_WINNT 0x0600
#include <stdio.h>
#include <limits.h>
#include <pthread.h>

View File

@ -24,7 +24,7 @@ def check_pthreads(ctx, dependency_identifier):
h = ctx.path.find_node('osdep/win32/include').abspath()
# define IN_WINPTHREAD to workaround mingw stupidity (we never want it
# to define features specific to its own pthread stuff)
ctx.env.CFLAGS += ['-isystem', h, '-I', h, '-D_WIN32_WINNT=0x600', '-DIN_WINPTHREAD']
ctx.env.CFLAGS += ['-isystem', h, '-I', h, '-DIN_WINPTHREAD']
return True
if check_pthread_flag(ctx, dependency_identifier):
return True

View File

@ -47,11 +47,16 @@ def __add_clang_flags__(ctx):
"-Wno-tautological-compare",
"-Wno-tautological-constant-out-of-range-compare" ]
def __add_mswin_flags__(ctx):
ctx.env.CFLAGS += ['-D_WIN32_WINNT=0x600', '-DUNICODE', '-DCOBJMACROS']
def __add_mingw_flags__(ctx):
__add_mswin_flags__(ctx)
ctx.env.CFLAGS += ['-D__USE_MINGW_ANSI_STDIO=1']
ctx.env.LAST_LINKFLAGS += ['-mwindows']
def __add_cygwin_flags__(ctx):
__add_mswin_flags__(ctx)
ctx.env.CFLAGS += ['-mwin32']
ctx.env.CFLAGS += ['-U__STRICT_ANSI__']

View File

@ -1,5 +1,3 @@
#define COBJMACROS 1
#define _WIN32_WINNT 0x600
#include <malloc.h>
#include <stdlib.h>
#include <process.h>