SCsub 2.4 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. env_thirdparty = env_png.Clone()
  30. env_thirdparty.disable_warnings()
  31. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  32. if env["arch"].startswith("arm"):
  33. if env.msvc: # Can't compile assembly files with MSVC.
  34. env_thirdparty.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT"), 0])
  35. else:
  36. env_neon = env_thirdparty.Clone()
  37. if "S_compiler" in env:
  38. env_neon["CC"] = env["S_compiler"]
  39. neon_sources = []
  40. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
  41. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
  42. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
  43. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
  44. thirdparty_obj += neon_sources
  45. elif env["arch"].startswith("x86"):
  46. env_thirdparty.Append(CPPDEFINES=["PNG_INTEL_SSE"])
  47. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/intel/intel_init.c")
  48. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/intel/filter_sse2_intrinsics.c")
  49. elif env["arch"] == "ppc64":
  50. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/powerpc/powerpc_init.c")
  51. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/powerpc/filter_vsx_intrinsics.c")
  52. env.drivers_sources += thirdparty_obj
  53. # Godot source files
  54. driver_obj = []
  55. env_png.add_source_files(driver_obj, "*.cpp")
  56. env.drivers_sources += driver_obj
  57. # Needed to force rebuilding the driver files when the thirdparty library is updated.
  58. env.Depends(driver_obj, thirdparty_obj)