0.2.0-dev Download ZIP
75 lines ·2.6 KB Raw
| 1 | #!/usr/bin/env python |
| 2 | from misc.utility.scons_hints import * |
| 3 | |
| 4 | Import("env") |
| 5 | |
| 6 | env_png = env.Clone() |
| 7 | |
| 8 | # Thirdparty source files |
| 9 | |
| 10 | thirdparty_obj = [] |
| 11 | |
| 12 | if env["builtin_libpng"]: |
| 13 | thirdparty_dir = "#thirdparty/libpng/" |
| 14 | thirdparty_sources = [ |
| 15 | "png.c", |
| 16 | "pngerror.c", |
| 17 | "pngget.c", |
| 18 | "pngmem.c", |
| 19 | "pngpread.c", |
| 20 | "pngread.c", |
| 21 | "pngrio.c", |
| 22 | "pngrtran.c", |
| 23 | "pngrutil.c", |
| 24 | "pngset.c", |
| 25 | "pngtrans.c", |
| 26 | "pngwio.c", |
| 27 | "pngwrite.c", |
| 28 | "pngwtran.c", |
| 29 | "pngwutil.c", |
| 30 | ] |
| 31 | thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] |
| 32 | |
| 33 | env_png.Prepend(CPPPATH=[thirdparty_dir]) |
| 34 | # Needed for drivers includes and in platform/web. |
| 35 | env.Prepend(CPPPATH=[thirdparty_dir]) |
| 36 | |
| 37 | env_thirdparty = env_png.Clone() |
| 38 | env_thirdparty.disable_warnings() |
| 39 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) |
| 40 | |
| 41 | if env["arch"].startswith("arm"): |
| 42 | if env.msvc: # Can't compile assembly files with MSVC. |
| 43 | env_thirdparty.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 0)]) |
| 44 | else: |
| 45 | env_neon = env_thirdparty.Clone() |
| 46 | if "S_compiler" in env: |
| 47 | env_neon["CC"] = env["S_compiler"] |
| 48 | neon_sources = [] |
| 49 | neon_sources.append(env_neon.Object(thirdparty_dir + "arm/arm_init.c")) |
| 50 | neon_sources.append(env_neon.Object(thirdparty_dir + "arm/filter_neon_intrinsics.c")) |
| 51 | neon_sources.append(env_neon.Object(thirdparty_dir + "arm/palette_neon_intrinsics.c")) |
| 52 | thirdparty_obj += neon_sources |
| 53 | elif env["arch"].startswith("x86"): |
| 54 | env_thirdparty.Append(CPPDEFINES=["PNG_INTEL_SSE"]) |
| 55 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "intel/intel_init.c") |
| 56 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "intel/filter_sse2_intrinsics.c") |
| 57 | elif env["arch"] == "loongarch64": |
| 58 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "loongarch/loongarch_lsx_init.c") |
| 59 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "loongarch/filter_lsx_intrinsics.c") |
| 60 | elif env["arch"] == "ppc64": |
| 61 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "powerpc/powerpc_init.c") |
| 62 | env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "powerpc/filter_vsx_intrinsics.c") |
| 63 | |
| 64 | env.drivers_sources += thirdparty_obj |
| 65 | |
| 66 | |
| 67 | # Godot source files |
| 68 | |
| 69 | driver_obj = [] |
| 70 | |
| 71 | env_png.add_source_files(driver_obj, "*.cpp") |
| 72 | env.drivers_sources += driver_obj |
| 73 | |
| 74 | # Needed to force rebuilding the driver files when the thirdparty library is updated. |
| 75 | env.Depends(driver_obj, thirdparty_obj) |