summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct18
-rw-r--r--editor/editor_build_profile.cpp130
-rw-r--r--editor/editor_build_profile.h20
-rw-r--r--modules/freetype/SCsub33
-rw-r--r--modules/freetype/config.py8
-rw-r--r--modules/mono/config.py50
-rw-r--r--modules/text_server_adv/SCsub11
-rw-r--r--modules/text_server_adv/config.py8
8 files changed, 208 insertions, 70 deletions
diff --git a/SConstruct b/SConstruct
index 0fd9326e1c..17184c2e36 100644
--- a/SConstruct
+++ b/SConstruct
@@ -337,21 +337,27 @@ for path in module_search_paths:
# Add module options.
for name, path in modules_detected.items():
+ sys.path.insert(0, path)
+ import config
+
if env_base["modules_enabled_by_default"]:
enabled = True
-
- sys.path.insert(0, path)
- import config
-
try:
enabled = config.is_enabled()
except AttributeError:
pass
- sys.path.remove(path)
- sys.modules.pop("config")
else:
enabled = False
+ # Add module-specific options.
+ try:
+ for opt in config.get_opts(selected_platform):
+ opts.Add(opt)
+ except AttributeError:
+ pass
+
+ sys.path.remove(path)
+ sys.modules.pop("config")
opts.Add(BoolVariable("module_" + name + "_enabled", "Enable module '%s'" % (name,), enabled))
methods.write_modules(modules_detected)
diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp
index d093ab518e..0f0ab4a339 100644
--- a/editor/editor_build_profile.cpp
+++ b/editor/editor_build_profile.cpp
@@ -46,19 +46,68 @@ const char *EditorBuildProfile::build_option_identifiers[BUILD_OPTION_MAX] = {
"disable_3d_physics",
"disable_navigation",
"openxr",
+ "rendering_device", // FIXME: there's no scons option to disable rendering device
"opengl3",
"vulkan",
+ "module_text_server_fb_enabled",
+ "module_text_server_adv_enabled",
+ "module_freetype_enabled",
+ "brotli",
+ "graphite",
+ "module_msdfgen_enabled"
+};
+
+const bool EditorBuildProfile::build_option_disabled_by_default[BUILD_OPTION_MAX] = {
+ // This maps to SCons build options.
+ false, // 3D
+ false, // PHYSICS_2D
+ false, // PHYSICS_3D
+ false, // NAVIGATION
+ false, // XR
+ false, // RENDERING_DEVICE
+ false, // OPENGL
+ false, // VULKAN
+ true, // TEXT_SERVER_FALLBACK
+ false, // TEXT_SERVER_COMPLEX
+ false, // DYNAMIC_FONTS
+ false, // WOFF2_FONTS
+ false, // GRPAHITE_FONTS
+ false, // MSDFGEN
};
const bool EditorBuildProfile::build_option_disable_values[BUILD_OPTION_MAX] = {
// This maps to SCons build options.
- true,
- true,
- true,
- true,
- false,
- false,
- false
+ true, // 3D
+ true, // PHYSICS_2D
+ true, // PHYSICS_3D
+ true, // NAVIGATION
+ false, // XR
+ false, // RENDERING_DEVICE
+ false, // OPENGL
+ false, // VULKAN
+ false, // TEXT_SERVER_FALLBACK
+ false, // TEXT_SERVER_COMPLEX
+ false, // DYNAMIC_FONTS
+ false, // WOFF2_FONTS
+ false, // GRPAHITE_FONTS
+ false, // MSDFGEN
+};
+
+const EditorBuildProfile::BuildOptionCategory EditorBuildProfile::build_option_category[BUILD_OPTION_MAX] = {
+ BUILD_OPTION_CATEGORY_GENERAL, // 3D
+ BUILD_OPTION_CATEGORY_GENERAL, // PHYSICS_2D
+ BUILD_OPTION_CATEGORY_GENERAL, // PHYSICS_3D
+ BUILD_OPTION_CATEGORY_GENERAL, // NAVIGATION
+ BUILD_OPTION_CATEGORY_GENERAL, // XR
+ BUILD_OPTION_CATEGORY_GENERAL, // RENDERING_DEVICE
+ BUILD_OPTION_CATEGORY_GENERAL, // OPENGL
+ BUILD_OPTION_CATEGORY_GENERAL, // VULKAN
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // TEXT_SERVER_FALLBACK
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // TEXT_SERVER_COMPLEX
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // DYNAMIC_FONTS
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // WOFF2_FONTS
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // GRPAHITE_FONTS
+ BUILD_OPTION_CATEGORY_TEXT_SERVER, // MSDFGEN
};
void EditorBuildProfile::set_disable_class(const StringName &p_class, bool p_disabled) {
@@ -127,6 +176,12 @@ String EditorBuildProfile::get_build_option_name(BuildOption p_build_option) {
TTRC("RenderingDevice"),
TTRC("OpenGL"),
TTRC("Vulkan"),
+ TTRC("Text Server: Fallback"),
+ TTRC("Text Server: Advanced"),
+ TTRC("TTF, OTF, Type 1, WOFF1 Fonts"),
+ TTRC("WOFF2 Fonts"),
+ TTRC("SIL Graphite Fonts"),
+ TTRC("Multi-channel Signed Distance Field Font Rendering"),
};
return TTRGET(build_option_names[p_build_option]);
}
@@ -143,11 +198,33 @@ String EditorBuildProfile::get_build_option_description(BuildOption p_build_opti
TTRC("RenderingDevice based rendering (if disabled, the OpenGL back-end is required)."),
TTRC("OpenGL back-end (if disabled, the RenderingDevice back-end is required)."),
TTRC("Vulkan back-end of RenderingDevice."),
+ TTRC("Fallback implementation of Text Server\nSupports basic text layouts."),
+ TTRC("Text Server implementation powered by ICU and HarfBuzz libraries.\nSupports complex text layouts, BiDi, and contextual OpenType font features."),
+ TTRC("TrueType, OpenType, Type 1, and WOFF1 font format support using FreeType library (if disabled, WOFF2 support is also disabled)."),
+ TTRC("WOFF2 font format support using FreeType and Brotli libraries."),
+ TTRC("SIL Graphite smart font technology support (supported by Advanced Text Server only)."),
+ TTRC("Multi-channel signed distance field font rendering support using msdfgen library (pre-rendered MSDF fonts can be used even if this option disabled)."),
};
return TTRGET(build_option_descriptions[p_build_option]);
}
+EditorBuildProfile::BuildOptionCategory EditorBuildProfile::get_build_option_category(BuildOption p_build_option) {
+ ERR_FAIL_INDEX_V(p_build_option, BUILD_OPTION_MAX, BUILD_OPTION_CATEGORY_GENERAL);
+ return build_option_category[p_build_option];
+}
+
+String EditorBuildProfile::get_build_option_category_name(BuildOptionCategory p_build_option_category) {
+ ERR_FAIL_INDEX_V(p_build_option_category, BUILD_OPTION_CATEGORY_MAX, String());
+
+ const char *build_option_subcategories[BUILD_OPTION_CATEGORY_MAX]{
+ TTRC("General Features:"),
+ TTRC("Text Rendering and Font Options:"),
+ };
+
+ return TTRGET(build_option_subcategories[p_build_option_category]);
+}
+
Error EditorBuildProfile::save_to_file(const String &p_path) {
Dictionary data;
data["type"] = "build_profile";
@@ -160,8 +237,12 @@ Error EditorBuildProfile::save_to_file(const String &p_path) {
Dictionary dis_build_options;
for (int i = 0; i < BUILD_OPTION_MAX; i++) {
- if (build_options_disabled[i]) {
- dis_build_options[build_option_identifiers[i]] = build_option_disable_values[i];
+ if (build_options_disabled[i] != build_option_disabled_by_default[i]) {
+ if (build_options_disabled[i]) {
+ dis_build_options[build_option_identifiers[i]] = build_option_disable_values[i];
+ } else {
+ dis_build_options[build_option_identifiers[i]] = !build_option_disable_values[i];
+ }
}
}
@@ -211,7 +292,7 @@ Error EditorBuildProfile::load_from_file(const String &p_path) {
}
for (int i = 0; i < BUILD_OPTION_MAX; i++) {
- build_options_disabled[i] = false;
+ build_options_disabled[i] = build_option_disabled_by_default[i];
}
if (data.has("disabled_build_options")) {
@@ -259,10 +340,24 @@ void EditorBuildProfile::_bind_methods() {
BIND_ENUM_CONSTANT(BUILD_OPTION_RENDERING_DEVICE);
BIND_ENUM_CONSTANT(BUILD_OPTION_OPENGL);
BIND_ENUM_CONSTANT(BUILD_OPTION_VULKAN);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_TEXT_SERVER_FALLBACK);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_TEXT_SERVER_ADVANCED);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_DYNAMIC_FONTS);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_WOFF2_FONTS);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_GRPAHITE_FONTS);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_MSDFGEN);
BIND_ENUM_CONSTANT(BUILD_OPTION_MAX);
+
+ BIND_ENUM_CONSTANT(BUILD_OPTION_CATEGORY_GENERAL);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_CATEGORY_TEXT_SERVER);
+ BIND_ENUM_CONSTANT(BUILD_OPTION_CATEGORY_MAX);
}
-EditorBuildProfile::EditorBuildProfile() {}
+EditorBuildProfile::EditorBuildProfile() {
+ for (int i = 0; i < EditorBuildProfile::BUILD_OPTION_MAX; i++) {
+ build_options_disabled[i] = build_option_disabled_by_default[i];
+ }
+}
//////////////////////////
@@ -633,11 +728,18 @@ void EditorBuildProfileManager::_update_edited_profile() {
TreeItem *root = class_list->create_item();
- TreeItem *build_options = class_list->create_item(root);
- build_options->set_text(0, TTR("General Features:"));
+ HashMap<EditorBuildProfile::BuildOptionCategory, TreeItem *> subcats;
+ for (int i = 0; i < EditorBuildProfile::BUILD_OPTION_CATEGORY_MAX; i++) {
+ TreeItem *build_cat;
+ build_cat = class_list->create_item(root);
+
+ build_cat->set_text(0, EditorBuildProfile::get_build_option_category_name(EditorBuildProfile::BuildOptionCategory(i)));
+ subcats[EditorBuildProfile::BuildOptionCategory(i)] = build_cat;
+ }
+
for (int i = 0; i < EditorBuildProfile::BUILD_OPTION_MAX; i++) {
TreeItem *build_option;
- build_option = class_list->create_item(build_options);
+ build_option = class_list->create_item(subcats[EditorBuildProfile::get_build_option_category(EditorBuildProfile::BuildOption(i))]);
build_option->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
build_option->set_text(0, EditorBuildProfile::get_build_option_name(EditorBuildProfile::BuildOption(i)));
diff --git a/editor/editor_build_profile.h b/editor/editor_build_profile.h
index bb6494b8c9..606c415429 100644
--- a/editor/editor_build_profile.h
+++ b/editor/editor_build_profile.h
@@ -53,7 +53,19 @@ public:
BUILD_OPTION_RENDERING_DEVICE,
BUILD_OPTION_OPENGL,
BUILD_OPTION_VULKAN,
- BUILD_OPTION_MAX
+ BUILD_OPTION_TEXT_SERVER_FALLBACK,
+ BUILD_OPTION_TEXT_SERVER_ADVANCED,
+ BUILD_OPTION_DYNAMIC_FONTS,
+ BUILD_OPTION_WOFF2_FONTS,
+ BUILD_OPTION_GRPAHITE_FONTS,
+ BUILD_OPTION_MSDFGEN,
+ BUILD_OPTION_MAX,
+ };
+
+ enum BuildOptionCategory {
+ BUILD_OPTION_CATEGORY_GENERAL,
+ BUILD_OPTION_CATEGORY_TEXT_SERVER,
+ BUILD_OPTION_CATEGORY_MAX,
};
private:
@@ -65,7 +77,9 @@ private:
bool build_options_disabled[BUILD_OPTION_MAX] = {};
static const char *build_option_identifiers[BUILD_OPTION_MAX];
+ static const bool build_option_disabled_by_default[BUILD_OPTION_MAX];
static const bool build_option_disable_values[BUILD_OPTION_MAX];
+ static const BuildOptionCategory build_option_category[BUILD_OPTION_MAX];
String _get_build_option_name(BuildOption p_build_option) { return get_build_option_name(p_build_option); }
@@ -93,11 +107,15 @@ public:
static String get_build_option_name(BuildOption p_build_option);
static String get_build_option_description(BuildOption p_build_option);
static bool get_build_option_disable_value(BuildOption p_build_option);
+ static BuildOptionCategory get_build_option_category(BuildOption p_build_option);
+
+ static String get_build_option_category_name(BuildOptionCategory p_build_option_category);
EditorBuildProfile();
};
VARIANT_ENUM_CAST(EditorBuildProfile::BuildOption)
+VARIANT_ENUM_CAST(EditorBuildProfile::BuildOptionCategory)
class EditorFileSystemDirectory;
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 4b2ea6faa5..8efcd72fb6 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -58,22 +58,23 @@ if env["builtin_freetype"]:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- thirdparty_brotli_dir = "#thirdparty/brotli/"
- thirdparty_brotli_sources = [
- "common/constants.c",
- "common/context.c",
- "common/dictionary.c",
- "common/platform.c",
- "common/shared_dictionary.c",
- "common/transform.c",
- "dec/bit_reader.c",
- "dec/decode.c",
- "dec/huffman.c",
- "dec/state.c",
- ]
- thirdparty_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
- env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
- env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
+ if env["brotli"]:
+ thirdparty_brotli_dir = "#thirdparty/brotli/"
+ thirdparty_brotli_sources = [
+ "common/constants.c",
+ "common/context.c",
+ "common/dictionary.c",
+ "common/platform.c",
+ "common/shared_dictionary.c",
+ "common/transform.c",
+ "dec/bit_reader.c",
+ "dec/decode.c",
+ "dec/huffman.c",
+ "dec/state.c",
+ ]
+ thirdparty_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
+ env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
+ env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
if env.get("use_ubsan") or env.get("use_asan") or env.get("use_tsan") or env.get("use_lsan") or env.get("use_msan"):
env_freetype.Append(CPPDEFINES=["BROTLI_BUILD_PORTABLE"])
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
index d22f9454ed..c0586d5536 100644
--- a/modules/freetype/config.py
+++ b/modules/freetype/config.py
@@ -2,5 +2,13 @@ def can_build(env, platform):
return True
+def get_opts(platform):
+ from SCons.Variables import BoolVariable
+
+ return [
+ BoolVariable("brotli", "Enable Brotli decompressor for WOFF2 fonts support", True),
+ ]
+
+
def configure(env):
pass
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 3e6584590c..d895d2d92d 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -5,52 +5,44 @@ def can_build(env, platform):
return not env["arch"].startswith("rv")
-def configure(env):
- platform = env["platform"]
-
- if platform not in supported_platforms:
- raise RuntimeError("This module does not currently support building for this platform")
-
- env.add_module_version_string("mono")
-
- from SCons.Script import BoolVariable, PathVariable, Variables, Help
+def get_opts(platform):
+ from SCons.Variables import BoolVariable, PathVariable
default_mono_static = platform in ["ios", "javascript"]
default_mono_bundles_zlib = platform in ["javascript"]
- envvars = Variables()
- envvars.Add(
+ return [
PathVariable(
"mono_prefix",
"Path to the Mono installation directory for the target platform and architecture",
"",
PathVariable.PathAccept,
- )
- )
- envvars.Add(
+ ),
PathVariable(
"mono_bcl",
"Path to a custom Mono BCL (Base Class Library) directory for the target platform",
"",
PathVariable.PathAccept,
- )
- )
- envvars.Add(BoolVariable("mono_static", "Statically link Mono", default_mono_static))
- envvars.Add(BoolVariable("mono_glue", "Build with the Mono glue sources", True))
- envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))
- envvars.Add(
- BoolVariable("copy_mono_root", "Make a copy of the Mono installation directory to bundle with the editor", True)
- )
-
- # TODO: It would be great if this could be detected automatically instead
- envvars.Add(
+ ),
+ BoolVariable("mono_static", "Statically link Mono", default_mono_static),
+ BoolVariable("mono_glue", "Build with the Mono glue sources", True),
+ BoolVariable("build_cil", "Build C# solutions", True),
+ BoolVariable(
+ "copy_mono_root", "Make a copy of the Mono installation directory to bundle with the editor", True
+ ),
BoolVariable(
"mono_bundles_zlib", "Specify if the Mono runtime was built with bundled zlib", default_mono_bundles_zlib
- )
- )
+ ),
+ ]
+
+
+def configure(env):
+ platform = env["platform"]
- envvars.Update(env)
- Help(envvars.GenerateHelpText(env))
+ if platform not in supported_platforms:
+ raise RuntimeError("This module does not currently support building for this platform")
+
+ env.add_module_version_string("mono")
if env["mono_bundles_zlib"]:
# Mono may come with zlib bundled for WASM or on newer version when built with MinGW.
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index 73e5c2bf74..c514ebcd1b 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -113,8 +113,11 @@ if env["builtin_harfbuzz"]:
if freetype_enabled:
thirdparty_sources += [
"src/hb-ft.cc",
- "src/hb-graphite2.cc",
]
+ if env["graphite"]:
+ thirdparty_sources += [
+ "src/hb-graphite2.cc",
+ ]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_harfbuzz.Prepend(CPPPATH=["#thirdparty/harfbuzz/src"])
@@ -133,7 +136,7 @@ if env["builtin_harfbuzz"]:
)
if env["builtin_freetype"]:
env_harfbuzz.Prepend(CPPPATH=["#thirdparty/freetype/include"])
- if env["builtin_graphite"]:
+ if env["builtin_graphite"] and env["graphite"]:
env_harfbuzz.Prepend(CPPPATH=["#thirdparty/graphite/include"])
env_harfbuzz.Append(CCFLAGS=["-DGRAPHITE2_STATIC"])
@@ -165,7 +168,7 @@ if env["builtin_harfbuzz"]:
env.Append(LIBS=[lib])
-if env["builtin_graphite"] and freetype_enabled:
+if env["builtin_graphite"] and freetype_enabled and env["graphite"]:
env_graphite = env_modules.Clone()
env_graphite.disable_warnings()
@@ -514,7 +517,7 @@ if env["builtin_msdfgen"] and msdfgen_enabled:
if env["builtin_freetype"] and freetype_enabled:
env_text_server_adv.Prepend(CPPPATH=["#thirdparty/freetype/include"])
-if env["builtin_graphite"] and freetype_enabled:
+if env["builtin_graphite"] and freetype_enabled and env["graphite"]:
env_text_server_adv.Prepend(CPPPATH=["#thirdparty/graphite/include"])
env_text_server_adv.add_source_files(module_obj, "*.cpp")
diff --git a/modules/text_server_adv/config.py b/modules/text_server_adv/config.py
index 8c8df9b05e..179a2ff378 100644
--- a/modules/text_server_adv/config.py
+++ b/modules/text_server_adv/config.py
@@ -2,6 +2,14 @@ def can_build(env, platform):
return True
+def get_opts(platform):
+ from SCons.Variables import BoolVariable
+
+ return [
+ BoolVariable("graphite", "Enable SIL Graphite smart fonts support", True),
+ ]
+
+
def configure(env):
pass