为什么从./configure
脚本中删除-universal
选项?
如何从源代码创建通用二进制文件?我能够分别创建32位和64位框架,如下所示:
1) 64位QT框架
#Choose platform from qtbase/mkspecs/
./configure -release -opensource -confirm-license -prefix /tmp/ -nomake tests -nomake examples -platform macx-clang
#Only needed QTcore, QTNetwork, QTGui module, so i choose "module-qtbase"
make -j4 module-qtbase
在创建32位之前将qtbase/lib/
复制到某个位置
2) 32位QT框架
./configure -release -opensource -confirm-license -prefix /tmp/ -nomake tests -nomake examples -platform macx-clang-32
make -j4 module-qtbase
现在在32位qtbaselib
和64位qtbaselib
上使用lipo
是很麻烦的。有什么新的方法可以在MAC上创建通用二进制文件吗?
我仍然需要支持32bit。
我不得不手动编写如下。如果其他人提出更好的答案,我会接受他们的。
#This is in qt-everywhere/src/ directory
#Build for 32-bit
./configure -release -opensource -confirm-license -prefix ~/tmp/ -nomake tests -nomake examples -openssl-linked -I $(OPENSSL_INC) -L $(OPENSSL_LIB) -platform macx-clang-32
make
#Backup required 32-bit binaries. I only needed qtbase and plugins
#-R because frameworks contain symlinks
cp -Rf qtbase/lib ../out_32/lib
cp -Rf qtbase/plugins ../out_32/plugins
make clean
./configure -release -opensource -confirm-license -prefix ~/tmp/ -nomake tests -nomake examples -openssl-linked -I $(OPENSSL_INC) -L $(OPENSSL_LIB) -platform macx-clang
make
#Backup required 64-bit binaries.
cp -Rf qtbase/lib ../out_64/lib
cp -Rf qtbase/plugins ../out_64/plugins
cd ..
#creating universal frameworks
FR="QtGui QtCore QtNetwork QtWidgets"
for fr in ${FR}; do
rm -rf out/$fr.framework
cp -Rf out_64/lib/$fr.framework out/
rm -rf out/$fr.framework/Versions/Current/$fr
lipo -create -output out/$fr.framework/Versions/Current/$fr
out_32/lib/$fr.framework/Versions/Current/$fr
out_64/lib/$fr.framework/Versions/Current/$fr
done
out
目录包含通用框架。