From d8709fde8f568a523a583e8aa42013f54bd5f0f7 Mon Sep 17 00:00:00 2001 From: Panagiotis Vasilopoulos Date: Sun, 14 Jun 2020 21:41:38 +0300 Subject: [PATCH] Added support for Haiku operating system * OpenGL and SDL2 are used * Added Haiku platform in Irrlicht configurations * Added support for Haiku in AngelScript * Fixed multiple assertions --- CMakeLists.txt | 12 ++++------ lib/angelscript/source/as_config.h | 25 +++++++++++--------- lib/irrlicht/include/IrrCompileConfig.h | 12 +++++++++- lib/irrlicht/source/Irrlicht/CFileSystem.cpp | 2 +- lib/irrlicht/source/Irrlicht/COSOperator.cpp | 2 +- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a493730..c394199f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,14 +177,12 @@ endif() add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet") include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src") -if(WIN32) +if(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "BSD") set(LIBRESOLV_LIBRARY) +elseif (HAIKU) + find_library(LIBRESOLV_LIBRARY NAMES network socket) else() - if (NOT CMAKE_SYSTEM_NAME MATCHES "BSD") - find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv) - else() - set(LIBRESOLV_LIBRARY) - endif() + find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv) endif() # Find system ENet library or build it if missing @@ -317,7 +315,7 @@ include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include") # of the added include directory. if(USE_WIIUSE) # Find system WiiUse library or build it if missing - if((UNIX AND NOT APPLE) AND USE_SYSTEM_WIIUSE) + if((UNIX AND NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE) find_package(WiiUse) endif() diff --git a/lib/angelscript/source/as_config.h b/lib/angelscript/source/as_config.h index 4285965b0..088753194 100644 --- a/lib/angelscript/source/as_config.h +++ b/lib/angelscript/source/as_config.h @@ -1085,23 +1085,26 @@ // Haiku OS #elif __HAIKU__ #define AS_HAIKU - // Only x86-32 is currently supported by Haiku, but they do plan to support - // x86-64 and PowerPC in the future, so should go ahead and check the platform - // for future compatibility #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__) #define AS_X86 #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK #define THISCALL_RETURN_SIMPLE_IN_MEMORY #define CDECL_RETURN_SIMPLE_IN_MEMORY #define STDCALL_RETURN_SIMPLE_IN_MEMORY - #else - #define AS_MAX_PORTABILITY - #endif - - #define AS_POSIX_THREADS - #if !( ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) ) - // Only with GCC 4.1 was the atomic instructions available - #define AS_NO_ATOMIC + #elif defined(__x86_64__) + #define AS_X64_GCC + #define HAS_128_BIT_PRIMITIVES + #define SPLIT_OBJS_BY_MEMBER_TYPES + #undef COMPLEX_MASK + #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR | asOBJ_APP_ARRAY) + #undef COMPLEX_RETURN_MASK + #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR | asOBJ_APP_ARRAY) + #define AS_LARGE_OBJS_PASSED_BY_REF + #define AS_LARGE_OBJ_MIN_SIZE 5 + #undef STDCALL + #define STDCALL + #else + #define AS_MAX_PORTABILITY #endif // Illumos diff --git a/lib/irrlicht/include/IrrCompileConfig.h b/lib/irrlicht/include/IrrCompileConfig.h index fa5ac237f..afd8a518c 100644 --- a/lib/irrlicht/include/IrrCompileConfig.h +++ b/lib/irrlicht/include/IrrCompileConfig.h @@ -22,6 +22,7 @@ //! _IRR_WINDOWS_CE_PLATFORM_ for Windows CE //! _IRR_WINDOWS_API_ for Windows or XBox //! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined) +//! _IRR_HAIKU_PLATFORM_ for Haiku //! _IRR_SOLARIS_PLATFORM_ for Solaris //! _IRR_OSX_PLATFORM_ for Apple systems running OSX //! _IRR_IOS_PLATFORM_ for Apple devices running iOS @@ -88,6 +89,15 @@ #endif #endif +#if defined(HAIKU) +#define _IRR_HAIKU_PLATFORM_ +#endif + +#if defined(_IRR_HAIKU_PLATFORM_) +#define _IRR_COMPILE_WITH_SDL_DEVICE_ +#define _IRR_COMPILE_WITH_OPENGL_ +#endif + #if defined(ANDROID) #define _IRR_ANDROID_PLATFORM_ #define _IRR_POSIX_API_ @@ -99,7 +109,7 @@ #define _IRR_COMPILE_ANDROID_ASSET_READER_ #endif -#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_) +#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_) && !defined(_IRR_HAIKU_PLATFORM_) #ifndef _IRR_SOLARIS_PLATFORM_ #define _IRR_LINUX_PLATFORM_ #endif diff --git a/lib/irrlicht/source/Irrlicht/CFileSystem.cpp b/lib/irrlicht/source/Irrlicht/CFileSystem.cpp index 0e36d06f7..499e32413 100644 --- a/lib/irrlicht/source/Irrlicht/CFileSystem.cpp +++ b/lib/irrlicht/source/Irrlicht/CFileSystem.cpp @@ -874,7 +874,7 @@ IFileList* CFileSystem::createFileList(const io::path& directory) size = buf.st_size; isDirectory = S_ISDIR(buf.st_mode); } - #if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) + #if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__) // only available on some systems else { diff --git a/lib/irrlicht/source/Irrlicht/COSOperator.cpp b/lib/irrlicht/source/Irrlicht/COSOperator.cpp index 25f356dc9..dc1587975 100644 --- a/lib/irrlicht/source/Irrlicht/COSOperator.cpp +++ b/lib/irrlicht/source/Irrlicht/COSOperator.cpp @@ -11,7 +11,7 @@ #else #include #include -#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) +#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__) #include #include #if defined(ANDROID) || (defined(__linux__) && !defined(__GLIBC__))