Compare commits
No commits in common. "b0351c932368403f5b1228fba75dd6c44194797a" and "d2bab3232d6a093b40fd26830c7d1c5a5ac58c1a" have entirely different histories.
b0351c9323
...
d2bab3232d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,6 +1,3 @@
|
|||||||
[submodule "pybind11"]
|
[submodule "pybind11"]
|
||||||
path = pybind11
|
path = pybind11
|
||||||
url = https://git.zziyu.cn/Zengtudor/pybind11.git
|
url = https://git.zziyu.cn/Zengtudor/pybind11.git
|
||||||
[submodule "glfw"]
|
|
||||||
path = glfw
|
|
||||||
url = https://git.zziyu.cn/Zengtudor/glfw.git
|
|
||||||
|
@ -4,10 +4,4 @@ project(test_pybind11 VERSION 1.0 DESCRIPTION "a default project" LANGUAGES CXX)
|
|||||||
file(GLOB_RECURSE SRC src/*.cpp)
|
file(GLOB_RECURSE SRC src/*.cpp)
|
||||||
find_package(Python 3.12.3 COMPONENTS Interpreter Development REQUIRED)
|
find_package(Python 3.12.3 COMPONENTS Interpreter Development REQUIRED)
|
||||||
find_package(pybind11 CONFIG REQUIRED)
|
find_package(pybind11 CONFIG REQUIRED)
|
||||||
|
|
||||||
pybind11_add_module(${PROJECT_NAME} ${SRC})
|
pybind11_add_module(${PROJECT_NAME} ${SRC})
|
||||||
|
|
||||||
add_subdirectory(glfw)
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE glfw)
|
|
||||||
find_package(OpenGl REQUIRED)
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL)
|
|
1
glfw
1
glfw
@ -1 +0,0 @@
|
|||||||
Subproject commit b35641f4a3c62aa86a0b3c983d163bc0fe36026d
|
|
4
make.py
4
make.py
@ -8,10 +8,6 @@ from pymake import *
|
|||||||
.file("SRC",glob_recurse,"src/*.cpp")
|
.file("SRC",glob_recurse,"src/*.cpp")
|
||||||
.just_add("""find_package(Python 3.12.3 COMPONENTS Interpreter Development REQUIRED)""")
|
.just_add("""find_package(Python 3.12.3 COMPONENTS Interpreter Development REQUIRED)""")
|
||||||
.just_add("find_package(pybind11 CONFIG REQUIRED)")
|
.just_add("find_package(pybind11 CONFIG REQUIRED)")
|
||||||
.add_subdirectory("glfw")
|
|
||||||
.target_link_libraries(var(project_name),"glfw")
|
|
||||||
.find_package("OpenGl")
|
|
||||||
.target_link_libraries(var(project_name),"OpenGL::GL")
|
|
||||||
.pybind11_add_module(var(project_name),var("SRC"))
|
.pybind11_add_module(var(project_name),var("SRC"))
|
||||||
.write()
|
.write()
|
||||||
)
|
)
|
14
src/main.cpp
14
src/main.cpp
@ -1,9 +1,17 @@
|
|||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
|
|
||||||
|
int add(int i, int j) {
|
||||||
|
return i + j;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> sort_num(std::vector<int> array){
|
||||||
|
std::sort(array.begin(),array.end());
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
PYBIND11_MODULE(test_pybind11, m) {
|
PYBIND11_MODULE(test_pybind11, m) {
|
||||||
m.doc() = "glpy a python opengl project"; // optional module docstring
|
m.doc() = "pybind11 example plugin"; // optional module docstring
|
||||||
|
m.def("sort_num",&sort_num,"A function to sort INT numbers");
|
||||||
|
m.def("add", &add, "A function that adds two numbers");
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user