diff options
author | crupest <crupest@outlook.com> | 2019-04-30 22:34:18 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-30 22:34:18 +0800 |
commit | abdbce87692615716f9fb0c04e74c5247c4080b2 (patch) | |
tree | 4cd546c9c37b484936a5df193bae1d8cb0024024 /tools/win_build.py | |
parent | 5aac4ce0c2414956db979f077a5f6727473479aa (diff) | |
download | cru-abdbce87692615716f9fb0c04e74c5247c4080b2.tar.gz cru-abdbce87692615716f9fb0c04e74c5247c4080b2.tar.bz2 cru-abdbce87692615716f9fb0c04e74c5247c4080b2.zip |
...
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() |