diff --git a/CMakeLists.txt b/CMakeLists.txt index 84fe7a797..be08c7d89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,6 +341,9 @@ if(NOT WIN32 AND NOT APPLE_IOS) if(HAVE_RT_LIB) set(SYSTEM_LIBS ${SYSTEM_LIBS} rt) endif() + if(HAIKU) + set(SYSTEM_LIBS ${SYSTEM_LIBS} network) + endif() endif() if(ENABLE_LUA) diff --git a/Global.h b/Global.h index afb299429..9a69cbea1 100644 --- a/Global.h +++ b/Global.h @@ -41,6 +41,10 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size."); # define VCMI_UNIX # define VCMI_XDG # define VCMI_FREEBSD +#elif defined(__HAIKU__) +# define VCMI_UNIX +# define VCMI_XDG +# define VCMI_HAIKU #elif defined(__GNU__) || defined(__gnu_hurd__) || (defined(__MACH__) && !defined(__APPLE__)) # define VCMI_UNIX # define VCMI_XDG diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp index 240aa6c99..e98a42274 100644 --- a/lib/CThreadHelper.cpp +++ b/lib/CThreadHelper.cpp @@ -12,6 +12,8 @@ #ifdef VCMI_WINDOWS #include +#elif defined(VCMI_HAIKU) + #include #elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) #include #endif @@ -89,6 +91,8 @@ void setThreadName(const std::string &name) prctl(PR_SET_NAME, name.c_str(), 0, 0, 0); #elif defined(VCMI_APPLE) pthread_setname_np(name.c_str()); +#elif defined(VCMI_HAIKU) + rename_thread(find_thread(NULL), name.c_str()); #endif } diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 9eabe58fc..fd698092e 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -33,7 +33,7 @@ else() set(server_LIBS vcmi) endif() -if(CMAKE_SYSTEM_NAME MATCHES FreeBSD) +if(CMAKE_SYSTEM_NAME MATCHES FreeBSD OR HAIKU) set(server_LIBS execinfo ${server_LIBS}) endif() target_link_libraries(vcmiserver PRIVATE ${server_LIBS} minizip::minizip)