Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzgh committed Feb 24, 2025
2 parents 56e8479 + 879c623 commit d5f4176
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ CMakeUserPresets.json
build/
.env/
app/
*.app
*.dmg
*.dep
*.exe
_CPack_Packages/
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
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ cd bin # vis.process/build/debug/bin or vis.process.process/build/release/bin

## Deployment

### MacOS

### Using `make-app.sh`

- Open `make-app.sh` in Visual Studio Code
- `F1` to open `Command Palette` and select `Tasks: Run Task`
- Select `Run Shell Script` from the drop down list
- `DMG` package is created in the `deploy/macos` folder

#### Using `cpack`

- Open terminal in the `build/release` directory
- Run `macdeployqt6 visParaflow.app`
- Run `cpack`
- `DMG` package is created in the `deploy/macos` folder

### Linux

#### Using `make-app.sh`
Expand Down Expand Up @@ -81,12 +97,11 @@ sudo dpkg -r visParaflow-<version>.deb # uninstall
### Windows

- Copy all Qt dependencies to the binary directory (e.g., `bin`)
- Locate `windeployqt` or `windeployqt6` in `<path to Qt toolset>\bin`:
- Locate `windeployqt6` in `<path to Qt toolset>\bin`:

```shell
# Cop all Qt dependencies over to bin folder.
windeployqt <path-to-your-executable> # for Qt5
windeployqt6 <path-to-your-executable> # for Qt6
windeployqt6 <path-to-your-executable>
```

#### Using `make-app.nsi`
Expand Down
5 changes: 4 additions & 1 deletion deploy/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(CPACK_DEBIAN_PACKAGE_SECTION utils)
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_SOURCE_DIR}/deploy/linux/debian/control"
"${CMAKE_SOURCE_DIR}/deploy/linux/debian/postinst"
"${CMAKE_SOURCE_DIR}/deploy/linux/debian/postrm")

# Include the CPack module.
Expand All @@ -44,7 +45,9 @@ set(Qt6_PLUGINS_DIR "${Qt6_LIB_DIR}/../plugins")
install(DIRECTORY "${Qt6_PLUGINS_DIR}/platforms" DESTINATION /opt/${PRODUCT}/plugins/ USE_SOURCE_PERMISSIONS)

# Install app script file
install(PROGRAMS "${CMAKE_SOURCE_DIR}/deploy/linux/app.sh" DESTINATION /usr/local/bin/ RENAME ${PRODUCT})
# Cope app stript file directly to usr/local/bin sometimes run into permission issues,
# so we copy it to /opt/${PRODUCT} first
install(PROGRAMS "${CMAKE_SOURCE_DIR}/deploy/linux/app.sh" DESTINATION /opt/${PRODUCT}/)

# Install app desktop and icon file
install(FILES "${CMAKE_SOURCE_DIR}/deploy/linux/app.desktop" DESTINATION /usr/share/applications/ RENAME ${PRODUCT}.desktop)
Expand Down
9 changes: 7 additions & 2 deletions deploy/linux/make-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mkdir -p $pkgdir/DEBIAN
mkdir -p $pkgdir/opt/$appname/bin
mkdir -p $pkgdir/opt/$appname/lib
mkdir -p $pkgdir/opt/$appname/plugins
mkdir -p $pkgdir/usr/local/bin
mkdir -p $pkgdir/usr/share/applications
mkdir -p $pkgdir/usr/share/icons/hicolor/48x48/apps
echo "The destination package directory have been created."
Expand All @@ -28,6 +27,10 @@ echo "The destination package directory have been created."
cp debian/control $pkgdir/DEBIAN/control
echo "The DEBIAN control file has been copied to package."

# Copy the DEBIAN postinst file.
cp debian/postinst $pkgdir/DEBIAN/postinst
echo "The DEBIAN postinst file has been copied to package."

# Copy the DEBIAN postrm file.
cp debian/postrm $pkgdir/DEBIAN/postrm
echo "The DEBIAN postrm file has been copied to package."
Expand All @@ -45,7 +48,9 @@ cp -r /opt/Qt/6.8.1/gcc_64/plugins/platforms $pkgdir/opt/$appname/plugins/
echo "The dependency plugins have been copied to the package."

# Copy the app script to the destination directory
cp app.sh $pkgdir/usr/local/bin/$appname
# Cope app stript file directly to usr/local/bin sometimes run into permission issues,
# so we copy it to /opt/${PRODUCT} first
cp app.sh $pkgdir/opt/$appname
echo "The app script has been copied to the package."

# Copy the app desktop file to the destination directory
Expand Down
25 changes: 10 additions & 15 deletions deploy/macos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@
include(InstallRequiredSystemLibraries)

# Set the CPack variables.
set(CPACK_PACKAGE_NAME "${PRODUCT}")
set(CPACK_PACKAGE_VERSION "${VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_NAME ${PRODUCT})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${DESCRIPTION}")
set(CPACK_PACKAGE_VENDOR "${PRODUCT}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_PACKAGE_VENDOR ${PRODUCT})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/deploy/macos")

# Set package generator to Apple Disk Image.
set(CPACK_GENERATOR "DragNDrop")
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 d5f4176

Please sign in to comment.