Style: Harmonize header includes in platform ports

This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module should be included with relative
paths (relative to the root folder of the modular component, e.g.
`platform/linuxbsd/`), in their own section before Godot's "core" includes.

The `api` and `export` subfolders also need to be handled as self-contained
(and thus use relative paths for their "local" includes) as they are all
compiled for each editor platform, without necessarily having the api/export
matching platform folder in the include path.
E.g. the Linux editor build will compile `platform/android/{api,export}/*.cpp`
and those need to use relative includes for it to work.
This commit is contained in:
Rémi Verschelde 2023-06-08 14:51:32 +02:00
parent 2985a9ac34
commit 9e4315bb50
No known key found for this signature in database
GPG key ID: C3336907360768E1
116 changed files with 372 additions and 309 deletions

View file

@ -31,8 +31,6 @@
#ifndef DISPLAY_SERVER_MACOS_H
#define DISPLAY_SERVER_MACOS_H
#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
#include "core/input/input.h"
#include "servers/display_server.h"
@ -41,10 +39,13 @@
#endif // GLES3_ENABLED
#if defined(VULKAN_ENABLED)
#include "vulkan_context_macos.h"
#include "drivers/vulkan/rendering_device_vulkan.h"
#include "platform/macos/vulkan_context_macos.h"
#endif // VULKAN_ENABLED
#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
#import <AppKit/AppKit.h>
#import <AppKit/NSCursor.h>
#import <ApplicationServices/ApplicationServices.h>

View file

@ -38,7 +38,6 @@
#include "godot_window_delegate.h"
#include "key_mapping_macos.h"
#include "os_macos.h"
#include "tts_macos.h"
#include "core/config/project_settings.h"
@ -48,13 +47,6 @@
#include "main/main.h"
#include "scene/resources/texture.h"
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/hid/IOHIDKeys.h>
#import <IOKit/hid/IOHIDLib.h>
#if defined(GLES3_ENABLED)
#include "drivers/gles3/rasterizer_gles3.h"
#endif
@ -63,6 +55,13 @@
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#endif
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/hid/IOHIDKeys.h>
#import <IOKit/hid/IOHIDLib.h>
const NSMenu *DisplayServerMacOS::_get_menu_root(const String &p_menu_root) const {
const NSMenu *menu = nullptr;
if (p_menu_root == "" || p_menu_root.to_lower() == "_main") {

View file

@ -41,6 +41,8 @@
// - Requirements code generator is not implemented (only hard-coded requirements for the ad-hoc signing is supported).
// - RFC5652/CMS blob generation is not implemented, supports ad-hoc signing only.
#include "plist.h"
#include "core/crypto/crypto_core.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
@ -51,8 +53,6 @@
#include "modules/regex/regex.h"
#endif
#include "plist.h"
#ifdef MODULE_REGEX_ENABLED
/*************************************************************************/

View file

@ -30,6 +30,8 @@
#include "export_plugin.h"
#include "../logo_svg.gen.h"
#include "../run_icon_svg.gen.h"
#include "codesign.h"
#include "lipo.h"
#include "macho.h"
@ -39,8 +41,6 @@
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
#include "platform/macos/logo_svg.gen.h"
#include "platform/macos/run_icon_svg.gen.h"
#include "modules/modules_enabled.gen.h" // For svg and regex.
#ifdef MODULE_SVG_ENABLED

View file

@ -33,11 +33,11 @@
// Universal / Universal 2 fat binary file creator and extractor.
#include "macho.h"
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
#include "macho.h"
class LipO : public RefCounted {
struct FatArch {
uint32_t cputype;

View file

@ -33,9 +33,6 @@
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
#include "core/error/error_list.h"
#include "core/os/os.h"
#include "core/templates/local_vector.h"
@ -45,6 +42,9 @@
#import <ApplicationServices/ApplicationServices.h>
#import <CoreVideo/CoreVideo.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
class GLManager_MacOS {
public:
enum ContextType {

View file

@ -30,15 +30,14 @@
#include "gl_manager_macos_legacy.h"
#ifdef MACOS_ENABLED
#ifdef GLES3_ENABLED
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
#include <stdio.h>
#include <stdlib.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
Error GLManager_MacOS::create_context(GLWindow &win) {
NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFADoubleBuffer,
@ -237,5 +236,4 @@ GLManager_MacOS::~GLManager_MacOS() {
#pragma clang diagnostic pop
#endif // GLES3_ENABLED
#endif // MACOS_ENABLED
#endif // MACOS_ENABLED && GLES3_ENABLED

View file

@ -32,6 +32,7 @@
#include "display_server_macos.h"
#include "key_mapping_macos.h"
#include "main/main.h"
@implementation GodotContentLayerDelegate

View file

@ -28,10 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "main/main.h"
#include "os_macos.h"
#include "main/main.h"
#include <string.h>
#include <unistd.h>

View file

@ -31,13 +31,13 @@
#ifndef JOYPAD_MACOS_H
#define JOYPAD_MACOS_H
#include "core/input/input.h"
#import <ForceFeedback/ForceFeedback.h>
#import <ForceFeedback/ForceFeedbackConstants.h>
#import <IOKit/hid/IOHIDLib.h>
#import <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
#include "core/input/input.h"
struct rec_element {
IOHIDElementRef ref;
IOHIDElementCookie cookie;

View file

@ -30,12 +30,12 @@
#include "key_mapping_macos.h"
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#include "core/templates/hash_map.h"
#include "core/templates/hash_set.h"
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
struct HashMapHasherKeys {
static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(p_uchar); }

View file

@ -31,12 +31,13 @@
#ifndef OS_MACOS_H
#define OS_MACOS_H
#include "core/input/input.h"
#include "crash_handler_macos.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/coremidi/midi_driver_coremidi.h"
#include "drivers/unix/os_unix.h"
#include "joypad_macos.h"
#include "core/input/input.h"
#import "drivers/coreaudio/audio_driver_coreaudio.h"
#import "drivers/coremidi/midi_driver_coremidi.h"
#include "drivers/unix/os_unix.h"
#include "servers/audio_server.h"
class OS_MacOS : public OS_Unix {

View file

@ -30,16 +30,16 @@
#include "os_macos.h"
#include "core/crypto/crypto_core.h"
#include "core/version_generated.gen.h"
#include "main/main.h"
#include "dir_access_macos.h"
#include "display_server_macos.h"
#include "godot_application.h"
#include "godot_application_delegate.h"
#include "macos_terminal_logger.h"
#include "core/crypto/crypto_core.h"
#include "core/version_generated.gen.h"
#include "main/main.h"
#include <dlfcn.h>
#include <libproc.h>
#include <mach-o/dyld.h>

View file

@ -34,6 +34,7 @@
#ifdef VULKAN_ENABLED
#include "drivers/vulkan/vulkan_context.h"
#import <AppKit/AppKit.h>
class VulkanContextMacOS : public VulkanContext {

View file

@ -28,8 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifdef VULKAN_ENABLED
#include "vulkan_context_macos.h"
#ifdef VULKAN_ENABLED
#ifdef USE_VOLK
#include <volk.h>
#else