summaryrefslogtreecommitdiff
path: root/components/rust/SConscript
blob: ab84bd7a1444d13a030c8682500d2c1bd5d76fb4 (plain)
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
# for module compiling
import os
from building import *

objs = []

def _has(sym: str) -> bool:
    try:
        return bool(GetDepend([sym]))
    except Exception:
        return bool(GetDepend(sym))

if not _has('RT_USING_RUST'):
    Return('objs')

cwd = GetCurrentDir()
entries = os.listdir(cwd)

for d in entries:
    path = os.path.join(cwd, d)
    if os.path.isfile(os.path.join(path, 'SConscript')):
        result = SConscript(os.path.join(d, 'SConscript'))
        if isinstance(result, (list, tuple)):
            objs.extend(result)
        else:
            objs.append(result)

Return('objs')