Skip to content

Commit

Permalink
Complete Haiku platform support. (#10311)
Browse files Browse the repository at this point in the history
Fixing linkage/libraries missing issue.
Implements missing platform specifics.
  • Loading branch information
devnexen committed Aug 23, 2020
1 parent 98faeac commit cf55472
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Expand Up @@ -351,6 +351,10 @@ else()
if (ICONV_LIBRARY)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${ICONV_LIBRARY})
endif()
if (HAIKU)
set(PLATFORM_LIBS ${PLATFORM_LIBS} intl network)
endif()

endif()

check_include_files(endian.h HAVE_ENDIAN_H)
Expand Down
5 changes: 0 additions & 5 deletions src/network/CMakeLists.txt
Expand Up @@ -16,8 +16,3 @@ if (BUILD_CLIENT)
PARENT_SCOPE
)
endif()

# Haiku networking support
if(HAIKU)
set(PLATFORM_LIBS -lnetwork ${PLATFORM_LIBS})
endif()
10 changes: 10 additions & 0 deletions src/porting.cpp
Expand Up @@ -56,6 +56,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <crt_externs.h>
#endif

#if defined(__HAIKU__)
#include <FindDirectory.h>
#endif

#include "config.h"
#include "debug.h"
#include "filesys.h"
Expand Down Expand Up @@ -321,6 +325,12 @@ bool getCurrentExecPath(char *buf, size_t len)
return true;
}

#elif defined(__HAIKU__)

bool getCurrentExecPath(char *buf, size_t len)
{
return find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, buf, len) == B_OK;
}

//// Solaris
#elif defined(__sun) || defined(sun)
Expand Down
2 changes: 2 additions & 0 deletions src/porting.h
Expand Up @@ -309,6 +309,8 @@ inline const char *getPlatformName()
#else
"SunOS"
#endif
#elif defined(__HAIKU__)
"Haiku"
#elif defined(__CYGWIN__)
"Cygwin"
#elif defined(__unix__) || defined(__unix)
Expand Down
4 changes: 4 additions & 0 deletions src/threading/thread.cpp
Expand Up @@ -225,6 +225,10 @@ void Thread::setName(const std::string &name)

pthread_setname_np(name.c_str());

#elif defined(__HAIKU__)

rename_thread(find_thread(NULL), name.c_str());

#elif defined(_MSC_VER)

// Windows itself doesn't support thread names,
Expand Down
4 changes: 4 additions & 0 deletions src/threading/thread.h
Expand Up @@ -36,6 +36,10 @@ DEALINGS IN THE SOFTWARE.
#include <sys/thread.h> // for tid_t
#endif

#ifdef __HAIKU__
#include <kernel/OS.h>
#endif

/*
* On platforms using pthreads, these five priority classes correlate to
* even divisions between the minimum and maximum reported thread priority.
Expand Down

0 comments on commit cf55472

Please sign in to comment.