Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/export/plugin_config_apple_embedded.h
20951 views
1
/**************************************************************************/
2
/* plugin_config_apple_embedded.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "core/io/config_file.h"
34
#include "core/string/ustring.h"
35
36
/*
37
The `config` section and fields are required and defined as follow:
38
- **name**: name of the plugin
39
- **binary**: path to static `.a` library
40
41
The `dependencies` and fields are optional.
42
- **linked**: dependencies that should only be linked.
43
- **embedded**: dependencies that should be linked and embedded into application.
44
- **system**: system dependencies that should be linked.
45
- **capabilities**: capabilities that would be used for `UIRequiredDeviceCapabilities` options in Info.plist file.
46
- **files**: files that would be copied into application
47
48
The `plist` section are optional.
49
- **key**: key and value that would be added in Info.plist file.
50
*/
51
52
struct PluginConfigAppleEmbedded {
53
inline static const char *PLUGIN_CONFIG_EXT = ".gdip";
54
55
inline static const char *CONFIG_SECTION = "config";
56
inline static const char *CONFIG_NAME_KEY = "name";
57
inline static const char *CONFIG_BINARY_KEY = "binary";
58
inline static const char *CONFIG_INITIALIZE_KEY = "initialization";
59
inline static const char *CONFIG_DEINITIALIZE_KEY = "deinitialization";
60
61
inline static const char *DEPENDENCIES_SECTION = "dependencies";
62
inline static const char *DEPENDENCIES_LINKED_KEY = "linked";
63
inline static const char *DEPENDENCIES_EMBEDDED_KEY = "embedded";
64
inline static const char *DEPENDENCIES_SYSTEM_KEY = "system";
65
inline static const char *DEPENDENCIES_CAPABILITIES_KEY = "capabilities";
66
inline static const char *DEPENDENCIES_FILES_KEY = "files";
67
inline static const char *DEPENDENCIES_LINKER_FLAGS = "linker_flags";
68
69
inline static const char *PLIST_SECTION = "plist";
70
71
enum PlistItemType {
72
UNKNOWN,
73
STRING,
74
INTEGER,
75
BOOLEAN,
76
RAW,
77
STRING_INPUT,
78
};
79
80
struct PlistItem {
81
PlistItemType type;
82
String value;
83
};
84
85
// Set to true when the config file is properly loaded.
86
bool valid_config = false;
87
bool supports_targets = false;
88
// Unix timestamp of last change to this plugin.
89
uint64_t last_updated = 0;
90
91
// Required config section
92
String name;
93
String binary;
94
String initialization_method;
95
String deinitialization_method;
96
97
// Optional dependencies section
98
Vector<String> linked_dependencies;
99
Vector<String> embedded_dependencies;
100
Vector<String> system_dependencies;
101
102
Vector<String> files_to_copy;
103
Vector<String> capabilities;
104
105
Vector<String> linker_flags;
106
107
// Optional plist section
108
// String value is default value.
109
// Currently supports `string`, `boolean`, `integer`, `raw`, `string_input` types
110
// <name>:<type> = <value>
111
HashMap<String, PlistItem> plist;
112
113
static String resolve_local_dependency_path(String plugin_config_dir, String dependency_path);
114
115
static String resolve_system_dependency_path(String dependency_path);
116
117
static Vector<String> resolve_local_dependencies(String plugin_config_dir, Vector<String> p_paths);
118
119
static Vector<String> resolve_system_dependencies(Vector<String> p_paths);
120
121
static bool validate_plugin(PluginConfigAppleEmbedded &plugin_config);
122
123
static String get_plugin_main_binary(PluginConfigAppleEmbedded &plugin_config, bool p_debug);
124
125
static uint64_t get_plugin_modification_time(const PluginConfigAppleEmbedded &plugin_config, const String &config_path);
126
127
static PluginConfigAppleEmbedded load_plugin_config(Ref<ConfigFile> config_file, const String &path);
128
};
129
130