Add support for building for different architectures on macos

This commit is contained in:
Luis Ángel San Martín Rodríguez
2023-07-17 23:17:17 +02:00
parent 560eff5f7a
commit a355a15c4b
2 changed files with 80 additions and 11 deletions

View File

@ -9,29 +9,39 @@ SKIP_CODESIGN=${3:-false}
QT_VERSION=${4:-""}
ARCH=${5:-"arm64"}
echo "building macos binaries with these params: ${VERSION} ${BUILD_NUMBER} ${SKIP_CODESIGN} ${QT_VERSION}"
if [ "$5" == "clean" ]; then
if [ "$6" == "clean" ]; then
./cleanOSX.sh
fi
if [ "$ARCH" == "arm64"]; then
ARCH_NAME="Apple"
fi
if [ "$ARCH" == "x86_64"]; then
ARCH_NAME="Intel"
fi
hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; }
echo "Compiling YACReader"
cd YACReader
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
make
cd ..
echo "Compiling YACReaderLibrary"
cd YACReaderLibrary
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
make
cd ..
echo "Compiling YACReaderLibraryServer"
cd YACReaderLibraryServer
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
make
cd ..
@ -53,9 +63,9 @@ mkdir -p YACReader.app/Contents/MacOS/utils
mkdir -p YACReaderLibrary.app/Contents/MacOS/utils
mkdir -p YACReaderLibraryServer.app/Contents/MacOS/utils
cp -R dependencies/7zip/macx/* YACReader.app/Contents/MacOS/utils/
cp -R dependencies/7zip/macx/* YACReaderLibrary.app/Contents/MacOS/utils/
cp -R dependencies/7zip/macx/* YACReaderLibraryServer.app/Contents/MacOS/utils/
cp -R dependencies/7zip/macx/${ARCH}/* YACReader.app/Contents/MacOS/utils/
cp -R dependencies/7zip/macx/${ARCH}/* YACReaderLibrary.app/Contents/MacOS/utils/
cp -R dependencies/7zip/macx/${ARCH}/* YACReaderLibraryServer.app/Contents/MacOS/utils/
cp -R release/server YACReaderLibrary.app/Contents/MacOS/
cp -R release/server YACReaderLibraryServer.app/Contents/MacOS/
@ -74,7 +84,7 @@ fi
echo "Preparing apps for release, Done."
dest="YACReader-$VERSION.$BUILD_NUMBER MacOSX-Intel ${QT_VERSION}"
dest="YACReader-$VERSION.$BUILD_NUMBER MacOSX-${ARCH_NAME} ${QT_VERSION}"
echo "Copying to destination folder ${dest}"
mkdir -p "$dest"
cp -R YACReader.app "${dest}/YACReader.app"