SCsub 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. Import("env")
  4. Import("env_modules")
  5. env_theora = env_modules.Clone()
  6. # Thirdparty source files
  7. thirdparty_obj = []
  8. if env["builtin_libtheora"]:
  9. thirdparty_dir = "#thirdparty/libtheora/"
  10. thirdparty_sources = [
  11. "bitpack.c",
  12. "decinfo.c",
  13. "decode.c",
  14. "dequant.c",
  15. "fragment.c",
  16. "huffdec.c",
  17. "idct.c",
  18. "info.c",
  19. "internal.c",
  20. "quant.c",
  21. "state.c",
  22. ]
  23. if env.editor_build:
  24. thirdparty_sources += [
  25. "analyze.c",
  26. "encfrag.c",
  27. "encinfo.c",
  28. "encode.c",
  29. "enquant.c",
  30. "fdct.c",
  31. "huffenc.c",
  32. "mathops.c",
  33. "mcenc.c",
  34. "rate.c",
  35. "tokenize.c",
  36. ]
  37. thirdparty_sources_x86 = [
  38. "x86/mmxfrag.c",
  39. "x86/mmxidct.c",
  40. "x86/mmxstate.c",
  41. "x86/sse2idct.c",
  42. "x86/x86cpu.c",
  43. "x86/x86state.c",
  44. ]
  45. if env.editor_build:
  46. thirdparty_sources_x86 += [
  47. "x86/mmxencfrag.c",
  48. "x86/mmxfdct.c",
  49. "x86/sse2encfrag.c",
  50. "x86/sse2fdct.c",
  51. "x86/x86enc.c",
  52. "x86/x86enquant.c",
  53. ]
  54. thirdparty_sources_x86_vc = [
  55. "x86_vc/mmxfrag.c",
  56. "x86_vc/mmxidct.c",
  57. "x86_vc/mmxstate.c",
  58. "x86_vc/x86cpu.c",
  59. "x86_vc/x86state.c",
  60. ]
  61. if env.editor_build:
  62. thirdparty_sources_x86_vc += [
  63. "x86_vc/mmxencfrag.c",
  64. "x86_vc/mmxfdct.c",
  65. "x86_vc/x86enc.c",
  66. ]
  67. if env["x86_libtheora_opt_gcc"]:
  68. thirdparty_sources += thirdparty_sources_x86
  69. if env["x86_libtheora_opt_vc"]:
  70. thirdparty_sources += thirdparty_sources_x86_vc
  71. if env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]:
  72. env_theora.Append(CPPDEFINES=["OC_X86_ASM"])
  73. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  74. env_theora.Prepend(CPPEXTPATH=[thirdparty_dir])
  75. # also requires libogg and libvorbis
  76. if env["builtin_libogg"]:
  77. env_theora.Prepend(CPPEXTPATH=["#thirdparty/libogg"])
  78. if env["builtin_libvorbis"]:
  79. env_theora.Prepend(CPPEXTPATH=["#thirdparty/libvorbis"])
  80. env_thirdparty = env_theora.Clone()
  81. env_thirdparty.disable_warnings()
  82. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  83. env.modules_sources += thirdparty_obj
  84. # Godot source files
  85. module_obj = []
  86. env_theora.add_source_files(module_obj, "*.cpp")
  87. if env.editor_build:
  88. env_theora.add_source_files(module_obj, "editor/*.cpp")
  89. env.modules_sources += module_obj
  90. # Needed to force rebuilding the module files when the thirdparty library is updated.
  91. env.Depends(module_obj, thirdparty_obj)