SCsub 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python
  2. Import("env")
  3. env_png = env.Clone()
  4. # Thirdparty source files
  5. thirdparty_obj = []
  6. if env["builtin_libpng"]:
  7. thirdparty_dir = "#thirdparty/libpng/"
  8. thirdparty_sources = [
  9. "png.c",
  10. "pngerror.c",
  11. "pngget.c",
  12. "pngmem.c",
  13. "pngpread.c",
  14. "pngread.c",
  15. "pngrio.c",
  16. "pngrtran.c",
  17. "pngrutil.c",
  18. "pngset.c",
  19. "pngtrans.c",
  20. "pngwio.c",
  21. "pngwrite.c",
  22. "pngwtran.c",
  23. "pngwutil.c",
  24. ]
  25. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  26. env_png.Prepend(CPPPATH=[thirdparty_dir])
  27. # Needed for drivers includes and in platform/web.
  28. env.Prepend(CPPPATH=[thirdparty_dir])
  29. # Currently .ASM filter_neon.S does not compile on NT.
  30. import os
  31. # Enable ARM NEON instructions on 32-bit Android to compile more optimized code.
  32. use_neon = env["platform"] == "android" and env["arch"] == "arm32" and os.name != "nt"
  33. if use_neon:
  34. env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
  35. else:
  36. env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 0)])
  37. env_thirdparty = env_png.Clone()
  38. env_thirdparty.disable_warnings()
  39. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  40. if use_neon:
  41. env_neon = env_thirdparty.Clone()
  42. if "S_compiler" in env:
  43. env_neon["CC"] = env["S_compiler"]
  44. neon_sources = []
  45. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
  46. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
  47. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
  48. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
  49. thirdparty_obj += neon_sources
  50. env.drivers_sources += thirdparty_obj
  51. # Godot source files
  52. driver_obj = []
  53. env_png.add_source_files(driver_obj, "*.cpp")
  54. env.drivers_sources += driver_obj
  55. # Needed to force rebuilding the driver files when the thirdparty library is updated.
  56. env.Depends(driver_obj, thirdparty_obj)