-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathSCsub
54 lines (40 loc) · 1.52 KB
/
SCsub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
from gdextension_build import ffmpeg_download
from gdextension_build import methods
from pathlib import Path
import os
import SCons
Import("env")
if env["platform"] == "linuxbsd":
if not "RPATH" in env:
env.Append(RPATH=env.Literal("\\$$ORIGIN"))
env.Append(LINKFLAGS=["-Wl,--disable-new-dtags"])
env_ffmpeg = env.Clone()
module_obj = []
excluded = []
sources = [x for x in Glob("*.cpp") if str(x) not in excluded]
ffmpeg_path = env["ffmpeg_path"]
env_ffmpeg.Prepend(CPPPATH=f"{ffmpeg_path}/include")
env.Append(LIBPATH=[f"{ffmpeg_path}/lib"])
ffmpeg_libs = ["avcodec", "avfilter", "avformat", "avutil", "swresample", "swscale"]
if env.msvc:
# MSVC: Think Different(tm)
env.Append(LINKFLAGS=[x + ".lib" for x in ffmpeg_libs])
else:
# mingw
env.Append(LIBS=ffmpeg_libs)
ffmpeg_install_action = ffmpeg_download.ffmpeg_install(env_ffmpeg, "#bin", ffmpeg_path)
env_ffmpeg.GLSL_HEADER("yuv_to_rgb.glsl")
env_ffmpeg.Depends(Glob("*.glsl.gen.h"), ["#glsl_builders.py"])
# env_ffmpeg.Append(CPPDEFINES=["FFMPEG_MT_GPU_UPLOAD"])
if ARGUMENTS.get("ffmpeg_shared", "no") == "yes":
# Shared lib compilation
env_ffmpeg.Append(CCFLAGS=["-fPIC"])
env_ffmpeg["LIBS"] = FFMPEG_LIBS
shared_lib = env_ffmpeg.SharedLibrary(target="#bin/ffmpeg", source=sources)
shared_lib_shim = shared_lib[0].name.rsplit(".", 1)[0]
env.Append(LIBPATH=["#bin"])
env.Append(LIBS=[shared_lib_shim])
else:
env_ffmpeg.add_source_files(module_obj, sources)
env.modules_sources += module_obj