-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathgenerate_include.py
More file actions
67 lines (51 loc) · 1.6 KB
/
generate_include.py
File metadata and controls
67 lines (51 loc) · 1.6 KB
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
name = 'wisardpkg'
src = 'src/'
output = 'include/'
stdIncludes = 'base.h'
version = 'version.h'
libs = [
('libs/json.hpp', 'nl = nlohmann'),
]
includes = [
'common/definetypes.cc',
'common/exceptions.cc',
'common/utils.cc',
'common/bleaching.cc',
'data/bininput.cc',
'data/dataset.cc',
'synthetic_data/synthesizers.cc',
'binarization/base.cc',
'binarization/kernelcanvas.cc',
'models/wisard/ramdatahandle.cc',
'models/wisard/ram.cc',
'models/wisard/discriminator.cc',
'models/wisard/wisard.cc',
'models/cluswisard/cluster.cc',
'models/cluswisard/cluswisard.cc',
]
if __name__ == "__main__":
with open(output+name+'.hpp', 'w+') as out:
versionData = open(src+version).read()
__version__ = versionData.split('"')[1]
out.write("/*\n" +\
"\n"+name+" for c++11" +\
"\nversion "+ __version__ +\
"\nhttps://github.com/IAZero/wisardpkg" +\
"\n*/\n\n")
out.write("\n#ifndef "+name.upper()+"_HPP\n#define "+name.upper()+"_HPP\n\n")
data = open(src+stdIncludes).read()
out.write(data)
# add libs here
for lib in libs:
data = open(src+lib[0]).read()
out.write(data)
out.write("\n\nnamespace "+name+" {\n\n")
out.write(versionData+"\n\n")
for lib in libs:
out.write('\n\nnamespace '+lib[1]+';\n\n')
# add all the library here
for include in includes:
data = open(src+include).read()
out.write(data)
out.write("\n}\n#endif")
out.close()