From 168040b44c185772fe6d24eb017e6fc6366fadb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Wed, 15 Dec 2021 20:01:43 +0100 Subject: [PATCH 1/5] Add a SerenityOS platform definition --- cmake/QtBuild.cmake | 2 + mkspecs/serenity-g++/qmake.conf | 25 ++++++++ mkspecs/serenity-g++/qplatformdefs.h | 88 +++++++++++++++++++++++++++ src/corelib/global/qsystemdetection.h | 3 + src/gui/CMakeLists.txt | 2 + util/cmake/helper.py | 1 + 6 files changed, 121 insertions(+) create mode 100644 mkspecs/serenity-g++/qmake.conf create mode 100644 mkspecs/serenity-g++/qplatformdefs.h diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 7553b681..702ddf6f 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -321,6 +321,8 @@ elseif(APPLE) set(QT_DEFAULT_MKSPEC macx-clang) elseif(WASM) set(QT_DEFAULT_MKSPEC wasm-emscripten) +elseif(SERENITYOS) + set(QT_DEFAULT_MKSPEC serenity-g++) elseif(QNX) # Certain POSIX defines are not set if we don't compile with -std=gnuXX set(QT_ENABLE_CXX_EXTENSIONS ON) diff --git a/mkspecs/serenity-g++/qmake.conf b/mkspecs/serenity-g++/qmake.conf new file mode 100644 index 00000000..00d5ae2c --- /dev/null +++ b/mkspecs/serenity-g++/qmake.conf @@ -0,0 +1,25 @@ +# +# qmake configuration for serenity-g++ +# + +MAKEFILE_GENERATOR = ninja +QMAKE_PLATFORM = serenity + +include(../common/unix.conf) + +QMAKE_LIBS = -lpthread +QMAKE_INCDIR = +QMAKE_LIBDIR = + +QMAKE_LIBS_THREAD = -lpthread + +QMAKE_LIBS_NETWORK = -lnetwork +QMAKE_LIBS_OPENGL = -lGL +QMAKE_LIBS_OPENGL_QT = -lGL + +QMAKE_AR = ar cqs +QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P +QMAKE_RANLIB = + +load(qt_config) diff --git a/mkspecs/serenity-g++/qplatformdefs.h b/mkspecs/serenity-g++/qplatformdefs.h new file mode 100644 index 00000000..c054ddc5 --- /dev/null +++ b/mkspecs/serenity-g++/qplatformdefs.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (c) 2021, the SerenityOS developers. +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#define _GLIBCXX_HAVE_MBSTATE_T 1 + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "../common/posix/qplatformdefs.h" + +#ifdef QT_POSIX_IPC +#define QT_POSIX_IPC 1 +//#undef QT_POSIX_IPC +#endif + +#ifdef QT_OPEN_LARGEFILE +#undef QT_OPEN_LARGEFILE +#endif +#define QT_OPEN_LARGEFILE 0 + +#ifdef QT_LARGEFILE_SUPPORT +#undef QT_LARGEFILE_SUPPORT +#endif + +#include +#include + +#endif // QPLATFORMDEFS_H diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index c8f98042..5c534c4a 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -72,6 +72,7 @@ ANDROID - Android platform HAIKU - Haiku WEBOS - LG WebOS + SERENITY - SerenityOS The following operating systems have variants: LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android @@ -165,6 +166,8 @@ # define Q_OS_VXWORKS #elif defined(__HAIKU__) # define Q_OS_HAIKU +#elif defined(__serenity__) +# define Q_OS_SERENITY #elif defined(__MAKEDEPEND__) #else # error "Qt has not been ported to this OS - see http://www.qt-project.org/" diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1e212b25..b12c8196 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -29,6 +29,8 @@ if (QT_FEATURE_gui) set(_default_platform "haiku") elseif(WASM) set(_default_platform "wasm") + elseif(SERENITYOS) + set(_default_platform "serenity") else() set(_default_platform "xcb") endif() diff --git a/util/cmake/helper.py b/util/cmake/helper.py index e55a9412..87260f36 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -767,6 +767,7 @@ platform_mapping = { "macx": "MACOS", "macos": "MACOS", "macx-icc": "(MACOS AND ICC)", + "serenity": "SERENITY", } -- 2.33.1