Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking PR for updated build method #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
lanms/adaptor.so
*.so
__pycache__
build
lanms.egg-info
*.egg-info
.idea
venv3
dist
*.pyc
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pybind11"]
path = pybind11
url = https://github.com/pybind/pybind11.git
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to pin the version of pybind? Otherwise, this module will break as soon as there are breaking changes introduced into pybind11.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, last time I added the submodule to another package it pinned it to a particular commit hash. I can do that

14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "-fpermissive -std=c++0x")

project(lanms_adaptor)

include_directories(include)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/)

add_library(clipper SHARED include/clipper/clipper.cpp)

add_subdirectory(pybind11)
pybind11_add_module(lanms_adaptor adaptor.cpp)
target_link_libraries(lanms_adaptor clipper)
13 changes: 0 additions & 13 deletions Makefile

This file was deleted.

6 changes: 2 additions & 4 deletions adaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace py = pybind11;


namespace lanms_adaptor {

std::vector<std::vector<float>> polys2floats(const std::vector<lanms::Polygon> &polys) {
Expand Down Expand Up @@ -50,12 +49,11 @@ namespace lanms_adaptor {

}

PYBIND11_PLUGIN(adaptor) {
py::module m("adaptor", "NMS");
PYBIND11_PLUGIN(lanms_adaptor) {
py::module m("lanms_adaptor", "NMS");

m.def("merge_quadrangle_n9", &lanms_adaptor::merge_quadrangle_n9,
"merge quadrangels");

return m.ptr();
}

Loading