Compare commits

..

No commits in common. "main" and "update" have entirely different histories.
main ... update

14 changed files with 85 additions and 894 deletions

167
.gitignore vendored
View File

@ -1,163 +1,14 @@
/CMakeLists.txt
# Byte-compiled / optimized / DLL files
# Ignore the 'dist' directory at the root of the project
/dist/
# Ignore all __pycache__ directories in the project
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
/.vscode
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
/CMakeLists.txt
# 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
/main.cxx
# 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
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm-project.org/#use-with-ide
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# 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/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
/build
/poetry.lock

View File

@ -1,615 +0,0 @@
[
{
"label": "runpy",
"kind": 6,
"isExtraImport": true,
"importPath": "runpy",
"description": "runpy",
"detail": "runpy",
"documentation": {}
},
{
"label": "annotations",
"importPath": "__future__",
"description": "__future__",
"isExtraImport": true,
"detail": "__future__",
"documentation": {}
},
{
"label": "os",
"kind": 6,
"isExtraImport": true,
"importPath": "os",
"description": "os",
"detail": "os",
"documentation": {}
},
{
"label": "site",
"kind": 6,
"isExtraImport": true,
"importPath": "site",
"description": "site",
"detail": "site",
"documentation": {}
},
{
"label": "sys",
"kind": 6,
"isExtraImport": true,
"importPath": "sys",
"description": "sys",
"detail": "sys",
"documentation": {}
},
{
"label": "Literal",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Self",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Type",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "TypeVar",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "List",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Tuple",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Union",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Literal",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Self",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Type",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "TypeVar",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "List",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Tuple",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "Union",
"importPath": "typing",
"description": "typing",
"isExtraImport": true,
"detail": "typing",
"documentation": {}
},
{
"label": "*",
"importPath": "pymake",
"description": "pymake",
"isExtraImport": true,
"detail": "pymake",
"documentation": {}
},
{
"label": "*",
"importPath": "pymake",
"description": "pymake",
"isExtraImport": true,
"detail": "pymake",
"documentation": {}
},
{
"label": "bin_dir",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "bin_dir = os.path.dirname(abs_file)\nbase = bin_dir[: -len(\"Scripts\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"pymake-3.12\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "base",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "base = bin_dir[: -len(\"Scripts\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"pymake-3.12\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"PATH\"]",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "os.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"pymake-3.12\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"VIRTUAL_ENV\"]",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "os.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"pymake-3.12\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"VIRTUAL_ENV_PROMPT\"]",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "os.environ[\"VIRTUAL_ENV_PROMPT\"] = \"pymake-3.12\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "prev_length",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "prev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "sys.path[:]",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "sys.real_prefix",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "sys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "sys.prefix",
"kind": 5,
"importPath": ".venv.Scripts.activate_this",
"description": ".venv.Scripts.activate_this",
"peekOfCode": "sys.prefix = base",
"detail": ".venv.Scripts.activate_this",
"documentation": {}
},
{
"label": "cmake",
"kind": 6,
"importPath": "build.lib.pymake.cmake",
"description": "build.lib.pymake.cmake",
"peekOfCode": "class cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:\n for i in self.__write_stack__:\n f.write(i)",
"detail": "build.lib.pymake.cmake",
"documentation": {}
},
{
"label": "ModesPPI",
"kind": 5,
"importPath": "build.lib.pymake.cmake",
"description": "build.lib.pymake.cmake",
"peekOfCode": "ModesPPI = Literal[\"PUBLIC\",\"PRIVATE\",\"INTERFACE\"]\nModesSSM = Literal[\"STATIC\",\"SHARED\",\"MODULE\"]\nclass cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:",
"detail": "build.lib.pymake.cmake",
"documentation": {}
},
{
"label": "ModesSSM",
"kind": 5,
"importPath": "build.lib.pymake.cmake",
"description": "build.lib.pymake.cmake",
"peekOfCode": "ModesSSM = Literal[\"STATIC\",\"SHARED\",\"MODULE\"]\nclass cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:\n for i in self.__write_stack__:",
"detail": "build.lib.pymake.cmake",
"documentation": {}
},
{
"label": "var",
"kind": 2,
"importPath": "build.lib.pymake.tools",
"description": "build.lib.pymake.tools",
"peekOfCode": "def var(name:str)->str:\n return f\"${{{name}}}\"\ndef args_to_str(args:Union[List[str],Tuple[str,...]])->str:\n vars_str = \"\"\n for i in args:\n vars_str=f\"{vars_str} {i}\"\n return vars_str",
"detail": "build.lib.pymake.tools",
"documentation": {}
},
{
"label": "args_to_str",
"kind": 2,
"importPath": "build.lib.pymake.tools",
"description": "build.lib.pymake.tools",
"peekOfCode": "def args_to_str(args:Union[List[str],Tuple[str,...]])->str:\n vars_str = \"\"\n for i in args:\n vars_str=f\"{vars_str} {i}\"\n return vars_str",
"detail": "build.lib.pymake.tools",
"documentation": {}
},
{
"label": "cmake_export_compile_commands",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "cmake_export_compile_commands = \"CMAKE_EXPORT_COMPILE_COMMANDS\"\nproject_name=\"PROJECT_NAME\"\npublic = \"PUBLIC\"\nstatic = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "public",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "public = \"PUBLIC\"\nstatic = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "static",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "static = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "shared",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "shared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "module",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "module = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "private",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "private = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "interface",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "interface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "glob_recurse",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "glob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_standard",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "cmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "cmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "o3",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "o3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "o2",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "o2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags_release",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "cmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags_debug",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "cmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "project_source_dir",
"kind": 5,
"importPath": "build.lib.pymake.values",
"description": "build.lib.pymake.values",
"peekOfCode": "project_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "build.lib.pymake.values",
"documentation": {}
},
{
"label": "cmake",
"kind": 6,
"importPath": "src.pymake.cmake",
"description": "src.pymake.cmake",
"peekOfCode": "class cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:\n for i in self.__write_stack__:\n f.write(i)",
"detail": "src.pymake.cmake",
"documentation": {}
},
{
"label": "ModesPPI",
"kind": 5,
"importPath": "src.pymake.cmake",
"description": "src.pymake.cmake",
"peekOfCode": "ModesPPI = Literal[\"PUBLIC\",\"PRIVATE\",\"INTERFACE\"]\nModesSSM = Literal[\"STATIC\",\"SHARED\",\"MODULE\"]\nclass cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:",
"detail": "src.pymake.cmake",
"documentation": {}
},
{
"label": "ModesSSM",
"kind": 5,
"importPath": "src.pymake.cmake",
"description": "src.pymake.cmake",
"peekOfCode": "ModesSSM = Literal[\"STATIC\",\"SHARED\",\"MODULE\"]\nclass cmake:\n __write_stack__:List[str] = []\n __file_name__:str\n def __init__(self,version_min:str,file_name:str=\"CMakeLists.txt\") -> None:\n self.__file_name__ = file_name\n self.__write_stack__.append(f\"cmake_minimum_required(VERSION {version_min})\")\n def write(self)->None:\n with open(file=self.__file_name__,mode=\"+w\",encoding=\"utf8\") as f:\n for i in self.__write_stack__:",
"detail": "src.pymake.cmake",
"documentation": {}
},
{
"label": "var",
"kind": 2,
"importPath": "src.pymake.tools",
"description": "src.pymake.tools",
"peekOfCode": "def var(name:str)->str:\n return f\"${{{name}}}\"\ndef args_to_str(args:Union[List[str],Tuple[str,...]])->str:\n vars_str = \"\"\n for i in args:\n vars_str=f\"{vars_str} {i}\"\n return vars_str",
"detail": "src.pymake.tools",
"documentation": {}
},
{
"label": "args_to_str",
"kind": 2,
"importPath": "src.pymake.tools",
"description": "src.pymake.tools",
"peekOfCode": "def args_to_str(args:Union[List[str],Tuple[str,...]])->str:\n vars_str = \"\"\n for i in args:\n vars_str=f\"{vars_str} {i}\"\n return vars_str",
"detail": "src.pymake.tools",
"documentation": {}
},
{
"label": "cmake_export_compile_commands",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "cmake_export_compile_commands = \"CMAKE_EXPORT_COMPILE_COMMANDS\"\nproject_name=\"PROJECT_NAME\"\npublic = \"PUBLIC\"\nstatic = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "public",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "public = \"PUBLIC\"\nstatic = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "static",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "static = \"STATIC\"\nshared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "shared",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "shared = \"SHARED\"\nmodule = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "module",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "module = \"MODULE\"\nprivate = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "private",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "private = \"PRIVATE\"\ninterface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "interface",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "interface = \"INTERFACE\"\nglob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "glob_recurse",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "glob_recurse = \"GLOB_RECURSE\"\ncmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_standard",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "cmake_cxx_standard = \"CMAKE_CXX_STANDARD\"\ncmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "cmake_cxx_flags = \"CMAKE_CXX_FLAGS\"\no3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "o3",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "o3 = \"-O3\"\no2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "o2",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "o2 = \"-O2\"\ncmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags_release",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "cmake_cxx_flags_release = \"CMAKE_CXX_FLAGS_RELEASE\"\ncmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "cmake_cxx_flags_debug",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "cmake_cxx_flags_debug = \"CMAKE_CXX_FLAGS_DEBUG\"\non=\"ON\"\nproject_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
},
{
"label": "project_source_dir",
"kind": 5,
"importPath": "src.pymake.values",
"description": "src.pymake.values",
"peekOfCode": "project_source_dir = \"PROJECT_SOURCE_DIR\"",
"detail": "src.pymake.values",
"documentation": {}
}
]

