Skip to content
0.2.0-dev Download ZIP
102 lines ·3.3 KB Raw
1#!/usr/bin/env python
2from misc.utility.scons_hints import *
3
4import os
5
6import editor_builders
7
8Import("env")
9
10env.editor_sources = []
11
12if env.editor_build:
13 # Generate doc data paths
14 env.CommandNoCache(
15 "doc/doc_data_class_path.gen.h",
16 env.Value(env.doc_class_path),
17 env.Run(editor_builders.doc_data_class_path_builder),
18 )
19
20 # Register exporters
21 gen_exporters = env.CommandNoCache(
22 "export/register_exporters.gen.cpp",
23 env.Value(env.platform_exporters),
24 env.Run(editor_builders.register_exporters_builder),
25 )
26 for e in env.platform_exporters:
27 # Add all .cpp files in export folder
28 env.add_source_files(env.editor_sources, f"../platform/{e}/export/*.cpp")
29
30 # Core API documentation.
31 docs = []
32 docs += Glob("#doc/classes/*.xml")
33
34 # Module API documentation.
35 module_dirs = []
36 for d in env.doc_class_path.values():
37 if d not in module_dirs:
38 module_dirs.append(d)
39
40 for d in module_dirs:
41 if not os.path.isabs(d):
42 docs += Glob("#" + d + "/*.xml") # Built-in.
43 else:
44 docs += Glob(d + "/*.xml") # Custom.
45
46 docs = sorted(docs)
47 env.CommandNoCache(
48 "#editor/doc/doc_data_compressed.gen.h",
49 docs,
50 env.Run(editor_builders.make_doc_header),
51 )
52
53 # Editor interface and class reference translations incur a significant size
54 # cost for the editor binary (see godot-proposals#3421).
55 # To limit it, we only include translations with a high enough completion
56 # ratio (20% for the editor UI, 10% for the class reference).
57 # Generated with `make include-list` for each resource.
58
59 translation_targets = {
60 "#editor/translations/editor_translations.gen.cpp": Glob("#editor/translations/editor/*"),
61 "#editor/translations/property_translations.gen.cpp": Glob("#editor/translations/properties/*"),
62 "#editor/translations/doc_translations.gen.cpp": Glob("#doc/translations/*"),
63 "#editor/translations/extractable_translations.gen.cpp": Glob("#editor/translations/extractable/*"),
64 }
65 for target_cpp, sources in translation_targets.items():
66 target_h = os.path.splitext(target_cpp)[0] + ".h"
67 env.CommandNoCache(
68 [target_h, target_cpp],
69 sources,
70 env.Run(editor_builders.make_translations),
71 )
72
73 env.add_source_files(env.editor_sources, "*.cpp")
74 env.add_source_files(env.editor_sources, gen_exporters)
75 env.add_source_files(env.editor_sources, translation_targets.keys())
76
77 SConscript("animation/SCsub")
78 SConscript("asset_library/SCsub")
79 SConscript("audio/SCsub")
80 SConscript("debugger/SCsub")
81 SConscript("doc/SCsub")
82 SConscript("docks/SCsub")
83 SConscript("export/SCsub")
84 SConscript("file_system/SCsub")
85 SConscript("gui/SCsub")
86 SConscript("icons/SCsub")
87 SConscript("inspector/SCsub")
88 SConscript("import/SCsub")
89 SConscript("plugins/SCsub")
90 SConscript("project_manager/SCsub")
91 SConscript("project_upgrade/SCsub")
92 SConscript("run/SCsub")
93 SConscript("settings/SCsub")
94 SConscript("scene/SCsub")
95 SConscript("script/SCsub")
96 SConscript("shader/SCsub")
97 SConscript("themes/SCsub")
98 SConscript("translations/SCsub")
99 SConscript("version_control/SCsub")
100
101 lib = env.add_library("editor", env.editor_sources)
102 env.Prepend(LIBS=[lib])