From ae04dac2db36ca13ea3ccbed70a2a8d23f8b73d5 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Tue, 25 May 2021 16:17:08 +0200 Subject: [PATCH] Remove server platform --- SConstruct | 27 ++- drivers/SCsub | 2 +- modules/text_server_adv/SCsub | 2 +- modules/webm/libvpx/SCsub | 9 +- platform/server/SCsub | 16 -- platform/server/detect.py | 296 ------------------------------ platform/server/godot_server.cpp | 49 ----- platform/server/logo.png | Bin 2016 -> 0 bytes platform/server/os_server.cpp | 267 --------------------------- platform/server/os_server.h | 116 ------------ platform/server/platform_config.h | 49 ----- 11 files changed, 17 insertions(+), 816 deletions(-) delete mode 100644 platform/server/SCsub delete mode 100644 platform/server/detect.py delete mode 100644 platform/server/godot_server.cpp delete mode 100644 platform/server/logo.png delete mode 100644 platform/server/os_server.cpp delete mode 100644 platform/server/os_server.h delete mode 100644 platform/server/platform_config.h diff --git a/SConstruct b/SConstruct index 2efa71767e9..8ac21c0bdcc 100644 --- a/SConstruct +++ b/SConstruct @@ -665,20 +665,19 @@ if selected_platform in platform_list: if not env["verbose"]: methods.no_verbose(sys, env) - if not env["platform"] == "server": - GLSL_BUILDERS = { - "RD_GLSL": env.Builder( - action=env.Run(glsl_builders.build_rd_headers, 'Building RD_GLSL header: "$TARGET"'), - suffix="glsl.gen.h", - src_suffix=".glsl", - ), - "GLSL_HEADER": env.Builder( - action=env.Run(glsl_builders.build_raw_headers, 'Building GLSL header: "$TARGET"'), - suffix="glsl.gen.h", - src_suffix=".glsl", - ), - } - env.Append(BUILDERS=GLSL_BUILDERS) + GLSL_BUILDERS = { + "RD_GLSL": env.Builder( + action=env.Run(glsl_builders.build_rd_headers, 'Building RD_GLSL header: "$TARGET"'), + suffix="glsl.gen.h", + src_suffix=".glsl", + ), + "GLSL_HEADER": env.Builder( + action=env.Run(glsl_builders.build_raw_headers, 'Building GLSL header: "$TARGET"'), + suffix="glsl.gen.h", + src_suffix=".glsl", + ), + } + env.Append(BUILDERS=GLSL_BUILDERS) scons_cache_path = os.environ.get("SCONS_CACHE") if scons_cache_path != None: diff --git a/drivers/SCsub b/drivers/SCsub index e2ac9ee01e9..50ada3d95fb 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -23,7 +23,7 @@ SConscript("coremidi/SCsub") SConscript("winmidi/SCsub") # Graphics drivers -if env["platform"] != "server" and env["platform"] != "javascript": +if env["platform"] != "javascript": SConscript("vulkan/SCsub") else: SConscript("dummy/SCsub") diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index a55b6dc2833..d06c5c2f14a 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -131,7 +131,7 @@ if env["builtin_harfbuzz"]: ] ) - if env["platform"] == "android" or env["platform"] == "linuxbsd" or env["platform"] == "server": + if env["platform"] == "android" or env["platform"] == "linuxbsd": env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"]) if env["platform"] == "javascript": diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub index 67d3f1bebde..4334cf732bc 100644 --- a/modules/webm/libvpx/SCsub +++ b/modules/webm/libvpx/SCsub @@ -235,7 +235,7 @@ if env["platform"] == "uwp": else: import platform - is_x11_or_server_arm = (env["platform"] == "linuxbsd" or env["platform"] == "server") and ( + is_x11_or_server_arm = env["platform"] == "linuxbsd" and ( platform.machine().startswith("arm") or platform.machine().startswith("aarch") ) is_macos_x86 = env["platform"] == "osx" and ("arch" in env and (env["arch"] != "arm64")) @@ -314,12 +314,7 @@ if webm_cpu_x86: if webm_cpu_arm: if env["platform"] == "iphone": env_libvpx["ASFLAGS"] = "-arch armv7" - elif ( - env["platform"] == "android" - and env["android_arch"] == "armv7" - or env["platform"] == "linuxbsd" - or env["platform"] == "server" - ): + elif env["platform"] == "android" and env["android_arch"] == "armv7" or env["platform"] == "linuxbsd": env_libvpx["ASFLAGS"] = "-mfpu=neon" elif env["platform"] == "uwp": env_libvpx["AS"] = "armasm" diff --git a/platform/server/SCsub b/platform/server/SCsub deleted file mode 100644 index 15b9af4d259..00000000000 --- a/platform/server/SCsub +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -import sys - -Import("env") - -common_server = [ - "os_server.cpp", -] - -if sys.platform == "darwin": - common_server.append("#platform/osx/crash_handler_osx.mm") -else: - common_server.append("#platform/x11/crash_handler_x11.cpp") - -prog = env.add_program("#bin/godot_server", ["godot_server.cpp"] + common_server) diff --git a/platform/server/detect.py b/platform/server/detect.py deleted file mode 100644 index 478bcad2128..00000000000 --- a/platform/server/detect.py +++ /dev/null @@ -1,296 +0,0 @@ -import os -import platform -import sys - -# This file is mostly based on platform/x11/detect.py. -# If editing this file, make sure to apply relevant changes here too. - - -def is_active(): - return True - - -def get_name(): - return "Server" - - -def get_program_suffix(): - if sys.platform == "darwin": - return "osx" - return "linuxbsd" - - -def can_build(): - if os.name != "posix": - return False - - return True - - -def get_opts(): - from SCons.Variables import BoolVariable, EnumVariable - - return [ - BoolVariable("use_llvm", "Use the LLVM compiler", False), - BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), - BoolVariable("use_coverage", "Test Godot coverage", False), - BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), - BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False), - BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False), - BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False), - BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False), - BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True), - BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), - BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False), - ] - - -def get_flags(): - return [] - - -def configure(env): - - ## Build type - - if env["target"] == "release": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O3"]) - elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) - - if env["debug_symbols"]: - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "release_debug": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O2"]) - elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) - env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) - - if env["debug_symbols"]: - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "debug": - env.Prepend(CCFLAGS=["-g3"]) - env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) - env.Append(LINKFLAGS=["-rdynamic"]) - - ## Architecture - - is64 = sys.maxsize > 2 ** 32 - if env["bits"] == "default": - env["bits"] = "64" if is64 else "32" - - ## Compiler configuration - - if "CXX" in env and "clang" in os.path.basename(env["CXX"]): - # Convenience check to enforce the use_llvm overrides when CXX is clang(++) - env["use_llvm"] = True - - if env["use_llvm"]: - if "clang++" not in os.path.basename(env["CXX"]): - env["CC"] = "clang" - env["CXX"] = "clang++" - env.extra_suffix = ".llvm" + env.extra_suffix - env.Append(LIBS=["atomic"]) - - if env["use_coverage"]: - env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - - if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: - env.extra_suffix += "s" - - if env["use_ubsan"]: - env.Append( - CCFLAGS=[ - "-fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin" - ] - ) - env.Append(LINKFLAGS=["-fsanitize=undefined"]) - if env["use_llvm"]: - env.Append( - CCFLAGS=[ - "-fsanitize=nullability-return,nullability-arg,function,nullability-assign,implicit-integer-sign-change" - ] - ) - else: - env.Append(CCFLAGS=["-fsanitize=bounds-strict"]) - - if env["use_asan"]: - env.Append(CCFLAGS=["-fsanitize=address,pointer-subtract,pointer-compare"]) - env.Append(LINKFLAGS=["-fsanitize=address"]) - - if env["use_lsan"]: - env.Append(CCFLAGS=["-fsanitize=leak"]) - env.Append(LINKFLAGS=["-fsanitize=leak"]) - - if env["use_tsan"]: - env.Append(CCFLAGS=["-fsanitize=thread"]) - env.Append(LINKFLAGS=["-fsanitize=thread"]) - - if env["use_msan"] and env["use_llvm"]: - env.Append(CCFLAGS=["-fsanitize=memory"]) - env.Append(CCFLAGS=["-fsanitize-memory-track-origins"]) - env.Append(CCFLAGS=["-fsanitize-recover=memory"]) - env.Append(LINKFLAGS=["-fsanitize=memory"]) - - if env["use_lto"]: - env.Append(CCFLAGS=["-flto"]) - if not env["use_llvm"] and env.GetOption("num_jobs") > 1: - env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))]) - else: - env.Append(LINKFLAGS=["-flto"]) - if not env["use_llvm"]: - env["RANLIB"] = "gcc-ranlib" - env["AR"] = "gcc-ar" - - env.Append(CCFLAGS=["-pipe"]) - env.Append(LINKFLAGS=["-pipe"]) - - ## Dependencies - - # FIXME: Check for existence of the libs before parsing their flags with pkg-config - - # freetype depends on libpng and zlib, so bundling one of them while keeping others - # as shared libraries leads to weird issues - if ( - env["builtin_freetype"] - or env["builtin_libpng"] - or env["builtin_zlib"] - or env["builtin_graphite"] - or env["builtin_harfbuzz"] - ): - env["builtin_freetype"] = True - env["builtin_libpng"] = True - env["builtin_zlib"] = True - env["builtin_graphite"] = True - env["builtin_harfbuzz"] = True - - if not env["builtin_freetype"]: - env.ParseConfig("pkg-config freetype2 --cflags --libs") - - if not env["builtin_graphite"]: - env.ParseConfig("pkg-config graphite2 --cflags --libs") - - if not env["builtin_icu"]: - env.ParseConfig("pkg-config icu-uc --cflags --libs") - - if not env["builtin_harfbuzz"]: - env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs") - - if not env["builtin_libpng"]: - env.ParseConfig("pkg-config libpng16 --cflags --libs") - - if not env["builtin_bullet"]: - # We need at least version 2.89 - import subprocess - - bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() - if str(bullet_version) < "2.89": - # Abort as system bullet was requested but too old - print( - "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( - bullet_version, "2.89" - ) - ) - sys.exit(255) - env.ParseConfig("pkg-config bullet --cflags --libs") - - if False: # not env['builtin_assimp']: - # FIXME: Add min version check - env.ParseConfig("pkg-config assimp --cflags --libs") - - if not env["builtin_enet"]: - env.ParseConfig("pkg-config libenet --cflags --libs") - - if not env["builtin_squish"]: - env.ParseConfig("pkg-config libsquish --cflags --libs") - - if not env["builtin_zstd"]: - env.ParseConfig("pkg-config libzstd --cflags --libs") - - # Sound and video libraries - # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - - if not env["builtin_libtheora"]: - env["builtin_libogg"] = False # Needed to link against system libtheora - env["builtin_libvorbis"] = False # Needed to link against system libtheora - env.ParseConfig("pkg-config theora theoradec --cflags --libs") - else: - list_of_x86 = ["x86_64", "x86", "i386", "i586"] - if any(platform.machine() in s for s in list_of_x86): - env["x86_libtheora_opt_gcc"] = True - - if not env["builtin_libvpx"]: - env.ParseConfig("pkg-config vpx --cflags --libs") - - if not env["builtin_libvorbis"]: - env["builtin_libogg"] = False # Needed to link against system libvorbis - env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - - if not env["builtin_opus"]: - env["builtin_libogg"] = False # Needed to link against system opus - env.ParseConfig("pkg-config opus opusfile --cflags --libs") - - if not env["builtin_libogg"]: - env.ParseConfig("pkg-config ogg --cflags --libs") - - if not env["builtin_libwebp"]: - env.ParseConfig("pkg-config libwebp --cflags --libs") - - if not env["builtin_mbedtls"]: - # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - - if not env["builtin_wslay"]: - env.ParseConfig("pkg-config libwslay --cflags --libs") - - if not env["builtin_miniupnpc"]: - # No pkgconfig file so far, hardcode default paths. - env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) - env.Append(LIBS=["miniupnpc"]) - - # On Linux wchar_t should be 32-bits - # 16-bit library shouldn't be required due to compiler optimisations - if not env["builtin_pcre2"]: - env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") - - ## Flags - - # Linkflags below this line should typically stay the last ones - if not env["builtin_zlib"]: - env.ParseConfig("pkg-config zlib --cflags --libs") - - env.Prepend(CPPPATH=["#platform/server"]) - env.Append(CPPDEFINES=["SERVER_ENABLED", "UNIX_ENABLED"]) - - if platform.system() == "Darwin": - env.Append( - LINKFLAGS=[ - "-framework", - "Cocoa", - "-framework", - "Carbon", - "-lz", - "-framework", - "IOKit", - ] - ) - - env.Append(LIBS=["pthread"]) - - if platform.system() == "Linux": - env.Append(LIBS=["dl"]) - - if platform.system().find("BSD") >= 0: - env["execinfo"] = True - - if env["execinfo"]: - env.Append(LIBS=["execinfo"]) - - # Link those statically for portability - if env["use_static_cpp"]: - env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp deleted file mode 100644 index 1ced95fcbc3..00000000000 --- a/platform/server/godot_server.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* godot_server.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "main/main.h" -#include "os_server.h" - -int main(int argc, char *argv[]) { - OS_Server os; - - // We must override main when testing is enabled - TEST_MAIN_OVERRIDE - - Error err = Main::setup(argv[0], argc - 1, &argv[1]); - if (err != OK) - return 255; - - if (Main::start()) - os.run(); // it is actually the OS that decides how to run - Main::cleanup(); - - return os.get_exit_code(); -} diff --git a/platform/server/logo.png b/platform/server/logo.png deleted file mode 100644 index 8666ada9cafcda5a8109e49468ae112d99893eb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2016 zcmV<62Os!}P)o$+Fd<9Yn?cE@3W8Y zuk(L42mfbt@=w|+r=H#U^{;(lnH%ud%%N3%9Lh-t9=bd-n+wF1h>vB5xZftB+fmoKf zEiOQ%QVCO@Ez`mjaQRFTF-=2(8-_uxRzuS@Az5u%^v0Z z>B3#3BV%-Qw&81x$OS732!}&mSV#e2+wT&x6u7)rBu7Ta7$2WtU|^7yE0?ok`EvUE z`|x`GghF9F9-nK<6r6MR6}HbCkc(P41s=do3 z5D1e>X7L9?INl{8q;P18gjq8g71`f!;cz1h7wm{Gp#4MJc;}s035WubNHZR{XW5i( zsOf$J{-ChdgoIAHT%=galFm#Jp1UgtpM4tf{$VyO8K6>50Z3Zh%$vJFKqAEBW8B>MO$uU>gIdUHFC!FG)9 zoyc$9#H?8bwr<;~x&uIz6Y1yC+}uhc8JD_POE4IgV)V66ML_a49k4_R8>ep2*Vjj- zQdJWAJw8km9Mu7m<3qST>j-AHvTVaT0Q{odf(1KJt5(^vbt40V+tgB^-?Ss z-8A$!1e5 zS)wpReuqduht7^}rOfD948JdMD6ss~2w25pQXnq1I{F|>sje*P0I z)1az(Y3!X%LqmfA6j;7|alNajO`Ab;Qwzydg1-JO(uNUQTRV^zeqkyFbf?o#B;15) z)#So?MuvvvLmdYW!re28w6>BN7@$EbVaB(KWD{gE86l`KbLMQ^Za0I2{fv#qr2506 zOpg?GNKHv8?8AVSpGLqe7PIJ@hNi#UhHl#0dX$_lmkT5{GY>kLV$(EYtIOC87FOmj z%$k`5heLq-)Cd+JrfoNi#>OV;prWKNM?l)x>2jG2|O-W+_=u`FM-oY>M;xT?ETB<{lLoW z3h27yL(9(w&^|!GvM^0csUXXPxqE+|m`g9cR1Kn1Ij6p}u~DWr;|GgcT2T?GNBw^J<-K%>AMgQXP!N1r z0TsC^UMf|2>-s8hzH}=9-7O~7YI#y2Q;`w>fTBWFfoXN=l`BQOQWuftrXbJ*gn^W~^Jiez%JSaF=1rS#yz$2Ct`u@xf%KGJ;M8274~Iew4-e7N6=uQ0gGnS)j0~?~ z<>E#36P5|t#o>qS%c?b-c>R@^0VL0Ra^#VRVM@fB!=_X-7yapvfB3Nsr=>t#YUeW_ zOx!o!eCw$*X3jX-<8~jPPNjou)~rSjJOly(bsv~arCGIVCF|F(WBcuQW6r`I@H%UF zJRW5HW)>}a=ZDWc^VGe-_`iKJy6ECd=O1(Q(Wl5ZJW)pTeyLQFZGGFQlq<}hGg}qw zx^?SlZ|@`;jox(g%{Tl+4l_|1&DMY8aO(K(cfWU3b92kdviFbMWtW|&$-MwCyztV} y=bwM}^P)0%->T0000 -#include -#include - -int OS_Server::get_video_driver_count() const { - return 1; -} - -const char *OS_Server::get_video_driver_name(int p_driver) const { - return "Dummy"; -} - -int OS_Server::get_current_video_driver() const { - return video_driver_index; -} - -void OS_Server::initialize_core() { - crash_handler.initialize(); - - OS_Unix::initialize_core(); -} - -Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - args = OS::get_singleton()->get_cmdline_args(); - current_videomode = p_desired; - main_loop = nullptr; - - RasterizerDummy::make_current(); - - video_driver_index = p_video_driver; // unused in server platform, but should still be initialized - - rendering_server = memnew(RenderingServerDefault); - rendering_server->init(); - - AudioDriverManager::initialize(p_audio_driver); - - input = memnew(InputDefault); - - _ensure_user_data_dir(); - - resource_loader_dummy.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_dummy); - - return OK; -} - -void OS_Server::finalize() { - if (main_loop) - memdelete(main_loop); - main_loop = nullptr; - - rendering_server->finish(); - memdelete(rendering_server); - - memdelete(input); - - ResourceLoader::remove_resource_format_loader(resource_loader_dummy); - resource_loader_dummy.unref(); - - args.clear(); -} - -void OS_Server::set_mouse_show(bool p_show) { -} - -void OS_Server::set_mouse_grab(bool p_grab) { - grab = p_grab; -} - -bool OS_Server::is_mouse_grab_enabled() const { - return grab; -} - -int OS_Server::get_mouse_button_state() const { - return 0; -} - -Point2 OS_Server::get_mouse_position() const { - return Point2(); -} - -void OS_Server::set_window_title(const String &p_title) { -} - -void OS_Server::set_video_mode(const VideoMode &p_video_mode, int p_screen) { -} - -OS::VideoMode OS_Server::get_video_mode(int p_screen) const { - return current_videomode; -} - -Size2 OS_Server::get_window_size() const { - return Vector2(current_videomode.width, current_videomode.height); -} - -void OS_Server::get_fullscreen_mode_list(List *p_list, int p_screen) const { -} - -MainLoop *OS_Server::get_main_loop() const { - return main_loop; -} - -void OS_Server::delete_main_loop() { - if (main_loop) - memdelete(main_loop); - main_loop = nullptr; -} - -void OS_Server::set_main_loop(MainLoop *p_main_loop) { - main_loop = p_main_loop; - input->set_main_loop(p_main_loop); -} - -String OS_Server::get_name() const { - return "Server"; -} - -void OS_Server::move_window_to_foreground() { -} - -bool OS_Server::_check_internal_feature_support(const String &p_feature) { - return p_feature == "pc"; -} - -void OS_Server::run() { - force_quit = false; - - if (!main_loop) - return; - - main_loop->init(); - - while (!force_quit) { - if (Main::iteration()) - break; - }; - - main_loop->finish(); -} - -String OS_Server::get_config_path() const { - if (has_environment("XDG_CONFIG_HOME")) { - return get_environment("XDG_CONFIG_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".config"); - } else { - return "."; - } -} - -String OS_Server::get_data_path() const { - if (has_environment("XDG_DATA_HOME")) { - return get_environment("XDG_DATA_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".local/share"); - } else { - return get_config_path(); - } -} - -String OS_Server::get_cache_path() const { - if (has_environment("XDG_CACHE_HOME")) { - return get_environment("XDG_CACHE_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".cache"); - } else { - return get_config_path(); - } -} - -String OS_Server::get_system_dir(SystemDir p_dir) const { - String xdgparam; - - switch (p_dir) { - case SYSTEM_DIR_DESKTOP: { - xdgparam = "DESKTOP"; - } break; - case SYSTEM_DIR_DCIM: { - xdgparam = "PICTURES"; - - } break; - case SYSTEM_DIR_DOCUMENTS: { - xdgparam = "DOCUMENTS"; - - } break; - case SYSTEM_DIR_DOWNLOADS: { - xdgparam = "DOWNLOAD"; - - } break; - case SYSTEM_DIR_MOVIES: { - xdgparam = "VIDEOS"; - - } break; - case SYSTEM_DIR_MUSIC: { - xdgparam = "MUSIC"; - - } break; - case SYSTEM_DIR_PICTURES: { - xdgparam = "PICTURES"; - - } break; - case SYSTEM_DIR_RINGTONES: { - xdgparam = "MUSIC"; - - } break; - } - - String pipe; - List arg; - arg.push_back(xdgparam); - Error err = const_cast(this)->execute("xdg-user-dir", arg, true, nullptr, &pipe); - if (err != OK) - return "."; - return pipe.strip_edges(); -} - -void OS_Server::disable_crash_handler() { - crash_handler.disable(); -} - -bool OS_Server::is_disable_crash_handler() const { - return crash_handler.is_disabled(); -} - -OS_Server::OS_Server() { - //adriver here - grab = false; -}; diff --git a/platform/server/os_server.h b/platform/server/os_server.h deleted file mode 100644 index 61025fa14b4..00000000000 --- a/platform/server/os_server.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************/ -/* os_server.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef OS_SERVER_H -#define OS_SERVER_H - -#include "core/input/input.h" -#include "drivers/dummy/texture_loader_dummy.h" -#include "drivers/unix/os_unix.h" -#ifdef __APPLE__ -#include "platform/osx/crash_handler_osx.h" -#include "platform/osx/semaphore_osx.h" -#else -#include "platform/x11/crash_handler_linuxbsd.h" -#endif -#include "servers/audio_server.h" -#include "servers/rendering/renderer_compositor.h" -#include "servers/rendering_server.h" - -#undef CursorShape - -class OS_Server : public OS_Unix { - RenderingServer *rendering_server = nullptr; - VideoMode current_videomode; - List args; - MainLoop *main_loop = nullptr; - - bool grab = false; - - virtual void delete_main_loop(); - - bool force_quit = false; - - InputDefault *input = nullptr; - - CrashHandler crash_handler; - - int video_driver_index = 0; - - Ref resource_loader_dummy; - -protected: - virtual int get_video_driver_count() const; - virtual const char *get_video_driver_name(int p_driver) const; - virtual int get_current_video_driver() const; - - virtual void initialize_core(); - virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); - virtual void finalize(); - - virtual void set_main_loop(MainLoop *p_main_loop); - -public: - virtual String get_name() const; - - virtual void set_mouse_show(bool p_show); - virtual void set_mouse_grab(bool p_grab); - virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_position() const; - virtual int get_mouse_button_state() const; - virtual void set_window_title(const String &p_title); - - virtual MainLoop *get_main_loop() const; - - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); - virtual VideoMode get_video_mode(int p_screen = 0) const; - virtual void get_fullscreen_mode_list(List *p_list, int p_screen = 0) const; - - virtual Size2 get_window_size() const; - - virtual void move_window_to_foreground(); - - void run(); - - virtual bool _check_internal_feature_support(const String &p_feature); - - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; - - virtual String get_system_dir(SystemDir p_dir) const; - - void disable_crash_handler(); - bool is_disable_crash_handler() const; - - OS_Server(); -}; - -#endif diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h deleted file mode 100644 index 32a19d811b5..00000000000 --- a/platform/server/platform_config.h +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* platform_config.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#if defined(__linux__) || defined(__APPLE__) -#include -#endif - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -#include // alloca -// FreeBSD and OpenBSD use pthread_set_name_np, while other platforms, -// include NetBSD, use pthread_setname_np. NetBSD's version however requires -// a different format, we handle this directly in thread_posix. -#ifdef __NetBSD__ -#define PTHREAD_NETBSD_SET_NAME -#else -#define PTHREAD_BSD_SET_NAME -#endif -#endif - -#ifdef __APPLE__ -#define PTHREAD_RENAME_SELF -#endif