Skip to content

Commit

Permalink
Update macOS deployment scripts and improve app packaging process
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzgh committed Feb 23, 2025
1 parent 44d6220 commit 7447db8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build/
.env/
app/
*.app
*.dmg
*.dep
*.exe

16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ if (APPLE)
${Implementation_FILES}
${Header_FILES}
${RESOURCES}
${ICNS_MACOS}
)

# Set the bundle properties.
set_target_properties(${PRODUCT} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/${PLIST_MACOS}"
MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/${ICNS_MACOS}"
)
# Set the bundle icon
set(MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/${ICNS_MACOS}")
set_source_files_properties(${MACOSX_BUNDLE_ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")

# Set the bundle Info.plist
set_target_properties(${PRODUCT} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/${PLIST_MACOS}")

# Include icon in the bundle
target_sources(${PRODUCT} PRIVATE ${MACOSX_BUNDLE_ICON_FILE})

elseif (UNIX)
message(STATUS "Building on Unix")

Expand Down
8 changes: 1 addition & 7 deletions deploy/macos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@ set(CPACK_GENERATOR "DragNDrop")
# Include the CPack module.
include(CPack)

# Set the CPack variables for the Apple Disk Image package.
set(CPACK_DMG_VOLUME_NAME "${PRODUCT}")

# Specify the Qt components to include in the package.
set(CPACK_COMPONENTS_ALL Libraries Application)

# Install the executable to the temporary directory
install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PRODUCT}.app" DESTINATION "/Applications/")
install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PRODUCT}.app" DESTINATION /Applications )
12 changes: 2 additions & 10 deletions deploy/macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@
<key>CFBundleName</key>
<string>visParaflow</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleExecutable</key>
<string>visParaflow</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleIconFile</key>
<string>workflow</string>
<string>app</string>
</dict>
</plist>
Empty file modified deploy/macos/app.icns
100644 → 100755
Empty file.
31 changes: 31 additions & 0 deletions deploy/macos/make-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Set the working directory
cd "$(dirname "$0")"

# Set the package names
appname="visParaflow"
verison="1.0.0"

# Set package directory
pkgdir="app"

# Set build directory
bindir="../../build/release/bin"

# Copy app to the package directory
mkdir -p $pkgdir
cp -r $bindir/$appname.app $pkgdir/
echo "The app has been copied to the package directory."

# Deploy the app
macdeployqt6 $pkgdir/$appname.app -always-overwrite -dmg
echo "The app has been deployed."

# Rename the app
mv $pkgdir/$appname.dmg ./$appname-$verison.dmg
echo "The app has been renamed."

# Remove the package directory
rm -rf $pkgdir
echo "The package directory has been removed."

0 comments on commit 7447db8

Please sign in to comment.