mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 13:50:12 +08:00
Static linking on Windows (#385)
* Static linking on Windows * build Qt static with actions --------- Co-authored-by: Nova <mahdi.zrei@gmail.com>
This commit is contained in:
parent
5c4ef35b48
commit
4798208f40
23
.github/workflows/build.yml
vendored
23
.github/workflows/build.yml
vendored
@ -75,7 +75,6 @@ jobs:
|
|||||||
- platform: windows-latest
|
- platform: windows-latest
|
||||||
qt_version: "6.9.0"
|
qt_version: "6.9.0"
|
||||||
target: amd64
|
target: amd64
|
||||||
qt_arch: win64_mingw
|
|
||||||
- platform: ubuntu-22.04
|
- platform: ubuntu-22.04
|
||||||
qt_version: "6.9.0"
|
qt_version: "6.9.0"
|
||||||
target: amd64
|
target: amd64
|
||||||
@ -97,23 +96,34 @@ jobs:
|
|||||||
- name: Install mingw
|
- name: Install mingw
|
||||||
if: matrix.platform == 'windows-latest'
|
if: matrix.platform == 'windows-latest'
|
||||||
uses: bwoodsend/setup-winlibs-action@v1.15
|
uses: bwoodsend/setup-winlibs-action@v1.15
|
||||||
|
- name: Install ninja-build tool
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@v5
|
||||||
|
|
||||||
- name: Download Artifacts
|
- name: Download Artifacts
|
||||||
uses: actions/download-artifact@v4.1.8
|
uses: actions/download-artifact@v4.1.8
|
||||||
with:
|
with:
|
||||||
path: download-artifact
|
path: download-artifact
|
||||||
# ========================================================================================================= Qt Install
|
# ========================================================================================================= Qt Install
|
||||||
|
- name: Qt static Cache
|
||||||
|
id: cache-static-Qt
|
||||||
|
if: matrix.platform == 'windows-latest'
|
||||||
|
uses: actions/cache@v4.2.0
|
||||||
|
with:
|
||||||
|
path: qt6/build
|
||||||
|
key: QtStaticCache-${{ matrix.platform }}-${{ matrix.target }}-Qt${{ matrix.qt_version }}
|
||||||
|
- name: Install Qt Windows
|
||||||
|
shell: powershell
|
||||||
|
if: matrix.platform == 'windows-latest' && steps.cache-static-Qt.outputs.cache-hit != 'true'
|
||||||
|
run: ./script/build_qt_static_windows.bat ${{ matrix.qt_version }}
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v4.1.1
|
uses: jurplel/install-qt-action@v4.1.1
|
||||||
|
if: matrix.platform != 'windows-latest'
|
||||||
with:
|
with:
|
||||||
arch: ${{ matrix.qt_arch }}
|
|
||||||
version: ${{ matrix.qt_version }}
|
version: ${{ matrix.qt_version }}
|
||||||
setup-python: true
|
setup-python: true
|
||||||
cache: true
|
cache: true
|
||||||
cache-key-prefix: QtCache-${{ matrix.platform }}-${{ matrix.target }}
|
cache-key-prefix: QtCache-${{ matrix.platform }}-${{ matrix.target }}
|
||||||
# ========================================================================================================= Install Ninja and Build deps
|
# ========================================================================================================= Build deps
|
||||||
- name: Install ninja-build tool
|
|
||||||
uses: seanmiddleditch/gha-setup-ninja@v5
|
|
||||||
- name: Cache Download
|
- name: Cache Download
|
||||||
id: cache-deps
|
id: cache-deps
|
||||||
uses: actions/cache@v4.2.0
|
uses: actions/cache@v4.2.0
|
||||||
@ -132,9 +142,10 @@ jobs:
|
|||||||
CC: gcc.exe
|
CC: gcc.exe
|
||||||
CXX: g++.exe
|
CXX: g++.exe
|
||||||
run: |
|
run: |
|
||||||
|
export CMAKE_PREFIX_PATH=$PWD/qt6/build/lib/cmake
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -GNinja -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release ..
|
cmake -GNinja -DQT_VERSION_MAJOR=6 -DCMAKE_CXX_FLAGS="-static -DNDEBUG -s" ..
|
||||||
ninja -j2
|
ninja -j2
|
||||||
cd ..
|
cd ..
|
||||||
./script/deploy_windows64.sh
|
./script/deploy_windows64.sh
|
||||||
|
|||||||
14
script/build_qt_static_windows.bat
Normal file
14
script/build_qt_static_windows.bat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
git clone https://code.qt.io/qt/qt5.git qt6
|
||||||
|
cd qt6
|
||||||
|
|
||||||
|
git switch %1
|
||||||
|
mkdir build
|
||||||
|
CALL .\configure.bat -release -static -prefix ./build -static-runtime -submodules qtbase,qtimageformats,qtsvg,qttranslations -skip tests -skip examples -gui -widgets -init-submodules
|
||||||
|
echo on branch %1
|
||||||
|
echo config complete, building...
|
||||||
|
cmake --build . --parallel
|
||||||
|
echo build one, installing...
|
||||||
|
ninja install
|
||||||
|
echo installed Qt %1 in static mode
|
||||||
|
|
||||||
|
cd ..
|
||||||
@ -18,10 +18,3 @@ tar xvzf artifacts.tgz -C ../../
|
|||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
mv $DEPLOYMENT/public_res/* $DEST
|
mv $DEPLOYMENT/public_res/* $DEST
|
||||||
|
|
||||||
#### deploy qt & DLL runtime ####
|
|
||||||
pushd $DEST
|
|
||||||
windeployqt nekoray.exe --no-translations --no-system-d3d-compiler --no-opengl-sw --no-svg --verbose 2
|
|
||||||
popd
|
|
||||||
|
|
||||||
rm -rf $DEST/dxcompiler.dll $DEST/dxil.dll
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user