SCsub 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env python
  2. Import('env')
  3. from compat import isbasestring
  4. # Not building in a separate env as scene needs it
  5. # Thirdparty source files
  6. if (env['builtin_freetype'] != 'no'):
  7. thirdparty_dir = "#thirdparty/freetype/"
  8. thirdparty_sources = [
  9. "src/autofit/autofit.c",
  10. "src/base/ftapi.c",
  11. "src/base/ftbase.c",
  12. "src/base/ftbbox.c",
  13. "src/base/ftbdf.c",
  14. "src/base/ftbitmap.c",
  15. "src/base/ftcid.c",
  16. "src/base/ftdebug.c",
  17. "src/base/ftfntfmt.c",
  18. "src/base/ftfstype.c",
  19. "src/base/ftgasp.c",
  20. "src/base/ftglyph.c",
  21. "src/base/ftgxval.c",
  22. "src/base/ftinit.c",
  23. "src/base/ftlcdfil.c",
  24. "src/base/ftmm.c",
  25. "src/base/ftotval.c",
  26. "src/base/ftpatent.c",
  27. "src/base/ftpfr.c",
  28. "src/base/ftpic.c",
  29. "src/base/ftstroke.c",
  30. "src/base/ftsynth.c",
  31. "src/base/ftsystem.c",
  32. "src/base/fttype1.c",
  33. "src/base/ftwinfnt.c",
  34. "src/bdf/bdf.c",
  35. "src/bzip2/ftbzip2.c",
  36. "src/cache/ftcache.c",
  37. "src/cff/cff.c",
  38. "src/cid/type1cid.c",
  39. "src/gxvalid/gxvalid.c",
  40. "src/gzip/ftgzip.c",
  41. "src/lzw/ftlzw.c",
  42. "src/otvalid/otvalid.c",
  43. "src/pcf/pcf.c",
  44. "src/pfr/pfr.c",
  45. "src/psaux/psaux.c",
  46. "src/pshinter/pshinter.c",
  47. "src/psnames/psnames.c",
  48. "src/raster/raster.c",
  49. "src/sfnt/sfnt.c",
  50. "src/smooth/smooth.c",
  51. "src/truetype/truetype.c",
  52. "src/type1/type1.c",
  53. "src/type42/type42.c",
  54. "src/winfonts/winfnt.c",
  55. ]
  56. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  57. # Include header for WinRT to fix build issues
  58. if "platform" in env and env["platform"] == "winrt":
  59. env.Append(CCFLAGS=['/FI', '"modules/freetype/winrtdef.h"'])
  60. env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
  61. # also requires libpng headers
  62. if (env['builtin_libpng'] != 'no'):
  63. env.Append(CPPPATH=["#thirdparty/libpng"])
  64. lib = env.add_library("freetype_builtin", thirdparty_sources)
  65. # Needs to be appended to arrive after libscene in the linker call,
  66. # but we don't want it to arrive *after* system libs, so manual hack
  67. # LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
  68. # and then plain strings for system library. We insert between the two.
  69. inserted = False
  70. for idx, linklib in enumerate(env["LIBS"]):
  71. if isbasestring(linklib): # first system lib such as "X11", otherwise SCons lib object
  72. env["LIBS"].insert(idx, lib)
  73. inserted = True
  74. break
  75. if not inserted:
  76. env.Append(LIBS=[lib])
  77. env.Append(CCFLAGS=['-DFT2_BUILD_LIBRARY'])
  78. if (env['target'] != 'release'):
  79. env.Append(CCFLAGS=['-DZLIB_DEBUG'])
  80. # Godot source files
  81. env.add_source_files(env.modules_sources, "*.cpp")
  82. env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
  83. Export('env')