Skip to content

Commit da74f43

Browse files
qryxipy-chan
andcommitted
PyInstallerのbootloaderをカスタマイズする
以下のコメントが非常に参考になった。 @y-chan に感謝する。 VOICEVOX#502 (comment) Co-authored-by: Yuto Ashida <[email protected]>
1 parent 462095b commit da74f43

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ jobs:
270270
run: |
271271
python -m pip install -r requirements-dev.txt
272272
273+
# Modify PyInstaller to enable NvOptimusEnablement and AmdPowerXpressRequestHighPerformance
274+
./build_util/modify_pyinstaller.bash
275+
273276
# Download pyopenjtalk dictionary
274277
# try 5 times, sleep 5 seconds before retry
275278
for i in $(seq 5); do

build_util/modify_pyinstaller.bash

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
pyinstaller_version=$(pyinstaller -v)
6+
tempdir=$(mktemp -dt modify_pyinstaller.XXXXXXXX)
7+
trap 'rm -rf "$tempdir"' EXIT
8+
git clone https://github.com/pyinstaller/pyinstaller.git "$tempdir" -b "v$pyinstaller_version" --depth 1
9+
cat > "$tempdir/bootloader/src/symbols.c" << EOF
10+
#ifdef _WIN32
11+
#include <windows.h>
12+
13+
// https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm
14+
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
15+
16+
// https://gpuopen.com/learn/amdpowerxpressrequesthighperformance/
17+
__declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
18+
#endif
19+
EOF
20+
(cd "$tempdir/bootloader" && python ./waf all)
21+
pip install -U "$tempdir"

0 commit comments

Comments
 (0)