mirror of
https://github.com/YACReader/yacreader
synced 2026-03-02 19:00:04 -05:00
Migrate the build system to cmake
This commit is contained in:
@ -21,37 +21,30 @@ if [ "$ARCH" == "x86_64" ]; then
|
||||
ARCHS="x86_64"
|
||||
ARCH_NAME="Intel"
|
||||
else
|
||||
ARCHS="x86_64 arm64"
|
||||
ARCHS="x86_64;arm64"
|
||||
ARCH_NAME="U"
|
||||
fi
|
||||
|
||||
echo "Building for $ARCH_NAME"
|
||||
|
||||
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; }
|
||||
hash cmake 2>/dev/null || { echo >&2 "cmake command not available. Please add cmake to your PATH."; exit 1; }
|
||||
|
||||
echo "Compiling YACReader"
|
||||
cd YACReader
|
||||
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS"
|
||||
make
|
||||
cd ..
|
||||
echo "Configuring and building with CMake"
|
||||
cmake -B build \
|
||||
-G Ninja \
|
||||
-DDECOMPRESSION_BACKEND=7zip \
|
||||
-DBUILD_NUMBER="${BUILD_NUMBER}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_OSX_ARCHITECTURES="${ARCHS}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11
|
||||
|
||||
echo "Compiling YACReaderLibrary"
|
||||
cd YACReaderLibrary
|
||||
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS"
|
||||
make
|
||||
cd ..
|
||||
|
||||
echo "Compiling YACReaderLibraryServer"
|
||||
cd YACReaderLibraryServer
|
||||
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS"
|
||||
make
|
||||
cd ..
|
||||
cmake --build build --parallel
|
||||
|
||||
echo "Configuring release apps"
|
||||
|
||||
cp -R YACReader/YACReader.app YACReader.app
|
||||
cp -R YACReaderLibrary/YACReaderLibrary.app YACReaderLibrary.app
|
||||
cp -R YACReaderLibraryServer/YACReaderLibraryServer.app YACReaderLibraryServer.app
|
||||
cp -R build/bin/YACReader.app YACReader.app
|
||||
cp -R build/bin/YACReaderLibrary.app YACReaderLibrary.app
|
||||
cp -R build/bin/YACReaderLibraryServer.app YACReaderLibraryServer.app
|
||||
|
||||
hash macdeployqt 2>/dev/null || { echo >&2 "macdeployqt command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; }
|
||||
|
||||
@ -71,14 +64,22 @@ cp -R dependencies/7zip/macx/${ARCH}/* YACReaderLibraryServer.app/Contents/MacOS
|
||||
|
||||
cp -R release/server YACReaderLibrary.app/Contents/MacOS/
|
||||
cp -R release/server YACReaderLibraryServer.app/Contents/MacOS/
|
||||
cp -R release/languages YACReader.app/Contents/MacOS/
|
||||
cp -R release/languages YACReaderLibrary.app/Contents/MacOS/
|
||||
cp -R release/languages YACReaderLibraryServer.app/Contents/MacOS/
|
||||
|
||||
# Collect cmake-generated .qm translation files from the build tree
|
||||
# (release/languages is not tracked in git; cmake generates .qm in build subdirs)
|
||||
mkdir -p YACReader.app/Contents/MacOS/languages
|
||||
mkdir -p YACReaderLibrary.app/Contents/MacOS/languages
|
||||
mkdir -p YACReaderLibraryServer.app/Contents/MacOS/languages
|
||||
find build -name "*.qm" -exec cp {} YACReader.app/Contents/MacOS/languages/ \;
|
||||
find build -name "*.qm" -exec cp {} YACReaderLibrary.app/Contents/MacOS/languages/ \;
|
||||
find build -name "*.qm" -exec cp {} YACReaderLibraryServer.app/Contents/MacOS/languages/ \;
|
||||
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${BUILD_NUMBER}" YACReader.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string ${VERSION}" YACReader.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${BUILD_NUMBER}" YACReaderLibrary.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string ${VERSION}" YACReaderLibrary.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NUMBER}" YACReaderLibraryServer.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" YACReaderLibraryServer.app/Contents/Info.plist
|
||||
|
||||
if [ "$SKIP_CODESIGN" = false ]; then
|
||||
./signapps.sh
|
||||
|
||||
Reference in New Issue
Block a user