From 0000000000000000000000000000000000000000 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] Add a SerenityOS platform definition --- cmake/QtBuild.cmake | 2 + mkspecs/serenity-g++/qmake.conf | 25 ++++++++ mkspecs/serenity-g++/qplatformdefs.h | 87 +++++++++++++++++++++++++++ src/corelib/global/qsystemdetection.h | 3 + src/gui/CMakeLists.txt | 2 + util/cmake/helper.py | 1 + 6 files changed, 120 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 bb7049e76a65cd8fea0ad4aca2f29bdbefbdc86d..df4c9d07f2984ea8ab02d54004335a2d4377f78b 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -326,6 +326,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 0000000000000000000000000000000000000000..3808b5a269788a32d4aa74aa629b519df80d1000 --- /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 0000000000000000000000000000000000000000..1f0dd9819abb1f8dac52250d24aa8d0763f05445 --- /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 cbbe613e40cd20110b9aa31177d95e0a18bdf9fa..82b3f84800f8c5bf3a7a4567ea55f6a8a4681b13 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -36,6 +36,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 @@ -129,6 +130,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 36dae764d75bf2c3a641ce0776f307755b4ead44..0ab63742665dd7da1259fdfbbb2cc8dab5450578 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 f40ea4d61f0d1d658b6715c55cb70c1eadb59a25..d8940f09595c887771f12c0e584936907174c540 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -696,6 +696,7 @@ platform_mapping = { "macx": "MACOS", "macos": "MACOS", "macx-icc": "(MACOS AND ICC)", + "serenity": "SERENITY", }