SCsub 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env python
  2. Import('env')
  3. from compat import isbasestring
  4. # Thirdparty source files
  5. thirdparty_dir = "#thirdparty/nanosvg/"
  6. thirdparty_sources = [
  7. "nanosvg.cc"
  8. ]
  9. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  10. # env.add_source_files(env.modules_sources, thirdparty_sources)
  11. lib = env.Library("svg_builtin", thirdparty_sources)
  12. # Needs to be appended to arrive after libscene in the linker call,
  13. # but we don't want it to arrive *after* system libs, so manual hack
  14. # LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
  15. # and then plain strings for system library. We insert between the two.
  16. inserted = False
  17. for idx, linklib in enumerate(env["LIBS"]):
  18. if isbasestring(linklib): # first system lib such as "X11", otherwise SCons lib object
  19. env["LIBS"].insert(idx, lib)
  20. inserted = True
  21. break
  22. if not inserted:
  23. env.Append(LIBS=[lib])
  24. env.Append(CPPPATH=[thirdparty_dir])
  25. env.Append(CCFLAGS=["-DSVG_ENABLED"])
  26. # Godot's own source files
  27. env.add_source_files(env.modules_sources, "*.cpp")
  28. Export('env')