SCsub 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env python
  2. Import('env')
  3. env_png = env.Clone()
  4. # Thirdparty source files
  5. if env['builtin_libpng']:
  6. thirdparty_dir = "#thirdparty/libpng/"
  7. thirdparty_sources = [
  8. "png.c",
  9. "pngerror.c",
  10. "pngget.c",
  11. "pngmem.c",
  12. "pngpread.c",
  13. "pngread.c",
  14. "pngrio.c",
  15. "pngrtran.c",
  16. "pngrutil.c",
  17. "pngset.c",
  18. "pngtrans.c",
  19. "pngwio.c",
  20. "pngwrite.c",
  21. "pngwtran.c",
  22. "pngwutil.c",
  23. ]
  24. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  25. env_png.Append(CPPPATH=[thirdparty_dir])
  26. # Needed for drivers includes and in platform/javascript
  27. env.Append(CPPPATH=[thirdparty_dir])
  28. # Currently .ASM filter_neon.S does not compile on NT.
  29. import os
  30. use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt"
  31. if use_neon:
  32. env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
  33. else:
  34. env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
  35. env_thirdparty = env_png.Clone()
  36. env_thirdparty.disable_warnings()
  37. env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources)
  38. if use_neon:
  39. env_neon = env_thirdparty.Clone()
  40. if "S_compiler" in env:
  41. env_neon['CC'] = env['S_compiler']
  42. neon_sources = []
  43. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
  44. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
  45. neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
  46. env.drivers_sources += neon_sources
  47. # Godot source files
  48. env_png.add_source_files(env.drivers_sources, "*.cpp")
  49. Export('env')