Skip to content

Commit

Permalink
WIP #15
Browse files Browse the repository at this point in the history
  • Loading branch information
timdewhirst committed May 26, 2022
1 parent e1da2b6 commit 9bef74d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ TAGS
*.so
.vscode/
.idea/
test/
!test/*.cpp
build/
2 changes: 2 additions & 0 deletions openpiv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -g -O3 -ffast-math")
endif()

add_subdirectory(pybind)

# install
#install(TARGETS ${LIBNAME} DESTINATION lib/${LIBNAME})

Expand Down
10 changes: 10 additions & 0 deletions openpiv/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(
pyopenpivcore
core/bindings.cpp
)
target_link_libraries(
pyopenpivcore
PRIVATE openpivcore)
37 changes: 37 additions & 0 deletions openpiv/pybind/core/bindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

// openpiv
#include "core/size.h"

using namespace openpiv;
using namespace openpiv::core;

// pybiond
#include <pybind11/pybind11.h>

namespace py = pybind11;

PYBIND11_MODULE(pyopenpivcore, m) {
m.doc() = R"pbdoc(
openpivcore python plugin
-------------------------
.. currentmodule:: pyopenpivcore
.. autosummary::
:toctree: _generate
size
)pbdoc";

// size
py::class_<size>(m, "size")
.def(py::init<size::component_t, size::component_t>())
.def("width", &size::width)
.def("height", &size::height);

#ifdef VERSION_INFO
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
#else
m.attr("__version__") = "dev";
#endif
}
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"tiff",
"benchmark",
"asyncplusplus",
"pybind11",
{ "name": "mimalloc", "platform": "!(arm | uwp)" }
]
}

0 comments on commit 9bef74d

Please sign in to comment.