forked from gongminmin/KlayGE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_KlayGE.py
152 lines (132 loc) · 7.11 KB
/
deploy_KlayGE.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/env python
#-*- coding: ascii -*-
from __future__ import print_function
import os, sys
from blib_util import *
def copy_to_dst(src_name, dst_dir):
print("Copy %s to %s" % (src_name, dst_dir))
import shutil
shutil.copy2(src_name, dst_dir)
def deploy_KlayGE(target_dir, build_info, compiler_arch):
import glob
bin_dst_dir = "%s/bin/%s_%s/" % (target_dir, build_info.target_platform, compiler_arch)
if "win" == build_info.target_platform:
bat_suffix = "bat"
dll_suffix = "dll"
elif "linux" == build_info.target_platform:
bat_suffix = "sh"
dll_suffix = "so"
output_suffix = "_%s%d*" % (build_info.compiler_name, build_info.compiler_version)
lib_suffix = "%s.%s" % (output_suffix, dll_suffix)
if not os.path.exists("%s/bin" % target_dir):
os.mkdir("%s/bin" % target_dir);
if not os.path.exists(bin_dst_dir):
os.mkdir(bin_dst_dir);
if not os.path.exists("%sAudio/" % bin_dst_dir):
os.mkdir("%sAudio/" % bin_dst_dir);
if not os.path.exists("%sInput/" % bin_dst_dir):
os.mkdir("%sInput/" % bin_dst_dir);
if not os.path.exists("%sRender/" % bin_dst_dir):
os.mkdir("%sRender/" % bin_dst_dir);
if not os.path.exists("%sScene/" % bin_dst_dir):
os.mkdir("%sScene/" % bin_dst_dir);
if not os.path.exists("%sScript/" % bin_dst_dir):
os.mkdir("%sScript/" % bin_dst_dir);
if not os.path.exists("%sShow/" % bin_dst_dir):
os.mkdir("%sShow/" % bin_dst_dir);
copy_to_dst("KlayGE/bin/KlayGE.cfg", "%s/bin/" % target_dir);
print("Deploying boost...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/boost_*.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying 7z...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/7zxa*.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/LZMA*.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying DXSDK...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/d3dcompiler_47.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying OpenAL...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/OpenAL32.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/wrap_oal.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying Cg...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/cg.%s" % (compiler_arch, dll_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying glloader...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/glloader%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying kfont...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/kfont%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, bin_dst_dir);
print("Deploying KlayGE...\n")
for fname in glob.iglob("KlayGE/bin/win_%s/KlayGE_Core%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Audio/KlayGE_Audio*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sAudio/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Input/KlayGE_Input*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sInput/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Render/KlayGE_Render*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sRender/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Scene/KlayGE_Scene*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sScene/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Script/KlayGE_Script*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sScript/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/Show/KlayGE_Show*%s" % (compiler_arch, lib_suffix)):
copy_to_dst(fname, "%sShow/" % bin_dst_dir);
for fname in glob.iglob("KlayGE/bin/win_%s/MeshMLJIT*" % compiler_arch):
copy_to_dst(fname, bin_dst_dir);
print("Deploying media files...\n")
if not os.path.exists("%s/media" % target_dir):
os.mkdir("%s/media" % target_dir);
if not os.path.exists("%s/media/Fonts" % target_dir):
os.mkdir("%s/media/Fonts" % target_dir);
if not os.path.exists("%s/media/Models" % target_dir):
os.mkdir("%s/media/Models" % target_dir);
if not os.path.exists("%s/media/PostProcessors" % target_dir):
os.mkdir("%s/media/PostProcessors" % target_dir);
if not os.path.exists("%s/media/RenderFX" % target_dir):
os.mkdir("%s/media/RenderFX" % target_dir);
if not os.path.exists("%s/media/Textures" % target_dir):
os.mkdir("%s/media/Textures" % target_dir);
if not os.path.exists("%s/media/Textures/2D" % target_dir):
os.mkdir("%s/media/Textures/2D" % target_dir);
if not os.path.exists("%s/media/Textures/3D" % target_dir):
os.mkdir("%s/media/Textures/3D" % target_dir);
if not os.path.exists("%s/media/Textures/Cube" % target_dir):
os.mkdir("%s/media/Textures/Cube" % target_dir);
if not os.path.exists("%s/media/Textures/Juda" % target_dir):
os.mkdir("%s/media/Textures/Juda" % target_dir);
copy_to_dst("KlayGE/media/Fonts/gkai00mp.kfont", "%s/media/Fonts/" % target_dir);
copy_to_dst("KlayGE/media/Models/ambient_light_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/directional_light_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/indirect_light_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/point_light_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/spot_light_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/camera_proxy.meshml", "%s/media/Models/" % target_dir);
copy_to_dst("KlayGE/media/Models/tube_light_proxy.meshml", "%s/media/Models/" % target_dir);
for fname in glob.iglob("KlayGE/media/PostProcessors/*.ppml"):
copy_to_dst(fname, "%s/media/PostProcessors" % target_dir);
for fname in glob.iglob("KlayGE/media/RenderFX/*.fxml"):
copy_to_dst(fname, "%s/media/RenderFX" % target_dir);
for fname in glob.iglob("KlayGE/media/Textures/2D/*.dds"):
copy_to_dst(fname, "%s/media/Textures/2D/" % target_dir);
copy_to_dst("KlayGE/media/Textures/3D/color_grading.dds", "%s/media/Textures/3D/" % target_dir);
for fname in glob.iglob("KlayGE/media/Textures/Cube/Lake_CraterLake03_*.dds"):
copy_to_dst(fname, "%s/media/Textures/Cube/" % target_dir);
for fname in glob.iglob("KlayGE/media/Textures/Cube/rnl_cross_*.dds"):
copy_to_dst(fname, "%s/media/Textures/Cube/" % target_dir);
for fname in glob.iglob("KlayGE/media/Textures/Cube/uffizi_cross_*.dds"):
copy_to_dst(fname, "%s/media/Textures/Cube/" % target_dir);
for fname in glob.iglob("KlayGE/media/Textures/Juda/*.jdt"):
copy_to_dst(fname, "%s/media/Textures/Juda/" % target_dir);
if __name__ == "__main__":
if len(sys.argv) > 1:
target_dir = sys.argv[1]
cfg = cfg_from_argv(sys.argv, 1)
bi = build_info(cfg.compiler, cfg.archs, cfg.cfg)
for compiler_info in bi.compilers:
deploy_KlayGE(target_dir, bi, compiler_info.arch)
else:
print("Usage: deploy_KlayGE.py target_dir [compiler] [arch] [config]")