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

Added pre-downloaded 3rdparty files to source packages #639

Merged
merged 1 commit into from Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build_wheels_linux.yml
Expand Up @@ -171,12 +171,14 @@ jobs:

- name: Build a package
run: |
# Download all 3rdparty files
source scripts/source-packages-preparation.sh ${{ github.workspace }}
set -e
# Build and package
set -x
python -m pip install --upgrade pip
python -m pip install scikit-build
python setup.py sdist
python setup.py sdist --formats=xztar
set +x
# Install and run tests
set -x
Expand All @@ -186,7 +188,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/opencv*.tar.gz
path: dist/opencv*.tar.xz

test_release_opencv_python:
if: github.event_name == 'release' && github.event.release.prerelease
Expand Down
20 changes: 20 additions & 0 deletions scripts/source-packages-preparation.sh
@@ -0,0 +1,20 @@
#!/bin/bash

# ${1} variable is a path to repository opencv-python

# Define flags
if [ "0" == $ENABLE_CONTRIB ]; then
git submodule update --init opencv
EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty"
else
git submodule update --init opencv opencv_contrib
EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty -DOPENCV_EXTRA_MODULES_PATH=${1}/opencv_contrib/modules"
fi

# Download 3rdparty files
cd opencv && \
mkdir generate && \
cd generate && \
cmake $EXTRA_CMAKE_OPTIONS ${1}/opencv && \
cd ${1} && \
rm -rf opencv/generate
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -162,6 +162,8 @@ def main():
"-DPYTHON3_LIMITED_API=ON",
"-DBUILD_OPENEXR=ON",
"-DBUILD_PNG=ON",
# To have all 3rdparty files in one place for source packages
"-DOPENCV_DOWNLOAD_PATH=%s" % (os.path.join(os.path.dirname(os.path.abspath(__file__)), "opencv", "3rdparty")),
]
+ (
# If it is not defined 'linker flags: /machine:X86' on Windows x64
Expand Down