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 all 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
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build manylinux

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Initialize submodule
run: git submodule update --init --recursive
- name: Build in manylinux container
run: docker run --rm -v `pwd`:/repo --rm safijari/manylinux2010-x64 /repo/build.sh
- name: Tar up artifacts
run: tar -czf dist.tar.gz dist/
- uses: actions/upload-artifact@master
with:
name: dist
path: dist/
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();
}

27 changes: 27 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

rm /usr/bin/python
ln -s /opt/python/cp37-cp37m/bin/python /usr/bin/python
/opt/python/cp37-cp37m/bin/pip install -U auditwheel

cd /repo

rm -r build
rm -r dist

for folder in /opt/python/*
do
echo $folder
rm /usr/bin/python
ln -s $folder/bin/python /usr/bin/python
$folder/bin/pip install pybind11 pybind11-cmake
$folder/bin/python setup.py bdist_wheel
done

cd dist

ln -s /opt/python/cp37-cp37m/bin/python /usr/bin/python
for file in ./*
do
/opt/python/cp37-cp37m/bin/auditwheel repair --plat manylinux2010_x86_64 $file
done
Loading