From 08cce61ac9e4b7ebb557b68d57097bd7eab930f3 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Tue, 4 Nov 2025 21:35:33 +0800 Subject: Remove unused tools. --- .github/workflows/ci.yml | 4 +- scripts/Use-VC.ps1 | 24 ++++++ scripts/cppmerge/.gitignore | 147 ++++++++++++++++++++++++++++++++++ scripts/cppmerge/main.py | 160 +++++++++++++++++++++++++++++++++++++ tools/Use-VC.ps1 | 24 ------ tools/cppmerge/.gitignore | 147 ---------------------------------- tools/cppmerge/main.py | 160 ------------------------------------- tools/generate_compile_flags.py | 54 ------------- tools/migrate-1/migrate-cmake.py | 26 ------ tools/migrate-1/migrate-files.py | 43 ---------- tools/migrate-2/rename-hpp-to-h.py | 34 -------- tools/proxy_domains.txt | 6 -- tools/win_build.py | 71 ---------------- 13 files changed, 333 insertions(+), 567 deletions(-) create mode 100644 scripts/Use-VC.ps1 create mode 100644 scripts/cppmerge/.gitignore create mode 100644 scripts/cppmerge/main.py delete mode 100644 tools/Use-VC.ps1 delete mode 100644 tools/cppmerge/.gitignore delete mode 100644 tools/cppmerge/main.py delete mode 100644 tools/generate_compile_flags.py delete mode 100644 tools/migrate-1/migrate-cmake.py delete mode 100644 tools/migrate-1/migrate-files.py delete mode 100644 tools/migrate-2/rename-hpp-to-h.py delete mode 100644 tools/proxy_domains.txt delete mode 100644 tools/win_build.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62eb32c4..f0352ab2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Build run: | - . tools/Use-VC.ps1 + . scripts/Use-VC.ps1 Use-VC cmake -DCMAKE_BUILD_TYPE=Debug -S. -Bbuild -G Ninja cmake --build build --config Debug --target all @@ -66,7 +66,7 @@ jobs: - name: Build run: | - . tools/Use-VC.ps1 + . scripts/Use-VC.ps1 Use-VC cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=1 -S. -Bbuild-dynamic -G Ninja cmake --build build-dynamic --config Debug --target all diff --git a/scripts/Use-VC.ps1 b/scripts/Use-VC.ps1 new file mode 100644 index 00000000..ad3dbcba --- /dev/null +++ b/scripts/Use-VC.ps1 @@ -0,0 +1,24 @@ +function Use-VC { + param( + [Parameter()] + [ValidateSet('x64', 'x86')] + $Arch = 'x64' + ) + + if ($Arch -eq 'x86') { + $p = 'x86'; + } + else { + $p = 'amd64' + } + + cmd /c "`"$(vswhere.exe -format value -property installationPath)\VC\Auxiliary\Build\vcvars64.bat`" $p & set" | + ForEach-Object { + if ($_ -match '=') { + $v = $_ -split '=' + Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])" + } + } + Pop-Location + Write-Host "Visual Studio Command Prompt variables set." -ForegroundColor Yellow +} diff --git a/scripts/cppmerge/.gitignore b/scripts/cppmerge/.gitignore new file mode 100644 index 00000000..0b6b38d0 --- /dev/null +++ b/scripts/cppmerge/.gitignore @@ -0,0 +1,147 @@ + +# Created by https://www.gitignore.io/api/python,visualstudiocode +# Edit at https://www.gitignore.io/?templates=python,visualstudiocode + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +### Python Patch ### +.venv/ + +### Python.VirtualEnv Stack ### +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +pip-selfcheck.json + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +# End of https://www.gitignore.io/api/python,visualstudiocode diff --git a/scripts/cppmerge/main.py b/scripts/cppmerge/main.py new file mode 100644 index 00000000..6c73ff0d --- /dev/null +++ b/scripts/cppmerge/main.py @@ -0,0 +1,160 @@ +import argparse +import os +import os.path +import re +import sys + +parser = argparse.ArgumentParser() +parser.add_argument("-o", "--output", required=True, help="The path of output header and source files excluding extension.") +parser.add_argument("input", nargs="+", help="The input source files or folders to scan.") +parser.add_argument("-e", "--exclude", nargs="+", help="Filenames that exludes from merging.") +args = parser.parse_args() + +input_dirs = [] + +header_file_list = [] +source_file_list = [] + +def add_source_file(path): + print("find source file: {}".format(path)) + source_file_list.append(path) + +def add_header_file(path): + print("find header file: {}".format(path)) + header_file_list.append(path) + +cpp_header_file_regex = re.compile(r"^.*\.(h|hpp)$") +cpp_source_file_regex = re.compile(r"^.*\.(cpp|cc|cxx)$") + +def is_exclude(file_name): + return args.exclude and file_name in args.exclude + +for path in args.input: + if os.path.isdir(path): + input_dirs.append(path) + elif os.path.isfile(path): + file_name = os.path.basename(path) + if is_exclude(file_name): + sys.exit("{} is specified excluding.") + if cpp_source_file_regex.match(file_name): + add_source_file(path) + elif cpp_header_file_regex.match(file_name): + add_header_file(path) + else: + sys.exit("{} is a file but it is neither c++ source nor header.".format(path)) + else: + sys.exit("{} is neither a file nor a directory.".format(path)) + +actual_exclude_count = 0 + +for input_dir in input_dirs: + for root, subdirs, files in os.walk(input_dir): + for f in files: + if is_exclude(f): + actual_exclude_count += 1 + else: + if cpp_source_file_regex.match(f): + path = os.path.join(root, f) + add_source_file(path) + elif cpp_header_file_regex.match(f): + path = os.path.join(root, f) + add_header_file(path) + +print() +print("total find {} header file(s)".format(len(header_file_list))) +print("total find {} source file(s)".format(len(source_file_list))) +print("total actual exclude {} file(s)".format(actual_exclude_count)) +print() + +norm_source_file_list = [os.path.normpath(path) for path in source_file_list] +norm_header_file_list = [os.path.normpath(path) for path in header_file_list] + +output_header_file_path = args.output + '.hpp' +output_source_file_path = args.output + '.cpp' + + +output_header_file = open(output_header_file_path, 'w') +output_source_file = open(output_source_file_path, 'w') + + +processed_headers = [] + +header_pragma_once_regex = re.compile(r'#\s*pragma\s*once') +header_include_command_regex = re.compile(r'#\s*include\s*"([\w.\-_/\\]+)"') + +def process_line(line): + match_result = header_include_command_regex.match(line) + if match_result: + return match_result.group(1) + else: + return None + +def find_header_path(base_path, header_path): + path = os.path.join(base_path, header_path) + if os.path.isfile(path): + return path + else: + for d in input_dirs: + path = os.path.join(d, header_path) + if os.path.isfile(path): + return path + raise RuntimeError("Header not found.\nBase path: {}\nHeader path: {}".format(base_path, header_path)) + +def process_header_file(base_path, header_path): + path = find_header_path(base_path, header_path) + path = os.path.normpath(path) + if path in processed_headers: + return + processed_headers.append(path) + + output_header_file.write("//--------------------------------------------------------\n") + output_header_file.write("//-------begin of file: {}\n".format(path)) + output_header_file.write("//--------------------------------------------------------\n") + header_f = open(path, 'r') + found_pragma_once = False + for line in header_f: + if (not found_pragma_once): + if header_pragma_once_regex.match(line): + found_pragma_once = True + continue + new_header_name = process_line(line) + if not new_header_name is None: + process_header_file(os.path.dirname(path), new_header_name) + else: + output_header_file.write(line) + output_header_file.write("//--------------------------------------------------------\n") + output_header_file.write("//-------end of file: {}\n".format(path)) + output_header_file.write("//--------------------------------------------------------\n") + + +output_header_file.write("#pragma once\n") + +output_source_file.write('#include "{}"\n'.format(os.path.basename(output_header_file_path))) + + +for source_path in source_file_list: + source_path = os.path.normpath(source_path) + output_source_file.write("//--------------------------------------------------------\n") + output_source_file.write("//-------begin of file: {}\n".format(source_path)) + output_source_file.write("//--------------------------------------------------------\n") + source_f = open(source_path, 'r') + for line in source_f: + new_header_name = process_line(line) + if not new_header_name is None: + process_header_file(os.path.dirname(source_path), new_header_name) + else: + output_source_file.write(line) + output_source_file.write("//--------------------------------------------------------\n") + output_source_file.write("//-------end of file: {}\n".format(source_path)) + output_source_file.write("//--------------------------------------------------------\n") + +rest_header_count = len(norm_header_file_list) - len(processed_headers) + +if rest_header_count > 0: + print("{} header files are not included in any sources. Add them to header now.".format(rest_header_count)) + print() + for header_path in norm_header_file_list: + if header_path not in processed_headers: + process_header_file('.', header_path) + +print("Done!") diff --git a/tools/Use-VC.ps1 b/tools/Use-VC.ps1 deleted file mode 100644 index ad3dbcba..00000000 --- a/tools/Use-VC.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -function Use-VC { - param( - [Parameter()] - [ValidateSet('x64', 'x86')] - $Arch = 'x64' - ) - - if ($Arch -eq 'x86') { - $p = 'x86'; - } - else { - $p = 'amd64' - } - - cmd /c "`"$(vswhere.exe -format value -property installationPath)\VC\Auxiliary\Build\vcvars64.bat`" $p & set" | - ForEach-Object { - if ($_ -match '=') { - $v = $_ -split '=' - Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])" - } - } - Pop-Location - Write-Host "Visual Studio Command Prompt variables set." -ForegroundColor Yellow -} diff --git a/tools/cppmerge/.gitignore b/tools/cppmerge/.gitignore deleted file mode 100644 index 0b6b38d0..00000000 --- a/tools/cppmerge/.gitignore +++ /dev/null @@ -1,147 +0,0 @@ - -# Created by https://www.gitignore.io/api/python,visualstudiocode -# Edit at https://www.gitignore.io/?templates=python,visualstudiocode - -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -### Python Patch ### -.venv/ - -### Python.VirtualEnv Stack ### -# Virtualenv -# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ -[Bb]in -[Ii]nclude -[Ll]ib -[Ll]ib64 -[Ll]ocal -[Ss]cripts -pyvenv.cfg -pip-selfcheck.json - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -# End of https://www.gitignore.io/api/python,visualstudiocode diff --git a/tools/cppmerge/main.py b/tools/cppmerge/main.py deleted file mode 100644 index 6c73ff0d..00000000 --- a/tools/cppmerge/main.py +++ /dev/null @@ -1,160 +0,0 @@ -import argparse -import os -import os.path -import re -import sys - -parser = argparse.ArgumentParser() -parser.add_argument("-o", "--output", required=True, help="The path of output header and source files excluding extension.") -parser.add_argument("input", nargs="+", help="The input source files or folders to scan.") -parser.add_argument("-e", "--exclude", nargs="+", help="Filenames that exludes from merging.") -args = parser.parse_args() - -input_dirs = [] - -header_file_list = [] -source_file_list = [] - -def add_source_file(path): - print("find source file: {}".format(path)) - source_file_list.append(path) - -def add_header_file(path): - print("find header file: {}".format(path)) - header_file_list.append(path) - -cpp_header_file_regex = re.compile(r"^.*\.(h|hpp)$") -cpp_source_file_regex = re.compile(r"^.*\.(cpp|cc|cxx)$") - -def is_exclude(file_name): - return args.exclude and file_name in args.exclude - -for path in args.input: - if os.path.isdir(path): - input_dirs.append(path) - elif os.path.isfile(path): - file_name = os.path.basename(path) - if is_exclude(file_name): - sys.exit("{} is specified excluding.") - if cpp_source_file_regex.match(file_name): - add_source_file(path) - elif cpp_header_file_regex.match(file_name): - add_header_file(path) - else: - sys.exit("{} is a file but it is neither c++ source nor header.".format(path)) - else: - sys.exit("{} is neither a file nor a directory.".format(path)) - -actual_exclude_count = 0 - -for input_dir in input_dirs: - for root, subdirs, files in os.walk(input_dir): - for f in files: - if is_exclude(f): - actual_exclude_count += 1 - else: - if cpp_source_file_regex.match(f): - path = os.path.join(root, f) - add_source_file(path) - elif cpp_header_file_regex.match(f): - path = os.path.join(root, f) - add_header_file(path) - -print() -print("total find {} header file(s)".format(len(header_file_list))) -print("total find {} source file(s)".format(len(source_file_list))) -print("total actual exclude {} file(s)".format(actual_exclude_count)) -print() - -norm_source_file_list = [os.path.normpath(path) for path in source_file_list] -norm_header_file_list = [os.path.normpath(path) for path in header_file_list] - -output_header_file_path = args.output + '.hpp' -output_source_file_path = args.output + '.cpp' - - -output_header_file = open(output_header_file_path, 'w') -output_source_file = open(output_source_file_path, 'w') - - -processed_headers = [] - -header_pragma_once_regex = re.compile(r'#\s*pragma\s*once') -header_include_command_regex = re.compile(r'#\s*include\s*"([\w.\-_/\\]+)"') - -def process_line(line): - match_result = header_include_command_regex.match(line) - if match_result: - return match_result.group(1) - else: - return None - -def find_header_path(base_path, header_path): - path = os.path.join(base_path, header_path) - if os.path.isfile(path): - return path - else: - for d in input_dirs: - path = os.path.join(d, header_path) - if os.path.isfile(path): - return path - raise RuntimeError("Header not found.\nBase path: {}\nHeader path: {}".format(base_path, header_path)) - -def process_header_file(base_path, header_path): - path = find_header_path(base_path, header_path) - path = os.path.normpath(path) - if path in processed_headers: - return - processed_headers.append(path) - - output_header_file.write("//--------------------------------------------------------\n") - output_header_file.write("//-------begin of file: {}\n".format(path)) - output_header_file.write("//--------------------------------------------------------\n") - header_f = open(path, 'r') - found_pragma_once = False - for line in header_f: - if (not found_pragma_once): - if header_pragma_once_regex.match(line): - found_pragma_once = True - continue - new_header_name = process_line(line) - if not new_header_name is None: - process_header_file(os.path.dirname(path), new_header_name) - else: - output_header_file.write(line) - output_header_file.write("//--------------------------------------------------------\n") - output_header_file.write("//-------end of file: {}\n".format(path)) - output_header_file.write("//--------------------------------------------------------\n") - - -output_header_file.write("#pragma once\n") - -output_source_file.write('#include "{}"\n'.format(os.path.basename(output_header_file_path))) - - -for source_path in source_file_list: - source_path = os.path.normpath(source_path) - output_source_file.write("//--------------------------------------------------------\n") - output_source_file.write("//-------begin of file: {}\n".format(source_path)) - output_source_file.write("//--------------------------------------------------------\n") - source_f = open(source_path, 'r') - for line in source_f: - new_header_name = process_line(line) - if not new_header_name is None: - process_header_file(os.path.dirname(source_path), new_header_name) - else: - output_source_file.write(line) - output_source_file.write("//--------------------------------------------------------\n") - output_source_file.write("//-------end of file: {}\n".format(source_path)) - output_source_file.write("//--------------------------------------------------------\n") - -rest_header_count = len(norm_header_file_list) - len(processed_headers) - -if rest_header_count > 0: - print("{} header files are not included in any sources. Add them to header now.".format(rest_header_count)) - print() - for header_path in norm_header_file_list: - if header_path not in processed_headers: - process_header_file('.', header_path) - -print("Done!") diff --git a/tools/generate_compile_flags.py b/tools/generate_compile_flags.py deleted file mode 100644 index 210933cf..00000000 --- a/tools/generate_compile_flags.py +++ /dev/null @@ -1,54 +0,0 @@ -import argparse -import os -import os.path - -parser = argparse.ArgumentParser() -parser.add_argument('-d', '--debug', action='store_true', - default=True, help='indicates whether is in debug mode') -args = parser.parse_args() - -file_name = 'compile_flags.txt' - -# project root dir -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -os.chdir(project_root) - -global_std_standard = 'c++17' # change this to change standard -global_std_standard_arg = '--std={}'.format(global_std_standard) - -global_include_paths = [ - os.path.abspath('include') -] - -global_definitions = [] - -if args.debug: - global_definitions.append('_DEBUG') - - -def generate_content(additional_include_paths=[], additional_definitions=[]): - include_args = [ - '-I{}'.format(path) for path in additional_include_paths + global_include_paths] - definition_args = [ - '-D{}'.format(definition) for definition in additional_definitions + global_definitions] - args = [global_std_standard_arg] + include_args + definition_args - return '\n'.join(args) - - -def generate_root_file(): - with open(file_name, 'w') as f: - print(generate_content(), file=f) - - -def generate_win_content(): - return generate_content(additional_definitions=['UNICODE', '_UNICODE', 'WIN32', '_WINDOWS']) - - -def generate_win_file(): - for path in ['src/win/', 'include/cru/win/']: - with open(os.path.join(path, file_name), 'w') as f: - print(generate_win_content(), file=f) - - -generate_root_file() -generate_win_file() diff --git a/tools/migrate-1/migrate-cmake.py b/tools/migrate-1/migrate-cmake.py deleted file mode 100644 index b90bd2e9..00000000 --- a/tools/migrate-1/migrate-cmake.py +++ /dev/null @@ -1,26 +0,0 @@ -import re -from pathlib import Path - -regex = re.compile(r'\s*(.*\/)*(.*)(\.[hc]pp)$') - -def xstr(s): - if s is None: - return '' - return str(s) - -for p in Path('./src').rglob('CMakeLists.txt'): - text = '' - with p.open(mode='r', encoding='utf-8') as f: - for line in f.readlines(): - m = regex.match(line) - if m: - t = m.group(2) - t = ''.join(([i.capitalize() for i in t.split('_')])) - t = '\t{}{}{}\n'.format(xstr(m.group(1)), t, m.group(3)) - text += t - else: - text += line - with p.open(mode='w', encoding='utf-8') as f: - f.write(text) - - diff --git a/tools/migrate-1/migrate-files.py b/tools/migrate-1/migrate-files.py deleted file mode 100644 index 8ea8bde6..00000000 --- a/tools/migrate-1/migrate-files.py +++ /dev/null @@ -1,43 +0,0 @@ -import re -import pathlib - -regex = re.compile(r'#include\s+"(.*\/)*(.*)"') - - -def xstr(s): - if s is None: - return '' - return str(s) - - -def migrate_includes(path: pathlib.Path): - text = '' - with path.open(mode='r', encoding='utf-8') as f: - for line in f.readlines(): - m = regex.match(line) - if m: - t = m.group(2) - t = ''.join(([i.capitalize() for i in t.split('_')])) - t = '#include "{}{}"\n'.format(xstr(m.group(1)), t) - text += t - else: - text += line - - with path.open(mode='w', encoding='utf-8') as f: - f.write(text) - - -for p in pathlib.Path('./src').rglob('*.cpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) - -for p in pathlib.Path('./src').rglob('*.hpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) - -for p in pathlib.Path('./include/cru').rglob('*.hpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) diff --git a/tools/migrate-2/rename-hpp-to-h.py b/tools/migrate-2/rename-hpp-to-h.py deleted file mode 100644 index c72fb2e0..00000000 --- a/tools/migrate-2/rename-hpp-to-h.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 - -import os.path - -project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -def rename_hpp_to_h(dir): - for root, dirs, files in os.walk(dir): - for file in files: - if file.endswith(".hpp"): - os.rename(os.path.join(root, file), os.path.join(root, file[:-4] + ".h")) - -rename_hpp_to_h(os.path.join(project_root, "include")) -rename_hpp_to_h(os.path.join(project_root, "src")) -rename_hpp_to_h(os.path.join(project_root, "test")) -rename_hpp_to_h(os.path.join(project_root, "demos")) - -def replace_hpp_with_h(file): - with open(file, "r") as f: - content = f.read() - content = content.replace(".hpp", ".h") - with open(file, "w") as f: - f.write(content) - -def replace_hpp_with_h_recursive(dir): - for root, dirs, files in os.walk(dir): - for file in files: - if file.endswith(".cpp") or file.endswith(".h") or file.endswith(".mm"): - replace_hpp_with_h(os.path.join(root, file)) - -replace_hpp_with_h_recursive(os.path.join(project_root, "include")) -replace_hpp_with_h_recursive(os.path.join(project_root, "src")) -replace_hpp_with_h_recursive(os.path.join(project_root, "test")) -replace_hpp_with_h_recursive(os.path.join(project_root, "demos")) diff --git a/tools/proxy_domains.txt b/tools/proxy_domains.txt deleted file mode 100644 index c13a1d6f..00000000 --- a/tools/proxy_domains.txt +++ /dev/null @@ -1,6 +0,0 @@ -measonbuild.com -github.com -zlib.net -download.gnome.org -mirror.ossplanet.net - diff --git a/tools/win_build.py b/tools/win_build.py deleted file mode 100644 index 9e0371ac..00000000 --- a/tools/win_build.py +++ /dev/null @@ -1,71 +0,0 @@ -import argparse -import os -import os.path -import shutil -import subprocess -import sys - -parser = argparse.ArgumentParser() -parser.add_argument('command', choices=[ - 'configure', 'build', 'test'], nargs='?', default='test', 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'], - default='Debug', help='specify build configuration') -parser.add_argument('-d', '--work-dir', default='build', - help='specify working directory for building') -args = parser.parse_args() - - -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -work_dir = os.path.join(project_root, args.work_dir) - -# this is not used when generator is Visual Studio - - -# def init_vc_environment(arch): -# arch_bat_map = { -# 'x86': 'vcvarsamd64_x86', -# 'x64': 'vcvars64' -# } -# vars = subprocess.check_output(['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\{}'.format( -# arch_bat_map[arch]), '&&', 'set'], shell=True, text=True) -# for var in vars.splitlines(): -# k, _, v = map(str.strip, var.strip().partition('=')) -# if k.startswith('?'): -# continue -# os.environ[k] = v - -def configure(): - generater_vs_arch_map = { - 'x86': 'Win32', - 'x64': 'x64' - } - - # -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - subprocess.check_call('cmake -S . -B {build_dir} -G "Visual Studio 16 2019" -A {arch} -T host=x64' - .format(build_dir=work_dir, arch=generater_vs_arch_map[args.arch]), - stdout=sys.stdout, stderr=sys.stderr) - - -def build(): - subprocess.check_call('cmake --build {build_dir} --target ALL_BUILD --config {config}' - .format(build_dir=work_dir, config=args.config), - stdout=sys.stdout, stderr=sys.stderr) - - -def test(): - os.chdir(work_dir) - subprocess.check_call('ctest') - os.chdir(project_root) - - -os.chdir(project_root) - -configure() -if args.command == 'configure': - exit(0) -build() -if args.command == 'build': - exit(0) -test() -- cgit v1.2.3