aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-10 00:33:07 +0800
committer杨宇千 <crupest@outlook.com>2019-07-10 00:33:07 +0800
commite37dd256e5bca4caf819d18c73cd2d11e06683df (patch)
tree3a13376ea9cc7b09384250bb61f40c61f843dbb9
parent9c8b55ce438869b2070ef9dbe115466cb47a528a (diff)
downloadcru-e37dd256e5bca4caf819d18c73cd2d11e06683df.tar.gz
cru-e37dd256e5bca4caf819d18c73cd2d11e06683df.tar.bz2
cru-e37dd256e5bca4caf819d18c73cd2d11e06683df.zip
...
-rw-r--r--tools/win_build.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/win_build.py b/tools/win_build.py
index 6850d82a..c3f1ec57 100644
--- a/tools/win_build.py
+++ b/tools/win_build.py
@@ -5,32 +5,35 @@ import subprocess
import sys
parser = argparse.ArgumentParser()
+parser.add_argument('command', choices=[
+ 'configure', 'build'], nargs='?', default='build', help='specify command to execute')
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')
+ default='Debug', 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
-
+def configure():
generater_vs_arch_map = {
'x86': 'Win32',
'x64': 'x64'
}
+ subprocess.check_call('cmake -S . -B build -G "Visual Studio 16 2019" -A {arch} -T host=x64 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
+ .format(arch=generater_vs_arch_map[args.arch]),
+ stdout=sys.stdout, stderr=sys.stderr)
- subprocess.check_call('cmake -S . -B build -G "Visual Studio 16 2019" -A {arch}'
- .format(arch=generater_vs_arch_map[args.arch]),
- stdout=sys.stdout, stderr=sys.stderr)
+def build():
subprocess.check_call('cmake --build build --target ALL_BUILD --config {config}'.format(config=args.config),
- stdout=sys.stdout, stderr=sys.stderr)
+ stdout=sys.stdout, stderr=sys.stderr)
+
+os.chdir(project_root)
+configure()
-build_cru_ui()
+if args.command == 'build':
+ build()