forked from binji/binjgb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_tests.py
More file actions
executable file
·83 lines (65 loc) · 2.48 KB
/
Copy pathbuild_tests.py
File metadata and controls
executable file
·83 lines (65 loc) · 2.48 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
#
# Copyright (C) 2017 Ben Smith
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
from __future__ import print_function
import argparse
import os
import re
import shutil
import sys
import common
MOONEYE_GB_DIR = os.path.join(common.TEST_DIR, 'mooneye-gb')
MOONEYE_GB_GIT_REPO = 'https://github.com/binji/mooneye-gb-tests'
MOONEYE_GB_GIT_SHA = 'fbef416596240ddb4347e208dcb81d845ae874ec'
MOONEYE_GB_WP_DIR = os.path.join(common.TEST_DIR, 'mooneye-gb-wp')
MOONEYE_GB_WP_GIT_REPO = 'https://github.com/binji/mooneye-gb-tests'
MOONEYE_GB_WP_GIT_SHA = '862912f5d22bd624ed11fc244000b0a38630c3d4'
WLA_DX_DIR = os.path.join(common.THIRD_PARTY_DIR, 'wla-dx')
WLA_DX_BUILD_DIR = os.path.join(WLA_DX_DIR, 'build')
WLA_DX_BIN_DIR = os.path.join(WLA_DX_BUILD_DIR, 'binaries')
WLA_DX_GIT_REPO = 'https://github.com/vhelin/wla-dx'
WLA_DX_GIT_SHA = '01f7fd16a111ed2cbb81b4c07ed5e793bff5d6bd'
def Run(exe, *args, **kwargs):
kwargs['verbose'] = True
return common.Run(exe, *args, **kwargs)
def GitUpdate(repo, dirname, sha):
if os.path.exists(dirname):
Run('git', 'fetch', cwd=dirname)
else:
Run('git', 'clone', repo, dirname)
Run('git', 'checkout', sha, cwd=dirname)
def NMakeFound():
for path in os.environ["PATH"].split(os.pathsep):
nmake = os.path.join(path, 'nmake.exe')
if os.path.isfile(nmake):
return True
return False
def BuildWlaGb():
GitUpdate(WLA_DX_GIT_REPO, WLA_DX_DIR, WLA_DX_GIT_SHA)
if not os.path.exists(WLA_DX_BUILD_DIR):
os.makedirs(WLA_DX_BUILD_DIR)
if (sys.platform == 'win32') and NMakeFound():
Run('cmake', '-G', 'NMake Makefiles', '-DCMAKE_BUILD_TYPE=Release', WLA_DX_DIR, cwd=WLA_DX_BUILD_DIR)
Run('nmake', cwd=WLA_DX_BUILD_DIR)
else:
Run('cmake', '-DCMAKE_POLICY_VERSION_MINIMUM=3.5', '-DCMAKE_C_FLAGS=-Wno-strict-prototypes', WLA_DX_DIR, cwd=WLA_DX_BUILD_DIR)
Run('make', cwd=WLA_DX_BUILD_DIR)
# Test that wla-gb was build OK.
Run(os.path.join(WLA_DX_BIN_DIR, 'wla-gb'))
def BuildMooneyeTests():
env = dict(os.environ)
env['PATH'] += ':' + WLA_DX_BIN_DIR
GitUpdate(MOONEYE_GB_GIT_REPO, MOONEYE_GB_DIR, MOONEYE_GB_GIT_SHA)
Run('make', cwd=MOONEYE_GB_DIR, env=env)
GitUpdate(MOONEYE_GB_WP_GIT_REPO, MOONEYE_GB_WP_DIR, MOONEYE_GB_WP_GIT_SHA)
Run('make', cwd=MOONEYE_GB_WP_DIR, env=env)
def main(args):
parser = argparse.ArgumentParser()
BuildWlaGb()
BuildMooneyeTests()
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))