|
| 1 | +import os |
| 2 | +import platform |
| 3 | +import subprocess |
| 4 | +import sys |
| 5 | + |
| 6 | +def get_platform_compilers(): |
| 7 | + if platform.system() == 'Windows': |
| 8 | + return [ '-vs2015', '-vs2017' ] |
| 9 | + elif platform.system() == 'Linux': |
| 10 | + return [ '-gcc5', '-gcc6', '-gcc7', '-clang4', '-clang5' ] |
| 11 | + elif platform.system() == 'Darwin': |
| 12 | + return [ '-osx' ] |
| 13 | + else: |
| 14 | + print('Unknown platform!') |
| 15 | + sys.exit(1) |
| 16 | + |
| 17 | +def get_python_exe_name(): |
| 18 | + if platform.system() == 'Windows': |
| 19 | + return 'python' |
| 20 | + else: |
| 21 | + return 'python3' |
| 22 | + |
| 23 | +if __name__ == "__main__": |
| 24 | + os.environ['PYTHONIOENCODING'] = 'utf_8' |
| 25 | + |
| 26 | + configs = [ '-debug', '-release' ] |
| 27 | + archs = [ '-x86', '-x64' ] |
| 28 | + compilers = get_platform_compilers() |
| 29 | + python_exe = get_python_exe_name() |
| 30 | + |
| 31 | + cmds = [] |
| 32 | + for config in configs: |
| 33 | + for arch in archs: |
| 34 | + for compiler in compilers: |
| 35 | + cmds.append('{} make.py {} {} {} -build -unit_test -clean'.format(python_exe, compiler, arch, config)) |
| 36 | + |
| 37 | + root_dir = os.path.join(os.getcwd(), '../..') |
| 38 | + os.chdir(root_dir) |
| 39 | + |
| 40 | + for cmd in cmds: |
| 41 | + print('Running command: "{}" ...'.format(cmd)) |
| 42 | + try: |
| 43 | + args = cmd.split(' ') |
| 44 | + subprocess.check_output(args) |
| 45 | + except subprocess.CalledProcessError as e: |
| 46 | + print('Failed command: {}'.format(cmd)) |
| 47 | + print(e.output.decode(sys.stdout.encoding)) |
| 48 | + sys.exit(1) |
| 49 | + |
| 50 | + print('Done!') |
| 51 | + sys.exit(0) |
0 commit comments