SCsub 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/usr/bin/env python
  2. Import("env")
  3. env.editor_sources = []
  4. import os
  5. import os.path
  6. import glob
  7. from platform_methods import run_in_subprocess
  8. from compat import open_utf8
  9. import editor_builders
  10. def _make_doc_data_class_path(to_path):
  11. # NOTE: It is safe to generate this file here, since this is still executed serially
  12. g = open_utf8(os.path.join(to_path, "doc_data_class_path.gen.h"), "w")
  13. g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n")
  14. g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
  15. g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n")
  16. for c in sorted(env.doc_class_path):
  17. g.write('\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n')
  18. g.write("\t{NULL, NULL}\n")
  19. g.write("};\n")
  20. g.close()
  21. if env["tools"]:
  22. # Register exporters
  23. reg_exporters_inc = '#include "register_exporters.h"\n'
  24. reg_exporters = "void register_exporters() {\n"
  25. for e in env.platform_exporters:
  26. env.add_source_files(env.editor_sources, "#platform/" + e + "/export/export.cpp")
  27. reg_exporters += "\tregister_" + e + "_exporter();\n"
  28. reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
  29. reg_exporters += "}\n"
  30. # NOTE: It is safe to generate this file here, since this is still executed serially
  31. with open_utf8("register_exporters.gen.cpp", "w") as f:
  32. f.write(reg_exporters_inc)
  33. f.write(reg_exporters)
  34. # Core API documentation.
  35. docs = []
  36. docs += Glob("#doc/classes/*.xml")
  37. # Module API documentation.
  38. module_dirs = []
  39. for d in env.doc_class_path.values():
  40. if d not in module_dirs:
  41. module_dirs.append(d)
  42. for d in module_dirs:
  43. if not os.path.isabs(d):
  44. docs += Glob("#" + d + "/*.xml") # Built-in.
  45. else:
  46. docs += Glob(d + "/*.xml") # Custom.
  47. _make_doc_data_class_path(os.path.join(env.Dir("#").abspath, "editor/doc"))
  48. docs = sorted(docs)
  49. env.Depends("#editor/doc_data_compressed.gen.h", docs)
  50. env.CommandNoCache("#editor/doc_data_compressed.gen.h", docs, run_in_subprocess(editor_builders.make_doc_header))
  51. path = env.Dir(".").abspath
  52. # Translations
  53. tlist = glob.glob(path + "/translations/*.po")
  54. env.Depends("#editor/translations.gen.h", tlist)
  55. env.CommandNoCache("#editor/translations.gen.h", tlist, run_in_subprocess(editor_builders.make_translations_header))
  56. # Fonts
  57. flist = glob.glob(path + "/../thirdparty/fonts/*.ttf")
  58. flist.extend(glob.glob(path + "/../thirdparty/fonts/*.otf"))
  59. flist.sort()
  60. env.Depends("#editor/builtin_fonts.gen.h", flist)
  61. env.CommandNoCache("#editor/builtin_fonts.gen.h", flist, run_in_subprocess(editor_builders.make_fonts_header))
  62. env.add_source_files(env.editor_sources, "*.cpp")
  63. SConscript("collada/SCsub")
  64. SConscript("doc/SCsub")
  65. SConscript("fileserver/SCsub")
  66. SConscript("icons/SCsub")
  67. SConscript("import/SCsub")
  68. SConscript("plugins/SCsub")
  69. lib = env.add_library("editor", env.editor_sources)
  70. env.Prepend(LIBS=[lib])