View File

@ -11,8 +11,8 @@ pip install <file name>
## 自行编译
```bash
pip install poetry
pdm install
pdm build
poetry install
poetry build
pip install ./dist/pymake-0.1.0-py3-none-any.whl
```
# 如何使用

View File

@ -1,8 +0,0 @@
# This file is @generated by PDM.
# It is not intended for manual editing.
[metadata]
groups = ["default"]
strategy = ["cross_platform", "inherit_metadata"]
lock_version = "4.4.1"
content_hash = "sha256:6f8b4890fa91fbbb3c3f0bdfd60adec605569359abd9df026cc6060bb446dde4"

62
pymake/cmake.py Normal file
View File

@ -0,0 +1,62 @@
from .tools import *
from .values import *
class cmake:
__write_stack:"list[str]" = []
__file_name = ""
def __init__(self,version_min:"str",file_name:"str"="CMakeLists.txt") -> None:
self.__file_name = file_name
self.__write_stack.append(f"cmake_minimum_required(VERSION {version_min})")
def write(self)->None:
with open(file=self.__file_name,mode="+w",encoding="utf8") as f:
for i in self.__write_stack:
f.write(i)
f.write("\n")
def project(self,name:"str"="default",version:"str"="1.0",description:"str"="a default project",languages:"str"="CXX")->"cmake":
self.__write_stack.append(f"project({name} VERSION {version} DESCRIPTION \"{description}\" LANGUAGES {languages})")
return self
def add_executable(self,name:"str"=var(project_name),*source:"str")->"cmake":
self.__write_stack.append(f"add_executable({name} {args_to_str(source)})")
return self
def add_library(self,name:"str"=var(project_name),mode:"str"=static,*source:"str")->"cmake":
"""
ARGS:
mode: mode can be STATIC , SHARED or MODULE
"""
self.__write_stack.append(f"add_library({name} {mode} {args_to_str(source)})")
return self
def target_include_directories(self,for_project:"str"=var(project_name),mode:"str"=public,*directories:"str")->"cmake":
"""
ARGS:
mode : mode can be PUBLIC PRIVATE INTERFACE
"""
self.__write_stack.append(f"target_include_directories({for_project} {mode} {args_to_str(directories)})")
return self
def set(self,name:"str",value:"str")->"cmake":
self.__write_stack.append(f"set({name} {value})")
return self
def target_link_libraries(self,lib_name:"str",name:"str"=var(project_name),mode:"str"=public)->"cmake":
self.__write_stack.append(f"target_link_libraries({name} {mode} {lib_name})")
return self
def target_link_directories(self,name:"str"=var(project_name),mode:"str"=public,*directories:"str")->"cmake":
self.__write_stack.append(f"target_link_directories({name} {mode} {args_to_str(directories)})")
return self
def just_add(self,sentence:"str")->"cmake":
self.__write_stack.append(sentence)
return self
def file(self,new_var_name:"str",mode:"str"=glob_recurse,*search_str:"str")->"cmake":
self.__write_stack.append(f"file({mode} {new_var_name} {args_to_str(search_str)})")
return self
def add_subdirectory(self,path:str)->'cmake':
self.__write_stack.append(f"add_subdirectory({path})")
return self

