Fix building on Haiku OS

This commit is contained in:
Cacodemon345
2025-03-14 21:24:36 +06:00
parent aef06552fb
commit 0686045d2a
3 changed files with 20 additions and 2 deletions

View File

@@ -108,6 +108,10 @@ endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid voodoo plat ui)
if(HAIKU)
target_link_libraries(86Box be)
endif()
if(WIN32 AND ARCH STREQUAL "i386")
if(MINGW)
target_link_options(86Box PRIVATE "LINKER:--large-address-aware")

View File

@@ -18,6 +18,11 @@
* Copyright 2021-2022 Cacodemon345
* Copyright 2021-2022 Teemu Korhonen
*/
#ifdef __HAIKU__
#include <OS.h>
#endif
#include <cstdio>
#include <mutex>
@@ -828,6 +833,8 @@ plat_set_thread_name(void *thread, const char *name)
pthread_setname_np(truncated);
# elif defined(Q_OS_NETBSD)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
# elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
# elif defined(Q_OS_OPENBSD)
pthread_set_name_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
# else

View File

@@ -2,6 +2,9 @@
# define _FILE_OFFSET_BITS 64
# define _LARGEFILE64_SOURCE 1
#endif
#ifdef __HAIKU__
#include <OS.h>
#endif
#include <SDL.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -1398,16 +1401,20 @@ plat_set_thread_name(void *thread, const char *name)
if (thread) /* Apple pthread can only set self's name */
return;
char truncated[64];
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
char truncated[64];
#elif defined(__HAIKU__)
char truncated[32];
#else
char truncated[16];
#endif
strncpy(truncated, name, sizeof(truncated) - 1);
#ifdef __APPLE__
pthread_setname_np(truncated);
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
#else
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
#endif