From abdbce87692615716f9fb0c04e74c5247c4080b2 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 30 Apr 2019 22:34:18 +0800 Subject: ... --- README.md | 5 +++-- azure-pipelines.yml | 10 +--------- tools/build.py | 36 ------------------------------------ tools/win_build.py | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 47 deletions(-) delete mode 100644 tools/build.py create mode 100644 tools/win_build.py diff --git a/README.md b/README.md index 69844d18..9ffd8497 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,12 @@ Use python3 to run `tool/build.py`. Run with `-h` to see the options. - `tools/` contains some codes of tools like code generators. - - `tools/cppmerge` contains a *python* script program that merges all cpp headers and sources into one **single** header and source. **Not use now**. + - `tools/cppmerge` contains a *python* script program that merges all cpp headers and sources into one **single** header and source. **Not use now**. - - `tools/build.py` is a python3 script to build the source code. + - `tools/build.py` is a python3 script to build the source code. - `snippets/` contains useful snippets file for *Visual Studio*, you can import it. ## project structure + ![project structure](art/project_structure.png) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d4824188..b5e9f490 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,15 +21,7 @@ jobs: buildConfiguration: 'Release' steps: - - checkout: self - submodules: true - - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7' - addToPath: true - - - script: py -3 tools\build.py -a $(buildPlatform) -c $(buildConfiguration) + - script: py -3 tools\win_build.py -a $(buildPlatform) -c $(buildConfiguration) - task: CopyFiles@2 inputs: diff --git a/tools/build.py b/tools/build.py deleted file mode 100644 index 30d0425d..00000000 --- a/tools/build.py +++ /dev/null @@ -1,36 +0,0 @@ -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() 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() -- cgit v1.2.3