View File

@ -1,10 +1,8 @@
from typing import List, Tuple, Union
from typing import *
def var(name:str)->str:
return f"${{{name}}}"
def args_to_str(args:Union[List[str],Tuple[str,...]])->str:
def args_to_str(args:list[str])->str:
vars_str = ""
for i in args:
vars_str=f"{vars_str} {i}"

View File

@ -1,15 +1,15 @@
[project]
[tool.poetry]
name = "pymake"
version = "0.1.0"
description = "Default template for PDM package"
authors = [
{name = "ZtRXR", email = "Zengtudor@outlook.com"},
]
dependencies = []
requires-python = "==3.12.*"
description = "一个基于函数式编程用于生成cmake文件的python库"
authors = ["Zengtudor"]
license = "MIT"
readme = "README.md"
license = {text = "MIT"}
[tool.poetry.dependencies]
python = "^3.10"
[tool.pdm]
distribution = true
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

View File

@ -1,80 +0,0 @@
from typing import Literal, Self, Type, TypeVar
from .tools import *
from .values import *
ModesPPI = Literal["PUBLIC","PRIVATE","INTERFACE"]
ModesSSM = Literal["STATIC","SHARED","MODULE"]
class cmake:
__write_stack__:List[str] = []
__file_name__:str
def __init__(self,version_min:str,file_name:str="CMakeLists.txt") -> None:
self.__file_name__ = file_name
self.__write_stack__.append(f"cmake_minimum_required(VERSION {version_min})")
def write(self)->None:
with open(file=self.__file_name__,mode="+w",encoding="utf8") as f:
for i in self.__write_stack__:
f.write(i)
f.write("\n")
def project(self,name:str="default",version:str="1.0",description:str="a default project",languages:str="CXX")->Self:
self.__write_stack__.append(f"project({name} VERSION {version} DESCRIPTION \"{description}\" LANGUAGES {languages})")
return self
def add_executable(self,name:str=var(project_name),*source:str)->Self:
self.__write_stack__.append(f"add_executable({name} {args_to_str(source)})")
return self
def add_library(self,name:str=var(project_name),mode:ModesSSM="STATIC",*source:str)->Self:
self.__write_stack__.append(f"add_library({name} {mode} {args_to_str(source)})")
return self
def target_include_directories(self,for_project:str=var(project_name),mode:ModesPPI="PUBLIC",*directories:str)->Self:
self.__write_stack__.append(f"target_include_directories({for_project} {mode} {args_to_str(directories)})")
return self
def set(self,name:str,value:str)->Self:
self.__write_stack__.append(f"set({name} {value})")
return self
def target_link_libraries(self,lib_name:str,name:str=var(project_name),mode:ModesPPI="PUBLIC")->Self:
self.__write_stack__.append(f"target_link_libraries({name} {mode} {lib_name})")
return self
def target_link_directories(self,name:str=var(project_name),mode:ModesPPI="PUBLIC",*directories:str)->Self:
self.__write_stack__.append(f"target_link_directories({name} {mode} {args_to_str(directories)})")
return self
def just_add(self,sentence:str)->Self:
self.__write_stack__.append(sentence)
return self
def file(self,new_var_name:str,mode:str=glob_recurse,*search_str:str)->Self:
self.__write_stack__.append(f"file({mode} {new_var_name} {args_to_str(search_str)})")
return self
def add_subdirectory(self,path:str)->Self:
self.__write_stack__.append(f"add_subdirectory({path})")
return self
def pybind11_add_module(self, project_name:str=var(project_name), *source:str)->Self:
"""
cmake_minimum_required(VERSION 3.5...3.27)
project(example LANGUAGES CXX)
add_subdirectory(pybind11)
pybind11_add_module(example example.cpp)
"""
self.__write_stack__.append(f"pybind11_add_module({project_name} {args_to_str(source)})")
return self
def find_package(self,package_name:str,quiet:Literal["REQUIRED","QUIET"]="REQUIRED")->Self:
"""
find_package(<package> [version] [EXACT] [QUIET] [MODULE]
[REQUIRED] [[COMPONENTS] [components...]]
[OPTIONAL_COMPONENTS components...]
[NO_POLICY_SCOPE])
"""
self.__write_stack__.append(f"find_package({package_name} {quiet})")
return self

View File

View File

@ -1,8 +0,0 @@
from pymake import *
(
cmake("3.5")
.file("SRC",glob_recurse,"*.cpp")
.add_executable("test_base",var("SRC"))
.write()
)

View File

@ -1,9 +0,0 @@
from pymake import *
(
cmake("3.15")
.project("test_pybind11")
.pybind11_add_module(var(project_name),"main.cpp")
.write()
)