-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from akaszynski/master
Build wheels
- Loading branch information
Showing
180 changed files
with
1,143 additions
and
29,235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Build and upload | ||
|
||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- "*" | ||
branches: | ||
- "master" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Setup MSVC Developer Command Prompt | ||
if: matrix.os == 'windows-latest' | ||
uses: TheMrMilchmann/[email protected] | ||
with: | ||
arch: x64 | ||
toolset: 14.36.32532 | ||
|
||
- name: Cache OpenCV build | ||
if: matrix.os == 'windows-latest' | ||
id: cache-opencv | ||
uses: actions/cache@v3 | ||
with: | ||
path: D:/a/graph-cut-ransac/graph-cut-ransac/opencv | ||
key: opencv3-4-5-${{ runner.os }}-${{ hashFiles('scripts/build-opencv.ps1') }} | ||
|
||
- name: Build OpenCV on Windows | ||
if: matrix.os == 'windows-latest' && steps.cache-opencv.outputs.cache-hit != 'true' | ||
run: scripts/build-opencv.ps1 | ||
shell: pwsh | ||
|
||
- name: Cache Eigen3 build | ||
if: matrix.os == 'windows-latest' | ||
id: cache-eigen3 | ||
uses: actions/cache@v3 | ||
with: | ||
path: C:/eigen3 | ||
key: eigen3-${{ runner.os }}-${{ hashFiles('scripts/build-eigen3.ps1') }} | ||
|
||
- name: Install Eigen3 on Windows | ||
if: matrix.os == 'windows-latest' && steps.cache-eigen3.outputs.cache-hit != 'true' | ||
run: scripts/build-eigen3.ps1 | ||
shell: pwsh | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ENVIRONMENT_WINDOWS: 'OpenCV_DIR="D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build" Eigen3_DIR="C:/eigen3"' | ||
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build/bin" | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: pygcransac-wheels-${{ runner.os }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Build | ||
run: pipx run build --sdist | ||
|
||
- name: Validate | ||
run: | | ||
pip install twine | ||
twine check dist/* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: pygcransac-sdist | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
name: Release and upload to PyPI | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
# upload to PyPI on every tag | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
steps: | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
# Download all artifacts | ||
- uses: actions/download-artifact@v3 | ||
|
||
- name: Upload to Public PyPi | ||
run: | | ||
pip install twine | ||
twine upload --skip-existing ./**/*.whl | ||
twine upload --skip-existing ./**/*.tar.gz | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true | ||
files: | | ||
./**/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
docker_tag: | ||
description: 'Docker tag' | ||
required: true | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_and_push: | ||
name: Build and possibly Push Docker image to GitHub Packages | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set Docker tag | ||
run: | | ||
echo "::set-output name=tag::${{ github.event.inputs.docker_tag }}" | ||
id: docker_tag | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./docker | ||
push: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
tags: ghcr.io/${{ github.repository }}/manylinux2014_x86_64_opencv3:${{ steps.docker_tag.outputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/pybind11"] | ||
path = lib/pybind11 | ||
url = https://github.com/pybind/pybind11.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Start with the base image | ||
FROM quay.io/pypa/manylinux2014_x86_64:2023-07-14-55e4124 | ||
|
||
# Copy the shell script from your host to the container | ||
COPY install-opencv-3.4.5-in-centos-7.sh /root/install-opencv-3.4.5-in-centos-7.sh | ||
|
||
# Execute the script | ||
RUN /root/install-opencv-3.4.5-in-centos-7.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Manylinux Wheels for Graph-Cut-RANSAC with OpenCV and Eigen | ||
|
||
This directory is used to create a docker image to support the building manylinux wheels for the project [Graph-Cut-RANSAC](https://github.com/danini/graph-cut-ransac), requiring OpenCV 3.4.5 and Eigen. The build is optimized for OpenCV with the absolute minimum number of modules. This optimization is important because `auditwheel` will attempt to include all modules when they're all built, which could significantly increase the build time and result in an unnecessarily large wheel file. | ||
|
||
By minimizing the number of modules in OpenCV, we're able to reduce the build time and create a more efficient wheel file. | ||
|
||
## Getting Started | ||
|
||
To build this image, navigate to the `docker` directory and use the following command: | ||
|
||
```bash | ||
cd docker | ||
docker build -t manylinux2014_x86_64_opencv3:latest . | ||
``` | ||
|
||
## Details | ||
|
||
This repository provides the Dockerfile needed to create a `manylinux2014` docker image that includes the following: | ||
|
||
- OpenCV v3.4.5 | ||
- Eigen | ||
- gflag | ||
|
||
This image is tagged as `manylinux2014_x86_64_opencv3:latest`. | ||
|
||
|
||
## License | ||
|
||
This repository uses the MIT license. Please refer to the original projects for | ||
licensing information: | ||
|
||
- [Graph-Cut-RANSAC](https://github.com/danini/graph-cut-ransac) | ||
- [OpenCV](https://github.com/opencv/opencv) | ||
- [Eigen](https://github.com/libigl/eigen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/bash | ||
|
||
# Build and install OpenCV from source on CentOS 7 for graph-cut-ransac and MAGSAC++ | ||
|
||
# install dependencies for opencv and magsac | ||
yum update -y | ||
yum install -y cmake3 eigen3-devel gflags-devel | ||
yum clean all && rm -rf /var/cache/yum # clean cache | ||
|
||
# Download opencv | ||
git clone --depth 1 --branch 3.4.5 https://github.com/opencv/opencv.git | ||
cd opencv | ||
mkdir build && cd build | ||
|
||
# Compile and install OpenCV with contrib modules | ||
cmake3 -D CMAKE_BUILD_TYPE=RELEASE \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/local \ | ||
-D INSTALL_C_EXAMPLES=OFF \ | ||
-D INSTALL_PYTHON_EXAMPLES=OFF \ | ||
-D PYTHON3_EXECUTABLE=/usr/bin/python3.6 \ | ||
-D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3.6 \ | ||
-D PYTHON3_VERSION_STRING="3.6.8" \ | ||
-D BUILD_opencv_cudacodec=OFF \ | ||
-D WITH_1394:BOOL=OFF \ | ||
-D WITH_ARAVIS:BOOL=OFF \ | ||
-D WITH_CLP:BOOL=OFF \ | ||
-D WITH_CUDA:BOOL=OFF \ | ||
-D WITH_EIGEN:BOOL=ON \ | ||
-D WITH_FFMPEG:BOOL=OFF \ | ||
-D WITH_GDAL:BOOL=OFF \ | ||
-D WITH_GDCM:BOOL=OFF \ | ||
-D WITH_GIGEAPI:BOOL=OFF \ | ||
-D WITH_GPHOTO2:BOOL=OFF \ | ||
-D WITH_GSTREAMER:BOOL=OFF \ | ||
-D WITH_GSTREAMER_0_10:BOOL=OFF \ | ||
-D WITH_GTK:BOOL=OFF \ | ||
-D WITH_GTK_2_X:BOOL=OFF \ | ||
-D WITH_HALIDE:BOOL=OFF \ | ||
-D WITH_IMGCODEC_HDR:BOOL=OFF \ | ||
-D WITH_IMGCODEC_PXM:BOOL=OFF \ | ||
-D WITH_IMGCODEC_SUNRASTER:BOOL=OFF \ | ||
-D WITH_INF_ENGINE:BOOL=OFF \ | ||
-D WITH_IPP:BOOL=OFF \ | ||
-D WITH_ITT:BOOL=OFF \ | ||
-D WITH_JASPER:BOOL=OFF \ | ||
-D WITH_JPEG:BOOL=OFF \ | ||
-D WITH_LAPACK:BOOL=ON \ | ||
-D WITH_LIBV4L:BOOL=OFF \ | ||
-D WITH_MFX:BOOL=OFF \ | ||
-D WITH_OPENCL:BOOL=OFF \ | ||
-D WITH_OPENCLAMDBLAS:BOOL=OFF \ | ||
-D WITH_OPENCLAMDFFT:BOOL=OFF \ | ||
-D WITH_OPENCL_SVM:BOOL=OFF \ | ||
-D WITH_OPENEXR:BOOL=OFF \ | ||
-D WITH_OPENGL:BOOL=OFF \ | ||
-D WITH_OPENMP:BOOL=OFF \ | ||
-D WITH_OPENNI:BOOL=OFF \ | ||
-D WITH_OPENNI2:BOOL=OFF \ | ||
-D WITH_OPENVX:BOOL=OFF \ | ||
-D WITH_PNG:BOOL=OFF \ | ||
-D WITH_PROTOBUF:BOOL=OFF \ | ||
-D WITH_PTHREADS_PF:BOOL=ON \ | ||
-D WITH_PVAPI:BOOL=OFF \ | ||
-D WITH_QT:BOOL=OFF \ | ||
-D WITH_QUIRC:BOOL=OFF \ | ||
-D WITH_TBB:BOOL=OFF \ | ||
-D WITH_TIFF:BOOL=OFF \ | ||
-D WITH_UNICAP:BOOL=OFF \ | ||
-D WITH_V4L:BOOL=OFF \ | ||
-D WITH_VA:BOOL=OFF \ | ||
-D WITH_VA_INTEL:BOOL=OFF \ | ||
-D WITH_VTK:BOOL=OFF \ | ||
-D WITH_WEBP:BOOL=OFF \ | ||
-D WITH_XIMEA:BOOL=OFF \ | ||
-D WITH_XINE:BOOL=OFF \ | ||
-D BUILD_EXAMPLES=OFF \ | ||
-D BUILD_TESTS:BOOL=OFF \ | ||
-D BUILD_TIFF:BOOL=OFF \ | ||
-D BUILD_USE_SYMLINKS:BOOL=OFF \ | ||
-D BUILD_WEBP:BOOL=OFF \ | ||
-D BUILD_WITH_DEBUG_INFO:BOOL=OFF \ | ||
-D BUILD_WITH_DYNAMIC_IPP:BOOL=OFF \ | ||
-D BUILD_ZLIB:BOOL=OFF \ | ||
-D BUILD_opencv_apps:BOOL=OFF \ | ||
-D BUILD_opencv_dnn:BOOL=OFF \ | ||
-D BUILD_opencv_highgui:BOOL=OFF \ | ||
-D BUILD_opencv_imgcodecs:BOOL=OFF \ | ||
-D BUILD_opencv_java_bindings_generator:BOOL=OFF \ | ||
-D BUILD_opencv_js:BOOL=OFF \ | ||
-D BUILD_opencv_ml:BOOL=OFF \ | ||
-D BUILD_opencv_objdetect:BOOL=OFF \ | ||
-D BUILD_opencv_photo:BOOL=OFF \ | ||
-D BUILD_opencv_python_bindings_generator:BOOL=OFF \ | ||
-D BUILD_opencv_shape:BOOL=OFF \ | ||
-D BUILD_opencv_stitching:BOOL=OFF \ | ||
-D BUILD_opencv_superres:BOOL=OFF \ | ||
-D BUILD_opencv_ts:BOOL=OFF \ | ||
-D BUILD_opencv_video:BOOL=OFF \ | ||
-D BUILD_opencv_videoio:BOOL=OFF \ | ||
-D BUILD_opencv_videostab:BOOL=OFF \ | ||
-D BUILD_opencv_world:BOOL=OFF \ | ||
-D BUILD_opencv_calib3d:BOOL=ON \ | ||
-D BUILD_opencv_features2d:BOOL=ON \ | ||
-D BUILD_opencv_imgproc:BOOL=ON \ | ||
-D BUILD_opencv_core:BOOL=ON \ | ||
-D BUILD_opencv_flann:BOOL=ON .. | ||
|
||
# compile and install OpenCV | ||
make -j && make install | ||
|
||
# Remove OpenCV source | ||
cd ../.. | ||
rm -rf opencv |
Oops, something went wrong.