notes/QT/打包项目.md

31 lines
836 B
Markdown
Raw Permalink Normal View History

2024-04-29 22:22:30 +08:00
### 打包项目
2023-11-11 13:41:44 +08:00
```
sudo apt install patchelf
git clone https://github.com/probonopd/linuxdeployqt --depth=1
cd linuxdeployqt
vi CMakeLists.txt
```
* 将 find_program 开始到 # set version and build number 之间的代码注释掉
* 切换到 ./tools/linuxdeployqt 下, 这里还有个 CMakeLists.txt 要改, find_package 这里根据QT版本是啥写啥, 后面 target_link_libraries也要同步修改
```
#find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) #修改前
find_package(Qt5 REQUIRED COMPONENTS Core) #修改后
#target_link_libraries(linuxdeployqt Qt${QT_VERSION_MAJOR}::Core) #修改前
target_link_libraries(linuxdeployqt Qt5::Core) #修改后
```
* 同目录下还有个 main.cpp 要改, 51行到54行版本检测注释掉, 192行到213行的libc版本检测注释掉
```
cmake CMakeLists.txt
make
```