-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_cegui_dependencies_windows.py
99 lines (82 loc) · 4.31 KB
/
build_cegui_dependencies_windows.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
#!/usr/bin/env python2
##############################################################################
# CEGUI dependencies build script for Windows
#
# Copyright (C) 2014-2016 Timotei Dolean <[email protected]>
# and contributing authors (see AUTHORS file)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
from __future__ import print_function
import collections
from distutils import dir_util
import re
import shutil
import os
import time
import build_utils
from sdk_builder import SDKBuilder, BuildDetails, CMakeArgs
class CEGUIDependenciesSDK(SDKBuilder):
def __init__(self, args):
SDKBuilder.__init__(self, args, "cegui-dependencies")
def gatherArtifacts(self, compiler, builds):
print("*** Gathering artifacts for CEGUI dependencies for '%s' compiler ..." % compiler)
artifactDirName = "cegui-dependencies-" + builds[0].compiler
artifactZipName = artifactDirName + ".zip"
depsGatherPath = os.path.join(self.artifactsUnarchivedPath, artifactDirName)
for build in builds:
depsPath = os.path.join(self.srcDir, build.buildDir, "dependencies")
print("*** From", depsPath, "to", depsGatherPath, "...")
if not os.path.isdir(depsPath):
print("*** ERROR: no dependencies directory found, nothing will be generated!")
return
dir_util.copy_tree(depsPath, depsGatherPath)
shutil.copy(os.path.join(self.srcDir, "README.md"), depsGatherPath)
os.chdir(self.artifactsUnarchivedPath)
patternsToIgnore = [".*\\.ilk", ".*" + re.escape(os.path.join("lib", "static"))]
build_utils.makeZip([artifactDirName], artifactZipName, patternsToIgnore)
shutil.move(artifactZipName, os.path.join(self.artifactsPath, artifactZipName))
print("*** Done gathering artifacts for CEGUI dependencies.")
def createSDKBuilds(self):
builds = collections.defaultdict(list)
extraCMakeArgs = []
def toCMakeSwitchTuples(libs, val):
return [(lib, val) for lib in libs]
enabledLibs = ['MINIZIP', 'TINYXML', 'EXPAT', 'CORONA', 'FREEIMAGE', 'SILLY', 'FREETYPE2', 'GLEW', 'GLFW', 'GLM', 'PCRE', 'ZLIB']
disabledLibs = ['DEVIL', 'EFFECTS11', 'LUA']
# Xerces doesn't build right on MinGW 32 (it requires intrin.h which doesn't exist in the default distribution)
if self.toolchain == "mingw":
disabledLibs.append('XERCES')
else:
enabledLibs.append('XERCES')
for libBuildMapping in toCMakeSwitchTuples(enabledLibs, 'YES') + toCMakeSwitchTuples(disabledLibs, 'NO'):
extraCMakeArgs.append("-DCEGUI_BUILD_%s=%s" % libBuildMapping)
configs = ["Debug", "RelWithDebInfo"]
cmakeGenerator = self.getCMakeGenerator(self.toolchain)
if self.toolchain == "mingw":
for config in configs:
builds["mingw"].append(
BuildDetails("mingw", "build-mingw-" + config,
CMakeArgs(cmakeGenerator, ["-DCMAKE_BUILD_TYPE=" + config] + extraCMakeArgs),
[build_utils.generateMingwMakeCommand()]))
else:
builds[self.toolchain].append(
BuildDetails(self.toolchain, "build-" + self.toolchain,
CMakeArgs(cmakeGenerator, extraCMakeArgs),
[build_utils.generateMSBuildCommand("CEGUI-DEPS.sln", config) for config in configs]))
return builds
if __name__ == "__main__":
parser = SDKBuilder.getDefaultArgParse("cegui-dependencies")
depsSDK = CEGUIDependenciesSDK(parser.parse_args())
depsSDK.build()