diff options
author | crupest <crupest@outlook.com> | 2019-05-24 17:29:42 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-05-24 17:29:42 +0800 |
commit | b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7 (patch) | |
tree | a76e82cf2e516ff32fb0d604cb07ac9615826ed9 /tools/win_build.py | |
parent | 9c2ece689c580f6857f50a81c09d423e6fed4a83 (diff) | |
parent | abdbce87692615716f9fb0c04e74c5247c4080b2 (diff) | |
download | cru-b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7.tar.gz cru-b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7.tar.bz2 cru-b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'tools/win_build.py')
-rw-r--r-- | tools/win_build.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/win_build.py b/tools/win_build.py new file mode 100644 index 00000000..30d0425d --- /dev/null +++ b/tools/win_build.py @@ -0,0 +1,36 @@ +import argparse +import os +import os.path +import subprocess +import sys + +parser = argparse.ArgumentParser() +parser.add_argument('-a', '--arch', choices=['x86', 'x64'], + default='x64', help='specify target cpu architecture') +parser.add_argument('-c', '--config', choices=['Debug', 'Release'], + required=True, help='specify build configuration') +args = parser.parse_args() + + +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + + +def build_cru_ui(): + os.chdir(project_root) + + os.environ['PreferredToolArchitecture'] = 'x64' # use vs x64 toolchain + + generater_vs_arch_map = { + 'x86': 'Win32', + 'x64': 'x64' + } + + subprocess.check_call('cmake -S . -B build -G "Visual Studio 15 2017" -A {arch}' + .format(arch=generater_vs_arch_map[args.arch]), + stdout=sys.stdout, stderr=sys.stderr) + + subprocess.check_call('cmake --build build --target ALL_BUILD --config {config}'.format(config=args.config), + stdout=sys.stdout, stderr=sys.stderr) + + +build_cru_ui() |