Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/export/plugin_config_apple_embedded.h
9902 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
- **use_swift_runtime**: optional boolean field used to determine if Swift runtime is used
41
42
The `dependencies` and fields are optional.
43
- **linked**: dependencies that should only be linked.
44
- **embedded**: dependencies that should be linked and embedded into application.
45
- **system**: system dependencies that should be linked.
46
- **capabilities**: capabilities that would be used for `UIRequiredDeviceCapabilities` options in Info.plist file.
47
- **files**: files that would be copied into application
48
49
The `plist` section are optional.
50
- **key**: key and value that would be added in Info.plist file.
51
*/
52
53
struct PluginConfigAppleEmbedded {
54
inline static const char *PLUGIN_CONFIG_EXT = ".gdip";
55
56
inline static const char *CONFIG_SECTION = "config";
57
inline static const char *CONFIG_NAME_KEY = "name";
58
inline static const char *CONFIG_BINARY_KEY = "binary";
59
inline static const char *CONFIG_USE_SWIFT_KEY = "use_swift_runtime";
60
inline static const char *CONFIG_INITIALIZE_KEY = "initialization";
61
inline static const char *CONFIG_DEINITIALIZE_KEY = "deinitialization";
62
63
inline static const char *DEPENDENCIES_SECTION = "dependencies";
64
inline static const char *DEPENDENCIES_LINKED_KEY = "linked";
65
inline static const char *DEPENDENCIES_EMBEDDED_KEY = "embedded";
66
inline static const char *DEPENDENCIES_SYSTEM_KEY = "system";
67
inline static const char *DEPENDENCIES_CAPABILITIES_KEY = "capabilities";
68
inline static const char *DEPENDENCIES_FILES_KEY = "files";
69
inline static const char *DEPENDENCIES_LINKER_FLAGS = "linker_flags";
70
71
inline static const char *PLIST_SECTION = "plist";
72
73
enum PlistItemType {
74
UNKNOWN,
75
STRING,
76
INTEGER,
77
BOOLEAN,
78
RAW,
79
STRING_INPUT,
80
};
81
82
struct PlistItem {
83
PlistItemType type;
84
String value;
85
};
86
87
// Set to true when the config file is properly loaded.
88
bool valid_config = false;
89
bool supports_targets = false;
90
// Unix timestamp of last change to this plugin.
91
uint64_t last_updated = 0;
92
93
// Required config section
94
String name;
95
String binary;
96
bool use_swift_runtime;
97
String initialization_method;
98
String deinitialization_method;
99
100
// Optional dependencies section
101
Vector<String> linked_dependencies;
102
Vector<String> embedded_dependencies;
103
Vector<String> system_dependencies;
104
105
Vector<String> files_to_copy;
106
Vector<String> capabilities;
107
108
Vector<String> linker_flags;
109
110
// Optional plist section
111
// String value is default value.
112
// Currently supports `string`, `boolean`, `integer`, `raw`, `string_input` types
113
// <name>:<type> = <value>
114
HashMap<String, PlistItem> plist;
115
116
static String resolve_local_dependency_path(String plugin_config_dir, String dependency_path);
117
118
static String resolve_system_dependency_path(String dependency_path);
119
120
static Vector<String> resolve_local_dependencies(String plugin_config_dir, Vector<String> p_paths);
121
122
static Vector<String> resolve_system_dependencies(Vector<String> p_paths);
123
124
static bool validate_plugin(PluginConfigAppleEmbedded &plugin_config);
125
126
static String get_plugin_main_binary(PluginConfigAppleEmbedded &plugin_config, bool p_debug);
127
128
static uint64_t get_plugin_modification_time(const PluginConfigAppleEmbedded &plugin_config, const String &config_path);
129
130
static PluginConfigAppleEmbedded load_plugin_config(Ref<ConfigFile> config_file, const String &path);
131
};
132
133