SCsub 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. import os
  4. import editor_builders
  5. Import("env")
  6. env.editor_sources = []
  7. if env.editor_build:
  8. # Generate doc data paths
  9. env.CommandNoCache(
  10. "doc_data_class_path.gen.h", env.Value(env.doc_class_path), env.Run(editor_builders.doc_data_class_path_builder)
  11. )
  12. # Register exporters
  13. gen_exporters = env.CommandNoCache(
  14. "register_exporters.gen.cpp",
  15. env.Value(env.platform_exporters),
  16. env.Run(editor_builders.register_exporters_builder),
  17. )
  18. for e in env.platform_exporters:
  19. # Add all .cpp files in export folder
  20. env.add_source_files(env.editor_sources, f"../platform/{e}/export/*.cpp")
  21. # Core API documentation.
  22. docs = []
  23. docs += Glob("#doc/classes/*.xml")
  24. # Module API documentation.
  25. module_dirs = []
  26. for d in env.doc_class_path.values():
  27. if d not in module_dirs:
  28. module_dirs.append(d)
  29. for d in module_dirs:
  30. if not os.path.isabs(d):
  31. docs += Glob("#" + d + "/*.xml") # Built-in.
  32. else:
  33. docs += Glob(d + "/*.xml") # Custom.
  34. docs = sorted(docs)
  35. env.CommandNoCache(
  36. "#editor/doc_data_compressed.gen.h",
  37. docs,
  38. env.Run(editor_builders.make_doc_header),
  39. )
  40. # Editor interface and class reference translations incur a significant size
  41. # cost for the editor binary (see godot-proposals#3421).
  42. # To limit it, we only include translations with a high enough completion
  43. # ratio (20% for the editor UI, 10% for the class reference).
  44. # Generated with `make include-list` for each resource.
  45. # Editor translations
  46. env.CommandNoCache(
  47. "#editor/editor_translations.gen.h",
  48. Glob("#editor/translations/editor/*"),
  49. env.Run(editor_builders.make_translations_header),
  50. )
  51. # Property translations
  52. env.CommandNoCache(
  53. "#editor/property_translations.gen.h",
  54. Glob("#editor/translations/properties/*"),
  55. env.Run(editor_builders.make_translations_header),
  56. )
  57. # Documentation translations
  58. env.CommandNoCache(
  59. "#editor/doc_translations.gen.h",
  60. Glob("#doc/translations/*"),
  61. env.Run(editor_builders.make_translations_header),
  62. )
  63. # Extractable translations
  64. env.CommandNoCache(
  65. "#editor/extractable_translations.gen.h",
  66. Glob("#editor/translations/extractable/*"),
  67. env.Run(editor_builders.make_translations_header),
  68. )
  69. env.add_source_files(env.editor_sources, "*.cpp")
  70. env.add_source_files(env.editor_sources, gen_exporters)
  71. SConscript("debugger/SCsub")
  72. SConscript("export/SCsub")
  73. SConscript("gui/SCsub")
  74. SConscript("icons/SCsub")
  75. SConscript("import/SCsub")
  76. SConscript("plugins/SCsub")
  77. SConscript("project_manager/SCsub")
  78. SConscript("themes/SCsub")
  79. lib = env.add_library("editor", env.editor_sources)
  80. env.Prepend(LIBS=[lib])