Skip to content
0.2.0-dev Download ZIP
73 lines ·2.3 KB Raw
1#!/usr/bin/env python
2from misc.utility.scons_hints import *
3
4Import("env")
5Import("env_modules")
6
7env_msdfgen = env_modules.Clone()
8
9# Thirdparty source files
10
11thirdparty_obj = []
12
13if env["builtin_msdfgen"]:
14 env_msdfgen.disable_warnings()
15
16 thirdparty_dir = "#thirdparty/msdfgen/"
17 thirdparty_sources = [
18 "core/Contour.cpp",
19 "core/DistanceMapping.cpp",
20 "core/EdgeHolder.cpp",
21 "core/MSDFErrorCorrection.cpp",
22 "core/Projection.cpp",
23 "core/Scanline.cpp",
24 "core/Shape.cpp",
25 "core/contour-combiners.cpp",
26 "core/convergent-curve-ordering.cpp",
27 "core/edge-coloring.cpp",
28 "core/edge-segments.cpp",
29 "core/edge-selectors.cpp",
30 "core/equation-solver.cpp",
31 # "core/export-svg.cpp",
32 "core/msdf-error-correction.cpp",
33 "core/msdfgen.cpp",
34 "core/rasterization.cpp",
35 "core/render-sdf.cpp",
36 # "core/save-bmp.cpp",
37 # "core/save-fl32.cpp",
38 # "core/save-rgba.cpp",
39 # "core/save-tiff.cpp",
40 "core/sdf-error-estimation.cpp",
41 "core/shape-description.cpp",
42 ]
43 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
44
45 env_msdfgen.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")])
46 env_msdfgen.Prepend(CPPPATH=["#thirdparty/freetype/include", "#thirdparty/msdfgen", "#thirdparty/nanosvg"])
47
48 lib = env_msdfgen.add_library("msdfgen_builtin", thirdparty_sources)
49 thirdparty_obj += lib
50
51 # Needs to be appended to arrive after libscene in the linker call,
52 # but we don't want it to arrive *after* system libs, so manual hack
53 # LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
54 # and then plain strings for system library. We insert between the two.
55 inserted = False
56 for idx, linklib in enumerate(env["LIBS"]):
57 if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object
58 env["LIBS"].insert(idx, lib)
59 inserted = True
60 break
61 if not inserted:
62 env.Append(LIBS=[lib])
63
64
65# Godot source files
66
67module_obj = []
68
69env_msdfgen.add_source_files(module_obj, "*.cpp")
70env.modules_sources += module_obj
71
72# Needed to force rebuilding the module files when the thirdparty library is updated.
73env.Depends(module_obj, thirdparty_obj)