summaryrefslogtreecommitdiff
path: root/tools/editor/SCsub
blob: 0dbb7d3f206aa09d8efaf05333dc0b41dac299c5 (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
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
#!/usr/bin/env python

Import('env')


def make_doc_header(target, source, env):

    src = source[0].srcnode().abspath
    dst = target[0].srcnode().abspath
    f = open(src, "rb")
    g = open(dst, "wb")
    buf = f.read()
    decomp_size = len(buf)
    import zlib
    buf = zlib.compress(buf)


    g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
    g.write("#ifndef _DOC_DATA_RAW_H\n")
    g.write("#define _DOC_DATA_RAW_H\n")
    g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n")
    g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n")
    g.write("static const unsigned char _doc_data_compressed[]={\n")
    for i in range(len(buf)):
        g.write(str(ord(buf[i])) + ",\n")
    g.write("};\n")
    g.write("#endif")



def make_certs_header(target, source, env):

    src = source[0].srcnode().abspath
    dst = target[0].srcnode().abspath
    f = open(src, "rb")
    g = open(dst, "wb")
    buf = f.read()
    decomp_size = len(buf)
    import zlib
    buf = zlib.compress(buf)


    g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
    g.write("#ifndef _CERTS_RAW_H\n")
    g.write("#define _CERTS_RAW_H\n")
    g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n")
    g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n")
    g.write("static const unsigned char _certs_compressed[]={\n")
    for i in range(len(buf)):
        g.write(str(ord(buf[i])) + ",\n")
    g.write("};\n")
    g.write("#endif")







if (env["tools"] == "yes"):

    reg_exporters_inc = '#include "register_exporters.h"\n'
    reg_exporters = 'void register_exporters() {\n'
    for e in env.platform_exporters:
        env.tool_sources.append("#platform/" + e + "/export/export.cpp")
        reg_exporters += '\tregister_' + e + '_exporter();\n'
        reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
    reg_exporters += '}\n'
    f = open("register_exporters.cpp", "wb")
    f.write(reg_exporters_inc)
    f.write(reg_exporters)
    f.close()

    env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml")
    env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header)

    env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt")
    env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header)

    # make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)

    env.add_source_files(env.tool_sources, "*.cpp")

    Export('env')
    SConscript('icons/SCsub');
    SConscript('plugins/SCsub');
    SConscript('fileserver/SCsub');
    SConscript('io_plugins/SCsub');