Merge commit 'refs/pull/24298/head' of github.com:wxWidgets/wxWidgets

Build fixes for wxQt/Android.

Also allows wxLogDebug to work on Android.

See #24298.
This commit is contained in:
Vadim Zeitlin 2024-02-29 02:57:23 +01:00
commit 4b4f0d3d86
4 changed files with 26 additions and 6 deletions

View file

@ -134,6 +134,13 @@ if(WXQT)
list(APPEND wxTOOLKIT_DEFINITIONS ${Qt5${QT_COMPONENT}_COMPILE_DEFINITIONS})
endforeach()
set(wxTOOLKIT_VERSION ${Qt5Core_VERSION})
if(ANDROID)
# A hack to remove _${ANDROID_ABI} that Qt5AndroidSupport.cmake added
# which breaks wx-config.
set(CMAKE_SHARED_LIBRARY_SUFFIX_C ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(CMAKE_SHARED_LIBRARY_SUFFIX_CXX ${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
endif()
if(APPLE)

View file

@ -160,9 +160,9 @@
#ifdef __ANDROID__ // these functions are broken on android
extern double android_wcstod(const wchar_t *nptr, wchar_t **endptr);
extern long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base);
WXDLLIMPEXP_BASE double android_wcstod(const wchar_t *nptr, wchar_t **endptr);
WXDLLIMPEXP_BASE long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
WXDLLIMPEXP_BASE unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base);
#define wxCRT_StrtodW android_wcstod
#define wxCRT_StrtolW android_wcstol

View file

@ -39,6 +39,10 @@
#include "wx/msw/private.h"
#endif
#if defined(__ANDROID__)
#include <android/log.h>
#endif
// ===========================================================================
// implementation
// ===========================================================================
@ -143,8 +147,13 @@ wxMessageOutputStderr::wxMessageOutputStderr(FILE *fp, const wxMBConv& conv)
void wxMessageOutputStderr::Output(const wxString& str)
{
const wxCharBuffer& buf = PrepareForOutput(str);
#if defined(__ANDROID__)
__android_log_write(ANDROID_LOG_INFO, "wxWidgets", buf.data());
#else
fwrite(buf, buf.length(), 1, m_fp);
fflush(m_fp);
#endif
}
// ----------------------------------------------------------------------------
@ -158,6 +167,10 @@ void wxMessageOutputDebug::Output(const wxString& str)
out.Replace(wxT("\t"), wxT(" "));
out.Replace(wxT("\n"), wxT("\r\n"));
::OutputDebugString(out.t_str());
#elif defined(__ANDROID__)
const wxCharBuffer& buf = PrepareForOutput(str);
__android_log_write(ANDROID_LOG_DEBUG, "wxWidgets", buf.data());
#else
// TODO: use native debug output function for the other ports too
wxMessageOutputStderr::Output(str);

View file

@ -1219,21 +1219,21 @@ int wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap)
} \
return d;
long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base)
WXDLLEXPORT long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base)
{
ANDROID_WCSTO_START
long d = strtol(dst, &dstendp, base);
ANDROID_WCSTO_END
}
unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base)
WXDLLEXPORT unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base)
{
ANDROID_WCSTO_START
unsigned long d = strtoul(dst, &dstendp, base);
ANDROID_WCSTO_END
}
double android_wcstod(const wchar_t *nptr, wchar_t **endptr)
WXDLLEXPORT double android_wcstod(const wchar_t *nptr, wchar_t **endptr)
{
ANDROID_WCSTO_START
double d = strtod(dst, &dstendp);