startup
This commit is contained in:
parent
38a355c14c
commit
c303d57370
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
build
|
||||||
|
.vscode
|
||||||
# ---> C++
|
# ---> C++
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
6
CMakeLists.txt
Normal file
6
CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
set(PYBIND11_FINDPYTHON ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
project(test_pybind11 VERSION 1.0 DESCRIPTION "a default project" LANGUAGES CXX)
|
||||||
|
find_package(pybind11 REQUIRED)
|
||||||
|
pybind11_add_module(${PROJECT_NAME} main.cpp)
|
17
main.cpp
Normal file
17
main.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <pybind11/pybind11.h>
|
||||||
|
#include <pybind11/stl.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) {
|
||||||
|
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