mirror of https://github.com/encounter/SDL.git
os/2 optionally builds against libiconv.
This commit is contained in:
parent
b20484e803
commit
70c5e91d0f
13
Makefile.os2
13
Makefile.os2
|
@ -1,10 +1,16 @@
|
||||||
# Open Watcom makefile to build SDL2.dll for OS/2
|
# Open Watcom makefile to build SDL2.dll for OS/2
|
||||||
# wmake -f Makefile.os2
|
# wmake -f Makefile.os2
|
||||||
|
#
|
||||||
|
# If you have libiconv installed, you can compile against it
|
||||||
|
# by specifying LIBICONV=1, e.g.:
|
||||||
|
# wmake -f Makefile.os2 LIBICONV=1
|
||||||
|
|
||||||
LIBNAME = SDL2
|
LIBNAME = SDL2
|
||||||
VERSION = 2.0.19
|
VERSION = 2.0.19
|
||||||
DESCRIPTION = Simple DirectMedia Layer 2
|
DESCRIPTION = Simple DirectMedia Layer 2
|
||||||
|
|
||||||
|
LIBICONV=0
|
||||||
|
|
||||||
LIBHOME = .
|
LIBHOME = .
|
||||||
DLLFILE = $(LIBHOME)/$(LIBNAME).dll
|
DLLFILE = $(LIBHOME)/$(LIBNAME).dll
|
||||||
LIBFILE = $(LIBHOME)/$(LIBNAME).lib
|
LIBFILE = $(LIBHOME)/$(LIBNAME).lib
|
||||||
|
@ -23,7 +29,12 @@ CFLAGS+= -wcd=303
|
||||||
# building dll:
|
# building dll:
|
||||||
CFLAGS+= -bd
|
CFLAGS+= -bd
|
||||||
# iconv:
|
# iconv:
|
||||||
|
!ifeq LIBICONV 1
|
||||||
|
CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1
|
||||||
|
LIBS+= iconv.lib
|
||||||
|
!else
|
||||||
LIBS+= libuls.lib libconv.lib
|
LIBS+= libuls.lib libconv.lib
|
||||||
|
!endif
|
||||||
# the include paths :
|
# the include paths :
|
||||||
CFLAGS+= $(INCPATH)
|
CFLAGS+= $(INCPATH)
|
||||||
# building SDL itself (for DECLSPEC):
|
# building SDL itself (for DECLSPEC):
|
||||||
|
@ -69,7 +80,9 @@ SRCS+= SDL_locale.c SDL_syslocale.c
|
||||||
SRCS+= SDL_url.c SDL_sysurl.c
|
SRCS+= SDL_url.c SDL_sysurl.c
|
||||||
|
|
||||||
SRCS+= SDL_os2.c
|
SRCS+= SDL_os2.c
|
||||||
|
!ifeq LIBICONV 0
|
||||||
SRCS+= geniconv.c os2cp.c os2iconv.c sys2utf8.c
|
SRCS+= geniconv.c os2cp.c os2iconv.c sys2utf8.c
|
||||||
|
!endif
|
||||||
SRCS+= SDL_os2audio.c
|
SRCS+= SDL_os2audio.c
|
||||||
SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c &
|
SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c &
|
||||||
SDL_os2mouse.c SDL_os2messagebox.c
|
SDL_os2mouse.c SDL_os2messagebox.c
|
||||||
|
|
|
@ -80,6 +80,11 @@
|
||||||
#define HAVE_FLOAT_H 1
|
#define HAVE_FLOAT_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
#if 0 /* see Makefile */
|
||||||
|
#define HAVE_ICONV 1
|
||||||
|
#define HAVE_ICONV_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* #undef HAVE_DLOPEN */
|
/* #undef HAVE_DLOPEN */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
|
|
|
@ -38,10 +38,16 @@
|
||||||
|
|
||||||
#endif /* OS2DEBUG */
|
#endif /* OS2DEBUG */
|
||||||
|
|
||||||
|
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
|
||||||
|
#define OS2_SysToUTF8(S) SDL_iconv_string("UTF-8", "", (char *)(S), SDL_strlen(S)+1)
|
||||||
|
#define OS2_UTF8ToSys(S) SDL_iconv_string("", "UTF-8", (char *)(S), SDL_strlen(S)+1)
|
||||||
|
#define libiconv_clean() do {} while(0)
|
||||||
|
#else
|
||||||
/* StrUTF8New() - geniconv/sys2utf8.c */
|
/* StrUTF8New() - geniconv/sys2utf8.c */
|
||||||
#include "geniconv/geniconv.h"
|
#include "geniconv/geniconv.h"
|
||||||
#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1)
|
#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1)
|
||||||
#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1)
|
#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
|
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
|
||||||
void SDL_OS2Quit(void);
|
void SDL_OS2Quit(void);
|
||||||
|
|
|
@ -320,10 +320,15 @@ static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ulFlags & KC_CHAR) != 0) {
|
if ((ulFlags & KC_CHAR) != 0) {
|
||||||
|
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
|
||||||
|
char *acUTF8 = SDL_iconv_string("UTF-8", "", (char *)&ulCharCode, 1);
|
||||||
|
SDL_SendKeyboardText((acUTF8 != NULL)? acUTF8 : (char *)&ulCharCode);
|
||||||
|
SDL_free(acUTF8);
|
||||||
|
#else
|
||||||
CHAR acUTF8[4];
|
CHAR acUTF8[4];
|
||||||
LONG lRC = StrUTF8(1, acUTF8, sizeof(acUTF8), (PSZ)&ulCharCode, 1);
|
LONG lRC = StrUTF8(1, acUTF8, sizeof(acUTF8), (PSZ)&ulCharCode, 1);
|
||||||
|
|
||||||
SDL_SendKeyboardText((lRC > 0)? acUTF8 : (PSZ)&ulCharCode);
|
SDL_SendKeyboardText((lRC > 0)? acUTF8 : (PSZ)&ulCharCode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue