add pybind11_add_module

This commit is contained in:
ZtRXR 2024-06-15 22:54:28 +08:00
parent ccfa4ac209
commit 02fec5c637
2 changed files with 10 additions and 1 deletions

View File

@ -56,4 +56,12 @@ class cmake:
def add_subdirectory(self,path:str)->Self:
self.__write_stack__.append(f"add_subdirectory({path})")
return self
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)})")

View File

@ -3,5 +3,6 @@ from pymake import cmake
(
cmake("3.15")
# TODO
.write()
)