-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConscript
75 lines (62 loc) · 2.23 KB
/
SConscript
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding:utf-8 –*-
# @File: Sconscript
# @Author: buildpkg.exe
# @Date: 2018-09-19 18:07:00(The date the template was created)
#
# @LICENSE: https://github.com/rtpkgs/buildpkg/blob/master/LICENSE.
#
# Change Logs:
# Date Author Notes
# 20xx-xx-xx buildpkg.exe auto create by buildpkg.exe.
import os
from building import *
# Get current dir path
cwd = GetCurrentDir()
# Init inc_list and src_list vars
inc = []
src = []
# debug info
print(inc)
print(src)
# Remove ignore src and
list_ignore_inc = []
list_ignore_src = []
# --------------------------------------------------------------------------------
# user add ignore:
# --------------------------------------------------------------------------------
list_ignore_inc += []
list_ignore_src += []
# --------------------------------------------------------------------------------
# auto add ignore:
# --------------------------------------------------------------------------------
list_ignore_inc += ['.git', 'example', 'doc', 'test']
list_ignore_src += ['test.c', 'example.c']
# Traverse package, add code and path to project
def traverse_package(f):
fs = os.listdir(f)
for f1 in fs:
tmp_path = os.path.join(f, f1)
filename = os.path.basename(tmp_path)
if os.path.isdir(tmp_path): # dir
if not filename in list_ignore_inc:
print("DIR: " + filename)
inc.append(f)
traverse_package(tmp_path)
else: # file
suffix = os.path.splitext(tmp_path)[1]
if suffix == '.c' and not filename in list_ignore_src:
#print("FILE: " + filename)
src.append(tmp_path)
elif suffix == '.h':
inc.append(f)
traverse_package(cwd)
# Add group to IDE project
objs = DefineGroup('sam-v1.0.0', src, depend = ['PKG_USING_SAM'], CPPPATH = inc)
# Traversal subscript
list = os.listdir(cwd)
if GetDepend(['PKG_USING_SAM']):
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')