Skip to content

Commit

Permalink
Enabled Qt components built on Haiku
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Feb 14, 2024
1 parent 506e15c commit dc4e245
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ else()
list(APPEND PGE_EDITOR_LINK_LIBS PGE_SDLMixerX PGE_SDL2)
endif()

if(NOT APPLE AND NOT MSVC AND NOT PGE_ENABLE_STATIC_QT AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT MSVC AND NOT HAIKU AND NOT PGE_ENABLE_STATIC_QT AND NOT USE_SYSTEM_LIBC)
set_property(TARGET pge_editor APPEND_STRING PROPERTY LINK_FLAGS " -static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion Editor/common_features/app_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ QString ApplicationPath_x;
QString AppPathManager::m_settingsPath;
QString AppPathManager::m_userPath;

#if defined(__ANDROID__) || defined(__APPLE__)
#if defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__)
# define UserDirName "/PGE Project"
#else
# define UserDirName "/.PGE_Project"
Expand Down
28 changes: 27 additions & 1 deletion Editor/common_features/crashhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,29 @@
#define STR_EXPAND(tok) #tok
#define STR(tok) STR_EXPAND(tok)

// Exclude platforms that don't have SIG_INFO support
#if !defined(_WIN32) \
&& !defined(__3DS__) \
&& !defined(__WII__) \
&& !defined(__WIIU__) \
&& !defined(__SWITCH__) \
&& !defined(VITA)
# define HAS_SIG_INFO
#endif

// Exclude personal data removal from platforms where API doesn't allows to recognise the user and/or home directory
#if !defined(VITA) \
&& !defined(__3DS__) \
&& !defined(__WII__) \
&& !defined(__WIIU__) \
&& !defined(__SWITCH__) \
&& !defined(__EMSCRIPTEN__) \
&& !defined(__ANDROID__) \
&& !defined(__HAIKU__)
# define DO_REMOVE_PERSONAL_DATA
#endif


static const char *g_messageToUser =
"\n"
"================================================\n"
Expand Down Expand Up @@ -126,6 +149,7 @@ static bool GetStackWalk(std::string &outWalk)
}
#endif

#ifdef DO_REMOVE_PERSONAL_DATA
static QString getCurrentUserName()
{
QString user;
Expand Down Expand Up @@ -162,7 +186,7 @@ static void removePersonalData(QString &log)
}
log.replace(user, "anonymouse");
}

#endif // DO_REMOVE_PERSONAL_DATA

QString CrashHandler::getStacktrace()
{
Expand All @@ -187,7 +211,9 @@ QString CrashHandler::getStacktrace()

#endif

#ifdef DO_REMOVE_PERSONAL_DATA
removePersonalData(bkTrace);
#endif
return bkTrace;
}

Expand Down
4 changes: 4 additions & 0 deletions Editor/common_features/file_keeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ void FileKeeper::restore()
if(!m_origPath.isEmpty() && !m_tempPath.isEmpty() && QFile::exists(m_tempPath))
{
#ifndef __WIN32
# ifdef __HAIKU__
int fd = open(m_tempPath.toUtf8().data(), O_SYNC | O_APPEND, 0660);
# else
int fd = open(m_tempPath.toUtf8().data(), O_FSYNC | O_APPEND, 0660);
# endif

if(fd)
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QFileInfo>
#include <QDir>
#include <QSettings>
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU) && QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
#include <QLibraryInfo>
#define MOONDUST_QSTYLERPOXY_WORKAROUND_NEEDED
#endif
Expand Down
2 changes: 1 addition & 1 deletion Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ else()
list(APPEND PGE_ENGINE_LINK_LIBS PGE_SDLMixerX PGE_SDL2)
endif()

if(NOT APPLE AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
set_property(TARGET pge_engine APPEND_STRING PROPERTY LINK_FLAGS " -static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion GIFs2PNG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ list(APPEND GIFs2PNG_INSTALLS
GIFs2PNG
)

if(NOT APPLE AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
set_property(TARGET GIFs2PNG APPEND_STRING PROPERTY LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion LazyFixTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ list(APPEND LazyFixTool_INSTALLS
LazyFixTool
)

if(NOT APPLE AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
set_property(TARGET LazyFixTool APPEND_STRING PROPERTY LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion Maintainer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ if(WIN32)
version
)
else()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT HAIKU)
list(APPEND PGE_MAINTAINER_LINK_LIBS dl)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion Maintainer/common_features/app_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ QString ApplicationPath_x;
QString AppPathManager::m_settingsPath;
QString AppPathManager::m_userPath;

#if defined(__ANDROID__) || defined(__APPLE__)
#if defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__)
# define UserDirName "/PGE Project"
#else
# define UserDirName "/.PGE_Project"
Expand Down
2 changes: 1 addition & 1 deletion MusicPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ else()
endif()
endif()

if(NOT APPLE AND NOT MSVC AND NOT PGE_ENABLE_STATIC_QT AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT PGE_ENABLE_STATIC_QT AND NOT USE_SYSTEM_LIBC)
set_property(TARGET pge_musplay APPEND_STRING PROPERTY LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion PNG2GIFs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ list(APPEND PNG2GIFs_INSTALLS
PNG2GIFs
)

if(NOT APPLE AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
set_property(TARGET PNG2GIFs APPEND_STRING PROPERTY LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()

Expand Down
2 changes: 1 addition & 1 deletion PaletteFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ list(APPEND PaletteFilter_INSTALLS
PaletteFilter
)

if(NOT APPLE AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
if(NOT APPLE AND NOT HAIKU AND NOT MSVC AND NOT USE_SYSTEM_LIBC)
set_property(TARGET PaletteFilter APPEND_STRING PROPERTY LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()

Expand Down
4 changes: 4 additions & 0 deletions _common/find_linguist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ set(POSSIBLE_QT_PATHS
"C:/Qt/5.11/mingw530_32/bin"
)

if(HAIKU)
list(APPEND POSSIBLE_QT_PATHS "/bin/")
endif()

find_program(_QT_LRELEASE_PROGRAM lrelease NO_DEFAULT_PATH PATHS ${POSSIBLE_QT_PATHS})
if(_QT_LRELEASE_PROGRAM)
message(STATUS "Found ${_QT_LRELEASE_PROGRAM}, locales will be compiled!")
Expand Down
1 change: 0 additions & 1 deletion _common/library_luajit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ if(PGE_USE_LUAJIT)
"-DLUAJIT_FORCE_UTF8_FOPEN=ON"
${ANDROID_CMAKE_FLAGS}
${APPLE_CMAKE_FLAGS}
${LUAJIT_USE_CMAKE_FLAG}
BUILD_BYPRODUCTS
"${libLuaJit_Lib}"
)
Expand Down
2 changes: 1 addition & 1 deletion _common/library_qt.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(PGE_ENABLE_QT_ENABLED_BY_DEFAULT ON)

if(HAIKU OR EMSCRIPTEN OR ANDROID)
if(EMSCRIPTEN OR ANDROID)
set(PGE_ENABLE_QT_ENABLED_BY_DEFAULT OFF)
message("== Qt-dependent components are not supported for this platform")
include(_common/find_linguist.cmake)
Expand Down

0 comments on commit dc4e245

Please sign in to comment.