Permalink
Browse files

Allow build on target Haiku

  • Loading branch information...
kwyxz committed Feb 5, 2018
1 parent c910df1 commit f808c7f92c82d307bc05f9fde601855c7b3eead8
Showing with 16 additions and 1 deletion.
  1. +4 −0 CMakeLists.txt
  2. +8 −1 Main/Tests.cpp
  3. +4 −0 Main/Tests.h
@@ -4,7 +4,11 @@ project(armips)
option(ARMIPS_REGEXP "Enable regexp expression functions" ON)

if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpthread -std=c++11 -Wno-uninitialized")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11 -Wno-uninitialized")
endif()
endif()

if(MSVC)
@@ -41,7 +41,14 @@ StringList TestRunner::listSubfolders(const std::wstring& dir)
auto elem = readdir(directory);
while (elem != NULL)
{
if(elem->d_type == DT_DIR)
#if defined(__HAIKU__)
// dirent in Posix does not have a d_type
struct stat s;
stat(elem->d_name, &s);
if (s.st_mode & S_IFDIR)
#else
if (elem->d_type == DT_DIR)
#endif
{
std::wstring dirName = convertUtf8ToWString(elem->d_name);
if (dirName != L"." && dirName != L"..")
@@ -1,6 +1,10 @@
#pragma once
#include "Util/Util.h"

#if defined(__HAIKU__)
#include <sys/stat.h>
#endif

#ifdef _WIN32
#include <windows.h>
#endif

0 comments on commit f808c7f

Please sign in to comment.