Mercurial > sdl-ios-xcode
view test/automated/testsdl.c @ 4426:1bceff8f008f
Fixed bug #943
Ozkan Sezer 2010-02-06 12:31:06 PST
Hi:
Here are some small fixes for compiling SDL against mingw-w64.
(see http://mingw-w64.sourceforge.net/ . Despite the name, it
supports both win32 and win64.)
src/audio/windx5/directx.h and src/video/windx5/directx.h (both
SDL-1.2 and SDL-1.3.) I get compilation errors about some union
not having a member named u1 and alike, because of other system
headers being included before this one and them already defining
DUMMYUNIONNAME and stuff. This header probably assumes that those
stuff are defined in windef.h, but mingw-w64 headers define them
in _mingw.h. Easily fixed by moving NONAMELESSUNION definition to
the top of the file.
src/thread/win32/SDL_systhread.c (both SDL-1.2 and SDL-1.3.) :
The __GNUC__ case for pfnSDL_CurrentBeginThread is 32-bit centric
because _beginthreadex returns uintptr_t, not unsigned long which
is 32 bits in win64. Changing the return type to uintptr_t fixes
it.
video/SDL_blit.h (and configure.in) (SDL-1.3-only) : MinGW-w64
uses msvcrt version of _aligned_malloc and _aligned_free and
they are defined in intrin.h (similar to VC). Adding proper
ifdefs fixes it. (Notes about macros to check: __MINGW32__ is
defined for both mingw.org and for mingw-w64 for both win32 and
win64, __MINGW64__ is only defined for _WIN64, so __MINGW64__
can't be used to detect mingw-w64: including _mingw.h and then
checking for __MINGW64_VERSION_MAJOR does the trick.)
SDL_win32video.h (SDL-1.3-only) : Tweaked the VINWER definition
and location in order to avoid multiple redefinition warnings.
Hope these are useful. Thanks.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 10 Mar 2010 15:02:58 +0000 |
parents | 1a99755b3b04 |
children | c84712de8433 |
line wrap: on
line source
/* * SDL test suite framework code. * * Written by Edgar Simo "bobbens" * * Released under Public Domain. */ #include "SDL.h" #include "SDL_at.h" #include "platform/platform.h" #include "rwops/rwops.h" #include "rect/rect.h" #include "surface/surface.h" #include "render/render.h" #include "audio/audio.h" #if defined(WIN32) #define NO_GETOPT #endif #if defined(__QNXNTO__) #define NO_GETOPT_LONG 1 #endif /* __QNXNTO__ */ #include <stdio.h> /* printf */ #include <stdlib.h> /* exit */ #ifndef NO_GETOPT #include <unistd.h> /* getopt */ #if !defined(NO_GETOPT_LONG) #include <getopt.h> /* getopt_long */ #endif /* !NO_GETOPT_LONG */ #endif /* !NO_GETOPT */ /* * Tests to run. */ static int run_manual = 0; /**< Run manual tests. */ /* Manual. */ /* Automatic. */ static int run_platform = 1; /**< Run platform tests. */ static int run_rwops = 1; /**< Run RWops tests. */ static int run_rect = 1; /**< Run rect tests. */ static int run_surface = 1; /**< Run surface tests. */ static int run_render = 1; /**< Run render tests. */ static int run_audio = 1; /**< Run audio tests. */ /* * Prototypes. */ static void print_usage( const char *name ); static void parse_options( int argc, char *argv[] ); /** * @brief Displays program usage. */ static void print_usage( const char *name ) { printf("Usage: %s [OPTIONS]\n", name); printf("Options are:\n"); printf(" -m, --manual enables tests that require user interaction\n"); printf(" --noplatform do not run the platform tests\n"); printf(" --norwops do not run the rwops tests\n"); printf(" --norect do not run the rect tests\n"); printf(" --nosurface do not run the surface tests\n"); printf(" --norender do not run the render tests\n"); printf(" --noaudio do not run the audio tests\n"); printf(" -v, --verbose increases verbosity level by 1 for each -v\n"); printf(" -q, --quiet only displays errors\n"); printf(" -h, --help display this message and exit\n"); } /** * @brief Handles the options. */ static void parse_options( int argc, char *argv[] ) { int i; for (i = 1; i < argc; ++i) { const char *arg = argv[i]; if (SDL_strcmp(arg, "-m") == 0 || SDL_strcmp(arg, "--manual") == 0) { run_manual = 1; continue; } if (SDL_strcmp(arg, "-v") == 0 || SDL_strcmp(arg, "--verbose") == 0) { int level; SDL_ATgeti( SDL_AT_VERBOSE, &level ); SDL_ATseti( SDL_AT_VERBOSE, level+1 ); continue; } if (SDL_strcmp(arg, "-q") == 0 || SDL_strcmp(arg, "--quiet") == 0) { SDL_ATseti( SDL_AT_QUIET, 1 ); SDL_setenv("SDL_ASSERT", "abort", 0); continue; } if (SDL_strcmp(arg, "--noplatform") == 0) { run_platform = 0; continue; } if (SDL_strcmp(arg, "--norwops") == 0) { run_rwops = 0; continue; } if (SDL_strcmp(arg, "--norect") == 0) { run_rect = 0; continue; } if (SDL_strcmp(arg, "--nosurface") == 0) { run_surface = 0; continue; } if (SDL_strcmp(arg, "--norender") == 0) { run_render = 0; continue; } if (SDL_strcmp(arg, "--noaudio") == 0) { run_audio = 0; continue; } /* Print help and exit! */ print_usage( argv[0] ); exit(EXIT_FAILURE); } } /** * @brief Main entry point. */ int main( int argc, char *argv[] ) { int failed; int rev; SDL_version ver; /* Get options. */ parse_options( argc, argv ); /* Defaults. */ failed = 0; /* Print some text if verbose. */ SDL_GetVersion( &ver ); rev = SDL_GetRevision(); SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n", ver.major, ver.minor, ver.patch, rev ); /* Automatic tests. */ if (run_platform) failed += test_platform(); if (run_rwops) failed += test_rwops(); if (run_rect) failed += test_rect(); if (run_surface) failed += test_surface(); if (run_render) failed += test_render(); if (run_audio) failed += test_audio(); /* Manual tests. */ if (run_manual) { } /* Display more information if failed. */ if (failed > 0) { SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n", ver.major, ver.minor, ver.patch, rev ); SDL_ATprintErr( "System is running %s and is %s endian\n", SDL_GetPlatform(), #if SDL_BYTEORDER == SDL_LIL_ENDIAN "little" #else "big" #endif ); } return failed; }