mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-20 18:50:08 +02:00
253 lines
9.6 KiB
Plaintext
253 lines
9.6 KiB
Plaintext
From 0bdc9128a25c4f35c14ab2847e7fa4686e8530b9 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 9 Apr 2023 19:16:54 +1000
|
|
Subject: Add Haiku support
|
|
|
|
|
|
diff --git a/src/3rdparty/PhysX/pxshared/include/foundation/PxIntrinsics.h b/src/3rdparty/PhysX/pxshared/include/foundation/PxIntrinsics.h
|
|
index 4b75756..9054315 100644
|
|
--- a/src/3rdparty/PhysX/pxshared/include/foundation/PxIntrinsics.h
|
|
+++ b/src/3rdparty/PhysX/pxshared/include/foundation/PxIntrinsics.h
|
|
@@ -34,7 +34,7 @@
|
|
|
|
#if PX_WINDOWS_FAMILY
|
|
#include "foundation/windows/PxWindowsIntrinsics.h"
|
|
-#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4)
|
|
+#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4 || PX_HAIKU)
|
|
#include "foundation/unix/PxUnixIntrinsics.h"
|
|
#elif PX_XBOXONE
|
|
#include "foundation/XboxOne/PxXboxOneIntrinsics.h"
|
|
diff --git a/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h b/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h
|
|
index 14ed950..333ac20 100644
|
|
--- a/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h
|
|
+++ b/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h
|
|
@@ -104,6 +104,8 @@ Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSyst
|
|
#define PX_IOS 1
|
|
#elif defined(__APPLE__)
|
|
#define PX_OSX 1
|
|
+#elif defined(__HAIKU__)
|
|
+#define PX_HAIKU 1
|
|
#elif defined(__ORBIS__)
|
|
#define PX_PS4 1
|
|
#elif defined(__NX__)
|
|
@@ -187,6 +189,9 @@ define anything not defined on this platform to 0
|
|
#ifndef PX_OSX
|
|
#define PX_OSX 0
|
|
#endif
|
|
+#ifndef PX_HAIKU
|
|
+#define PX_HAIKU 0
|
|
+#endif
|
|
#ifndef PX_PS4
|
|
#define PX_PS4 0
|
|
#endif
|
|
@@ -253,7 +258,7 @@ family shortcuts
|
|
#define PX_MICROSOFT_FAMILY (PX_XBOXONE || PX_WINDOWS_FAMILY || PX_XBOX_SERIES_X)
|
|
#define PX_LINUX_FAMILY (PX_LINUX || PX_ANDROID)
|
|
#define PX_APPLE_FAMILY (PX_IOS || PX_OSX) // equivalent to #if __APPLE__
|
|
-#define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY) // shortcut for unix/posix platforms
|
|
+#define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY || PX_HAIKU) // shortcut for unix/posix platforms
|
|
#if defined(__EMSCRIPTEN__)
|
|
#define PX_EMSCRIPTEN 1
|
|
#else
|
|
@@ -291,7 +296,7 @@ Assert macro
|
|
DLL export macros
|
|
*/
|
|
#ifndef PX_C_EXPORT
|
|
-#if PX_WINDOWS_FAMILY || PX_LINUX
|
|
+#if PX_WINDOWS_FAMILY || PX_LINUX || PX_HAIKU
|
|
#define PX_C_EXPORT extern "C"
|
|
#else
|
|
#define PX_C_EXPORT
|
|
diff --git a/src/3rdparty/PhysX/pxshared/include/foundation/unix/PxUnixIntrinsics.h b/src/3rdparty/PhysX/pxshared/include/foundation/unix/PxUnixIntrinsics.h
|
|
index 175f7fd..3620cac 100644
|
|
--- a/src/3rdparty/PhysX/pxshared/include/foundation/unix/PxUnixIntrinsics.h
|
|
+++ b/src/3rdparty/PhysX/pxshared/include/foundation/unix/PxUnixIntrinsics.h
|
|
@@ -33,7 +33,7 @@
|
|
#include "foundation/Px.h"
|
|
#include "foundation/PxSharedAssert.h"
|
|
|
|
-#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY)
|
|
+#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_HAIKU)
|
|
#error "This file should only be included by Unix builds!!"
|
|
#endif
|
|
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/PsAllocator.h b/src/3rdparty/PhysX/source/foundation/include/PsAllocator.h
|
|
index a1480b2..7f04f00 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/PsAllocator.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/PsAllocator.h
|
|
@@ -118,6 +118,9 @@
|
|
#elif PX_SWITCH
|
|
#include <malloc.h>
|
|
#define PxAlloca(x) alloca(x)
|
|
+#elif PX_HAIKU
|
|
+ #include <malloc.h>
|
|
+ #define PxAlloca(x) alloca(x)
|
|
#endif
|
|
|
|
#define PxAllocaAligned(x, alignment) ((size_t(PxAlloca(x + alignment)) + (alignment - 1)) & ~size_t(alignment - 1))
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/PsIntrinsics.h b/src/3rdparty/PhysX/source/foundation/include/PsIntrinsics.h
|
|
index f08af7f..8d72734 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/PsIntrinsics.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/PsIntrinsics.h
|
|
@@ -34,7 +34,7 @@
|
|
|
|
#if PX_WINDOWS_FAMILY
|
|
#include "windows/PsWindowsIntrinsics.h"
|
|
-#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4)
|
|
+#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4 || PX_HAIKU)
|
|
#include "unix/PsUnixIntrinsics.h"
|
|
#elif PX_XBOXONE
|
|
#include "XboxOne/PsXboxOneIntrinsics.h"
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/PsThread.h b/src/3rdparty/PhysX/source/foundation/include/PsThread.h
|
|
index d0ec8d9..d88c0d4 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/PsThread.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/PsThread.h
|
|
@@ -41,7 +41,7 @@
|
|
|
|
#if PX_WINDOWS_FAMILY || PX_XBOXONE || PX_XBOX_SERIES_X
|
|
#define PxSpinLockPause() __asm pause
|
|
-#elif PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_SWITCH
|
|
+#elif PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_SWITCH || PX_HAIKU
|
|
#define PxSpinLockPause() asm("nop")
|
|
#else
|
|
#error "Platform not supported!"
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/PsTime.h b/src/3rdparty/PhysX/source/foundation/include/PsTime.h
|
|
index 4d5eedb..38f23a7 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/PsTime.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/PsTime.h
|
|
@@ -84,7 +84,7 @@ class PX_FOUNDATION_API Time
|
|
Second getLastTime() const;
|
|
|
|
private:
|
|
-#if PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4
|
|
+#if PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4 || PX_HAIKU
|
|
Second mLastTime;
|
|
#else
|
|
int64_t mTickCount;
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/unix/PsUnixIntrinsics.h b/src/3rdparty/PhysX/source/foundation/include/unix/PsUnixIntrinsics.h
|
|
index e6165e8..57fdb2d 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/unix/PsUnixIntrinsics.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/unix/PsUnixIntrinsics.h
|
|
@@ -45,7 +45,7 @@
|
|
// this file is for internal intrinsics - that is, intrinsics that are used in
|
|
// cross platform code but do not appear in the API
|
|
|
|
-#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY)
|
|
+#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_HAIKU)
|
|
#error "This file should only be included by unix builds!!"
|
|
#endif
|
|
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/include/unix/sse2/PsUnixSse2AoS.h b/src/3rdparty/PhysX/source/foundation/include/unix/sse2/PsUnixSse2AoS.h
|
|
index 847a21a..f119b56 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/include/unix/sse2/PsUnixSse2AoS.h
|
|
+++ b/src/3rdparty/PhysX/source/foundation/include/unix/sse2/PsUnixSse2AoS.h
|
|
@@ -43,7 +43,10 @@ namespace shdfnd
|
|
namespace aos
|
|
{
|
|
|
|
-#if PX_EMSCRIPTEN
|
|
+#if PX_HAIKU
|
|
+#include <SupportDefs.h>
|
|
+#endif
|
|
+#if PX_EMSCRIPTEN || PX_HAIKU
|
|
typedef int8_t __int8_t;
|
|
typedef int16_t __int16_t;
|
|
typedef int32_t __int32_t;
|
|
diff --git a/src/3rdparty/PhysX/source/foundation/src/unix/PsUnixThread.cpp b/src/3rdparty/PhysX/source/foundation/src/unix/PsUnixThread.cpp
|
|
index c29b09c..594ef02 100644
|
|
--- a/src/3rdparty/PhysX/source/foundation/src/unix/PsUnixThread.cpp
|
|
+++ b/src/3rdparty/PhysX/source/foundation/src/unix/PsUnixThread.cpp
|
|
@@ -36,13 +36,13 @@
|
|
#include "PsThread.h"
|
|
|
|
#include <math.h>
|
|
-#if !PX_APPLE_FAMILY && !defined(ANDROID) && !defined(__CYGWIN__) && !PX_PS4 && !PX_EMSCRIPTEN
|
|
+#if !PX_APPLE_FAMILY && !defined(ANDROID) && !defined(__CYGWIN__) && !PX_PS4 && !PX_EMSCRIPTEN && !PX_HAIKU
|
|
#include <bits/local_lim.h> // PTHREAD_STACK_MIN
|
|
#endif
|
|
#include <stdio.h>
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
-#if !PX_PS4
|
|
+#if !PX_PS4 && !PX_HAIKU
|
|
#include <sys/syscall.h>
|
|
#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN
|
|
#include <asm/unistd.h>
|
|
@@ -57,6 +57,10 @@
|
|
#include <pthread.h>
|
|
#endif
|
|
|
|
+#if PX_HAIKU
|
|
+#include <OS.h>
|
|
+#endif
|
|
+
|
|
// fwd
|
|
#if defined(ANDROID)
|
|
extern "C" {
|
|
@@ -115,6 +119,8 @@ static void setTid(_ThreadImpl& threadImpl)
|
|
// AM: TODO: neither of the below are implemented
|
|
#elif PX_APPLE_FAMILY
|
|
threadImpl.tid = syscall(SYS_gettid);
|
|
+#elif PX_HAIKU
|
|
+ threadImpl.tid = find_thread(NULL);
|
|
#elif PX_EMSCRIPTEN
|
|
threadImpl.tid = pthread_self();
|
|
#else
|
|
@@ -311,7 +317,7 @@ uint32_t ThreadImpl::setAffinityMask(uint32_t mask)
|
|
{
|
|
#if PX_PS4
|
|
prevMask = setAffinityMaskPS4(getThread(this)->thread, mask);
|
|
-#elif PX_EMSCRIPTEN
|
|
+#elif PX_EMSCRIPTEN || PX_HAIKU
|
|
// not supported
|
|
#elif !PX_APPLE_FAMILY // Apple doesn't support syscall with getaffinity and setaffinity
|
|
int32_t errGet = syscall(__NR_sched_getaffinity, getThread(this)->tid, sizeof(prevMask), &prevMask);
|
|
@@ -420,6 +426,8 @@ uint32_t ThreadImpl::getNbPhysicalCores()
|
|
int count;
|
|
size_t size = sizeof(count);
|
|
return sysctlbyname("hw.physicalcpu", &count, &size, NULL, 0) ? 0 : count;
|
|
+#elif PX_HAIKU
|
|
+ return 16;
|
|
#elif defined(ANDROID)
|
|
return android_getCpuCount();
|
|
#else
|
|
diff --git a/src/3rdparty/PhysX/source/pvd/include/PxProfileAllocatorWrapper.h b/src/3rdparty/PhysX/source/pvd/include/PxProfileAllocatorWrapper.h
|
|
index 46034b0..58b4059 100644
|
|
--- a/src/3rdparty/PhysX/source/pvd/include/PxProfileAllocatorWrapper.h
|
|
+++ b/src/3rdparty/PhysX/source/pvd/include/PxProfileAllocatorWrapper.h
|
|
@@ -74,7 +74,7 @@ namespace physx { namespace profile {
|
|
{
|
|
static const char* getName()
|
|
{
|
|
-#if PX_LINUX || PX_ANDROID || PX_PS4 || PX_IOS || PX_OSX || PX_EMSCRIPTEN || PX_SWITCH
|
|
+#if PX_LINUX || PX_ANDROID || PX_PS4 || PX_IOS || PX_OSX || PX_EMSCRIPTEN || PX_SWITCH || PX_HAIKU
|
|
return __PRETTY_FUNCTION__;
|
|
#else
|
|
return typeid(T).name();
|
|
--
|
|
2.37.3
|
|
|
|
|
|
From d36212644e56bca6df9ac660a20c04210a7c0117 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 14 May 2023 20:27:32 +1000
|
|
Subject: Disable SIMD for Haiku
|
|
|
|
|
|
diff --git a/src/3rdparty/PhysX/CMakeLists.txt b/src/3rdparty/PhysX/CMakeLists.txt
|
|
index 366a9c0..baf17bd 100644
|
|
--- a/src/3rdparty/PhysX/CMakeLists.txt
|
|
+++ b/src/3rdparty/PhysX/CMakeLists.txt
|
|
@@ -1341,7 +1341,7 @@ if (WIN32)
|
|
endif()
|
|
|
|
## MSYS
|
|
-if (MSYS OR MINGW)
|
|
+if (MSYS OR MINGW OR HAIKU)
|
|
qt_internal_extend_target(BundledPhysX DEFINES PX_SIMD_DISABLED PX_GCC_FAMILY)
|
|
endif()
|
|
|
|
--
|
|
2.37.3
|
|
|