-
Notifications
You must be signed in to change notification settings - Fork 3
/
scons_base.py
132 lines (121 loc) · 3.01 KB
/
scons_base.py
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#-*- coding:utf-8 -*-
import os
frameworks = ['CoreAudio','OpenGL',
'AudioToolbox','ForceFeedback','Carbon',
'CoreFoundation','Cocoa','IOKit','CoreVideo',
'Metal','AVFoundation','CoreMedia','Security',
'VideoToolbox',
]
cpp_path = ['./',
'src',
'src/objects','src/utils',
'src/base','src/visual',
'src/visual/sdl',
'src/sound',
'src/environ',
'src/extension',
'src/sdl',
'src/movie',
'src/core',
]
refuse_files = set([
"test.cpp",
# "un_pack_xp3.cpp",
"src/sdl/test.cpp",
'src/sound/WaveImpl.cpp',
'src/core/test.cpp',
"src/visual/LoadJPEG.cpp"
])
# include_path = list(cpp_path)
include_path = list([
'src/tjs2',
'src/tjs2/base',
'src/tjs2/msg',
'src/tjs2/utils',
'../boost_1_67_0/',
'src/ext_libs_src/',
'../sdl/SDL2-2.0.8/include',
'../ffmpeg-4.0/',
'src/ext_libs_src/freetype-2.9/include',
'src/ext_libs_src/libpng-1.6.34',
'src/ext_libs_src/openal-soft-1.18.2/include',
'src/ext_libs_src/freealut-1.1.0/include',
"src/plugins/KAGParser",
"src/objects/tween",
])
plugin_infos = {
"base":{
"path":['src/plugins/'],
"include":['src/plugins/layerEx'],
},
"ncbind":{
"path":['src/plugins/ncbind'],
"refuse_files":['src/plugins/ncbind/testbind.cpp'],
},
"layerexsave":{
"path":['src/plugins/layerexsave',
'src/plugins/layerexsave/LodePNG'],
"include":['src/plugins','src/plugins/ncbind'],
'refuse_files':['src/plugins/layerexsave/savetlg5.cpp',]
},
"kagparser":{
"path":['src/plugins/KAGParser'],
},
"menu":{
"path":['src/plugins/menu'],
},
"fstat":{
"path":['src/plugins/fstat'],
},
"layerExAreaAverage":{
"path":['src/plugins/layerExAreaAverage'],
},
# "layerExDraw":{
# "path":['src/plugins/layerExDraw'],
# },
"layerExImage":{
"path":['src/plugins/layerExImage'],
},
"json":{
"path":['src/plugins/json'],
},
"saveStruct":{
"path":["src/plugins/saveStruct"],
}
}
def search_cpp_src(paths,root_path=""):
cpp_srcs = []
for cpp_path in paths:
if(root_path):
cpp_path = os.path.join(root_path,cpp_path)
for root,_,files in os.walk(cpp_path):
for fname in files:
if fname.endswith(".cpp") or fname.endswith(".c"):
fpath = os.path.join(root,fname)
base_path = os.path.relpath(fpath,root_path)
if base_path in refuse_files:
continue
cpp_srcs.append(fpath)
break
return cpp_srcs
#add plugins
def search_plugins(infos,out_cpp_path,out_include_path,out_refuse_files):
for plugin_name,item in infos.items():
if item.get("path"):
out_cpp_path.extend(item['path'])
if item.get('include'):
out_include_path.extend(item['include'])
if item.get('refuse_files'):
for f in item['refuse_files']:
out_refuse_files.add(f);
def get_cpp_src(root_path=""):
search_plugins(plugin_infos,cpp_path,include_path,refuse_files)
cpp_src = search_cpp_src(cpp_path,root_path)
return cpp_src
def get_include_paths(root_path=""):
include_path.extend(cpp_path)
paths = include_path
if(root_path):
paths = [os.path.join(root_path,p) for p in include_path]
print "include----",paths
return paths