Update make_exe.bat to use a venv, explicitly add onnxruntime dll to pyinstaller binary, add debug prints during build

This commit is contained in:
Tim Yuen 2022-09-10 23:24:22 -04:00
parent d6062c9664
commit 022a0520fa
3 changed files with 27 additions and 11 deletions

View file

@ -40,7 +40,7 @@ jobs:
make_exe.bat
- name: Move and zip files
- name: Move files for uploading
shell: bash # Using bash for all OSs should be fine, even on Windows
run: |
mv dist/facetracker ${{ env.dist-folder-path }}

View file

@ -1,16 +1,30 @@
echo "Started"
:: A venv is used so it's easy to add the onnxruntime dll to the binary
echo "Creating venv"
python -m venv venv
echo "Activating venv"
call venv\Scripts\activate.bat
echo "Installing dependencies"
pip install wheel
pip install onnxruntime opencv-python==4.5.4.60 pillow numpy pyinstaller
echo "Running pyinstaller"
pyinstaller facetracker.py --onedir ^
--add-binary dshowcapture/dshowcapture_x86.dll;. ^
--add-binary dshowcapture/dshowcapture_x64.dll;. ^
--add-binary dshowcapture/libminibmcapture32.dll;. ^
--add-binary dshowcapture/libminibmcapture64.dll;. ^
--add-binary escapi/escapi_x86.dll;. ^
--add-binary escapi/escapi_x64.dll;. ^
--add-binary dshowcapture/*.dll;. ^
--add-binary escapi/*.dll;. ^
--add-binary venv/lib/site-packages/onnxruntime/capi/*.dll;onnxruntime\capi ^
--add-binary msvcp140.dll;. ^
--add-binary vcomp140.dll;. ^
--add-binary concrt140.dll;. ^
--add-binary vccorlib140.dll;. ^
--add-binary run.bat;.
echo "Deleting opencv dll"
del dist\facetracker\cv2\opencv_videoio_*
echo "Finished"

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -e
PYTHON_BINARY=$(which python3)
if [[ -z "$PYTHON_BINARY" ]]; then
@ -12,18 +14,18 @@ if [[ -z "$PYTHON_BINARY" ]]; then
fi
echo "Creating venv"
"$PYTHON_BINARY" -m venv venv
source venv/bin/activate
echo "Installing packages"
pip install wheel # Make sure this is installed beforehand
pip install onnxruntime opencv-python==4.5.4.60 pillow numpy pyinstaller
echo "Creating binary"
pyinstaller --clean facetracker.py
pyinstaller --onedir --clean facetracker.py \
--add-binary venv/lib/python3.*/site-packages/onnxruntime/capi/*.so:onnxruntime/capi
echo "Files should be available in the dist/ folder"
echo "Done!"