mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
From bd18690766fc5ae07757b5ff1b39576cc9b6fe57 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Thu, 1 Aug 2024 19:54:41 +1000
|
|
Subject: Fix for Haiku
|
|
|
|
|
|
diff --git a/codec/common/src/WelsThreadLib.cpp b/codec/common/src/WelsThreadLib.cpp
|
|
index b1072e0..62b4815 100644
|
|
--- a/codec/common/src/WelsThreadLib.cpp
|
|
+++ b/codec/common/src/WelsThreadLib.cpp
|
|
@@ -50,7 +50,7 @@
|
|
#include <unistd.h>
|
|
#ifdef __EMSCRIPTEN__
|
|
#include <emscripten/threading.h>
|
|
-#elif !defined(__Fuchsia__)
|
|
+#elif !defined(__Fuchsia__) && !defined(__HAIKU__)
|
|
#include <sys/sysctl.h>
|
|
#endif
|
|
#ifdef __APPLE__
|
|
@@ -65,6 +65,9 @@
|
|
#ifdef __ANDROID__
|
|
#include <android/api-level.h>
|
|
#endif
|
|
+#ifdef __HAIKU__
|
|
+#include <OS.h>
|
|
+#endif
|
|
|
|
#include "WelsThreadLib.h"
|
|
#include <stdio.h>
|
|
@@ -234,7 +237,7 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_
|
|
err = pthread_attr_init (&at);
|
|
if (err)
|
|
return err;
|
|
-#if !defined(__ANDROID__) && !defined(__Fuchsia__)
|
|
+#if !defined(__ANDROID__) && !defined(__Fuchsia__) && !defined(__HAIKU__)
|
|
err = pthread_attr_setscope (&at, PTHREAD_SCOPE_SYSTEM);
|
|
if (err)
|
|
return err;
|
|
@@ -507,6 +510,15 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
|
|
|
|
return WELS_THREAD_ERROR_OK;
|
|
|
|
+#elif defined(__HAIKU__)
|
|
+ system_info sysinfo;
|
|
+ if (get_system_info(&sysinfo) == B_OK) {
|
|
+ pInfo->ProcessorCount = sysinfo.cpu_count;
|
|
+ } else {
|
|
+ pInfo->ProcessorCount = 1;
|
|
+ }
|
|
+ return WELS_THREAD_ERROR_OK;
|
|
+
|
|
#elif defined(__EMSCRIPTEN__)
|
|
|
|
// There is not yet a way to determine CPU count in emscripten JS environment.
|
|
diff --git a/meson.build b/meson.build
|
|
index 4f4376f..d20e8fd 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -57,7 +57,7 @@ cpp_lib = '-lstdc++'
|
|
libm_dep = cpp.find_library('m', required : false)
|
|
deps += [libm_dep]
|
|
|
|
-if ['linux', 'android', 'ios', 'darwin'].contains(system)
|
|
+if ['linux', 'android', 'ios', 'darwin', 'haiku'].contains(system)
|
|
asm_format32 = 'elf'
|
|
asm_format64 = 'elf64'
|
|
if ['ios', 'darwin'].contains(system)
|
|
--
|
|
2.45.2
|
|
|