This commit is contained in:
ZtRXR 2024-06-15 22:31:29 +08:00
parent 924ea088d1
commit ccfa4ac209
5 changed files with 32 additions and 228 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/CMakeLists.txt
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]

View File

@ -100,59 +100,19 @@
"documentation": {} "documentation": {}
}, },
{ {
"label": "Literal", "label": "*",
"importPath": "typing", "importPath": "pymake",
"description": "typing", "description": "pymake",
"isExtraImport": true, "isExtraImport": true,
"detail": "typing", "detail": "pymake",
"documentation": {} "documentation": {}
}, },
{ {
"label": "Self", "label": "cmake",
"importPath": "typing", "importPath": "pymake",
"description": "typing", "description": "pymake",
"isExtraImport": true, "isExtraImport": true,
"detail": "typing", "detail": "pymake",
"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": {} "documentation": {}
}, },
{ {
@ -236,186 +196,6 @@
"detail": ".venv.Scripts.activate_this", "detail": ".venv.Scripts.activate_this",
"documentation": {} "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", "label": "cmake",
"kind": 6, "kind": 6,

8
pdm.lock Normal file
View File

@ -0,0 +1,8 @@
# 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"

8
tests/generate_base.py Normal file
View File

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

View File

@ -0,0 +1,7 @@
from pymake import cmake
(
cmake("3.15")
.write()
)