diff options
author | 杨宇千 <crupest@outlook.com> | 2019-03-28 20:39:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-28 20:39:36 +0800 |
commit | c45a6e62298e972f5945f5f3461ed723aea80317 (patch) | |
tree | f46ef303ee87a8e3814ea8743bd7062d432bfee3 /tools/build.py | |
parent | b028e74a48de181ca078ad3bf4ababf4fa146cd3 (diff) | |
parent | 37216f211b0e22205a3a0d3373d985fc68aea59b (diff) | |
download | cru-c45a6e62298e972f5945f5f3461ed723aea80317.tar.gz cru-c45a6e62298e972f5945f5f3461ed723aea80317.tar.bz2 cru-c45a6e62298e972f5945f5f3461ed723aea80317.zip |
Merge pull request #37 from crupest/render
Refactor.
Diffstat (limited to 'tools/build.py')
-rw-r--r-- | tools/build.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/build.py b/tools/build.py new file mode 100644 index 00000000..009b3aad --- /dev/null +++ b/tools/build.py @@ -0,0 +1,29 @@ +import argparse +import os +import os.path +import subprocess +import sys + +parser = argparse.ArgumentParser() +parser.add_argument('-a', '--arch', choices=['x86', 'x64'], + required=True, 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__), '..')) +os.chdir(project_root) + +os.environ['PreferredToolArchitecture'] = 'x64' # use x64 toolchain + +generater_vs_arch_map = { + 'x86': 'Win32', + 'x64': 'x64' +} + +subprocess.run('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.run('cmake --build build --target ALL_BUILD --config {config}'.format(config=args.config), + stdout=sys.stdout, stderr=sys.stderr) |