Fixed build errors on Windows.

This commit is contained in:
Pietro Gagliardi 2019-05-04 21:47:04 -04:00
parent 98093ed46e
commit ee3e587ddc
4 changed files with 27 additions and 13 deletions

View File

@ -4,8 +4,6 @@
#include "lib/thread.h" #include "lib/thread.h"
#include "test.h" #include "test.h"
// TODO fix up the formatting of testing.c so we can use newlines on the got/want stuff
#define errInvalidOptions "options parameter to uiInit() must be NULL" #define errInvalidOptions "options parameter to uiInit() must be NULL"
#define errAlreadyInitialized "libui already initialized" #define errAlreadyInitialized "libui already initialized"

View File

@ -22,15 +22,7 @@ libui_test_deps += [
required: true), required: true),
] ]
if libui_OS == 'windows' if libui_OS == 'windows'
libui_test_manifest = 'test.manifest' # static mode already gives us these dependencies
if libui_mode == 'static'
libui_test_manifest = 'test.static.manifest'
endif
libui_test_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_test_manifest]),
]
if libui_mode != 'static' if libui_mode != 'static'
libui_test_deps += [ libui_test_deps += [
meson.get_compiler('c').find_library('kernel32', meson.get_compiler('c').find_library('kernel32',

View File

@ -1,4 +1,8 @@
// 27 february 2018 // 27 february 2018
// TODO get rid of the need for this (it temporarily silences noise so I can find actual build issues)
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <setjmp.h> #include <setjmp.h>
@ -6,6 +10,14 @@
#include "timer.h" #include "timer.h"
#include "testing.h" #include "testing.h"
// goddamnit VS2013
#ifdef _MSC_VER
#define testingprivSnprintf _snprintf
#else
#define testingprivSnprint snprintf
#endif
// and yes, vsnprintf() IS properly provided, so wtf
void testingprivInternalError(const char *fmt, ...) void testingprivInternalError(const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -297,14 +309,14 @@ void testingprivTLogvfFull(testingT *t, const char *file, long line, const char
int n, n2; int n, n2;
// TODO extract filename from file // TODO extract filename from file
n = snprintf(NULL, 0, "%s:%ld: ", file, line); n = testingprivSnprintf(NULL, 0, "%s:%ld: ", file, line);
// TODO handle n < 0 case // TODO handle n < 0 case
va_copy(ap2, ap); va_copy(ap2, ap);
n2 = vsnprintf(NULL, 0, format, ap2); n2 = vsnprintf(NULL, 0, format, ap2);
// TODO handle n2 < 0 case // TODO handle n2 < 0 case
va_end(ap2); va_end(ap2);
buf = testingprivNewArray(char, n + n2 + 1); buf = testingprivNewArray(char, n + n2 + 1);
snprintf(buf, n + 1, "%s:%ld: ", file, line); testingprivSnprintf(buf, n + 1, "%s:%ld: ", file, line);
vsnprintf(buf + n, n2 + 1, format, ap); vsnprintf(buf + n, n2 + 1, format, ap);
printfIndented(t->indent, "%s", buf); printfIndented(t->indent, "%s", buf);
testingprivFree(buf); testingprivFree(buf);

View File

@ -5,6 +5,18 @@ libui_test_sources = [
'main.c', 'main.c',
] ]
if libui_OS == 'windows'
libui_test_manifest = 'test.manifest'
if libui_mode == 'static'
libui_test_manifest = 'test.static.manifest'
endif
libui_test_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_test_manifest]),
]
endif
libui_test_deps = [] libui_test_deps = []
subdir('lib') subdir('lib')