From 92fb68ec58681026f4eb9f3d6de8b362d2933d7b Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Mon, 30 Oct 2023 10:18:23 -0400 Subject: [PATCH] Trying to dynamically find DLLs for Windows PyInstaller --- .github/workflows/pyinstaller.yml | 2 ++ pyinstaller.spec | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pyinstaller.yml b/.github/workflows/pyinstaller.yml index 436ea31..6999c1b 100644 --- a/.github/workflows/pyinstaller.yml +++ b/.github/workflows/pyinstaller.yml @@ -66,6 +66,8 @@ jobs: - name: Run build run: | # Get-ChildItem -Path C:\ -Filter libcasadi.dll -Recurse + CPATH=$pythonLocation/include/python${{ matrix.python-version }}m + echo "CPATH=$CPATH" >> $GITHUB_ENV pyinstaller pyinstaller.spec ${{ github.event.inputs.type }} - uses: actions/upload-artifact@v2 with: diff --git a/pyinstaller.spec b/pyinstaller.spec index cb3b0e9..0f2916a 100644 --- a/pyinstaller.spec +++ b/pyinstaller.spec @@ -48,10 +48,11 @@ hidden_imports_numpy = collect_submodules('numpy') hidden_imports = hidden_imports + hidden_imports_numpy if sys.platform == 'win32': - dlls = [('libcasadi.dll', '.'), - ('libcasadi_nlpsol_ipopt.dll', '.'), - ('libgfortran-3.dll', '.'), - ('libquadmath-0.dll', '.')] + print(os.path.join(os.environ['CPATH'])) + dlls = [(os.path.join(os.environ['CPATH'], 'libcasadi.dll'), '.'), + (os.path.join(os.environ['CPATH'], 'libcasadi_nlpsol_ipopt.dll'), '.'), + (os.path.join(os.environ['CPATH'], 'libgfortran-3.dll'), '.'), + (os.path.join(os.environ['CPATH'], 'libquadmath-0.dll'), '.')] else: dlls = []