Skip to content

Commit

Permalink
Enhance Linux deployment instructions and improve packaging scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzgh committed Feb 23, 2025
1 parent 2a93c4f commit 8040f15
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 21 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,39 @@ cd bin # vis.process/build/debug/bin or vis.process.process/build/release/bin

## Deployment

### Linux

#### 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
- `DEBIAN` package is created in the `deploy/linux` folder

#### Using `cpack`

- Open terminal in the `build/release` directory
- Run `cpack`
- `DEBIAN` package is created in the `deploy/linux` folder

#### Notes

- Use the following commands to check the `debian` package:

```bash
ar x visParaflow-<version>.deb
mkdir tmp
tar -xzf data.tar.gz -C tmp # for gz format
tar -xvf data.tar.zst -C tmp # for zst format
```

- Install/uninstall the package using:

```bash
sudo dpkg -i visParaflow-<version>.deb # install
sudo dpkg -r visParaflow-<version>.deb # uninstall
```

### Windows

- Copy all Qt dependencies to the binary directory (e.g., `bin`)
Expand Down
33 changes: 17 additions & 16 deletions deploy/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
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/linux")

# Set the CPack generator to DEB.
set(CPACK_GENERATOR "DEB")
set(CPACK_GENERATOR DEB)

# Set the CPack variables for the DEB package.
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${AUTHOR}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.27)")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
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/postrm")
Expand All @@ -27,24 +28,24 @@ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
include(CPack)

# Install the executable to the temporary directory
install(PROGRAMS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PRODUCT}" DESTINATION "/opt/${PRODUCT}/bin/")
install(PROGRAMS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PRODUCT}" DESTINATION /opt/${PRODUCT}/bin/)

# Get Qt6 lib directory
get_target_property(Qt6_LIB_DIR Qt6::Core LOCATION)
get_filename_component(Qt6_LIB_DIR ${Qt6_LIB_DIR} DIRECTORY)

# Install the Qt6 libraries to the temporary directory
install(DIRECTORY "${Qt6_LIB_DIR}" DESTINATION "/opt/${PRODUCT}/" USE_SOURCE_PERMISSIONS)
install(DIRECTORY "${Qt6_LIB_DIR}" DESTINATION /opt/${PRODUCT}/ USE_SOURCE_PERMISSIONS)

# Get Qt6 plugins directory
set(Qt6_PLUGINS_DIR "${Qt6_LIB_DIR}/../plugins")

# Install the Qt6 plugins to the temporary directory
install(DIRECTORY "${Qt6_PLUGINS_DIR}/platforms" DESTINATION "/opt/${PRODUCT}/plugins/" USE_SOURCE_PERMISSIONS)
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}")
install(PROGRAMS "${CMAKE_SOURCE_DIR}/deploy/linux/app.sh" DESTINATION /usr/local/bin/ RENAME ${PRODUCT})

# Install app desktop and icon file
install(FILES "${CMAKE_SOURCE_DIR}/deploy/linux/app.desktop" DESTINATION "/usr/share/applications/" RENAME "${PRODUCT}.desktop")
install(FILES "${CMAKE_SOURCE_DIR}/deploy/linux/app.svg" DESTINATION "/usr/share/icons/hicolor/48x48/apps/" RENAME "${PRODUCT}.svg")
install(FILES "${CMAKE_SOURCE_DIR}/deploy/linux/app.desktop" DESTINATION /usr/share/applications/ RENAME ${PRODUCT}.desktop)
install(FILES "${CMAKE_SOURCE_DIR}/deploy/linux/app.svg" DESTINATION /usr/share/icons/hicolor/48x48/apps/ RENAME ${PRODUCT}.svg)
4 changes: 0 additions & 4 deletions deploy/linux/make-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ echo "The app icon has been copied to the package."
dpkg-deb --build $pkgdir $appname-$verison.deb
echo "The DEBIAN package has been created."

# Move the package to the deploy directory
mv $appname.deb ../../build/release/
echo "The DEBIAN package has been moved to the build directory."

# Clean up the package directory
rm -rf $pkgdir
echo "The package directory has been cleaned up."
2 changes: 1 addition & 1 deletion deploy/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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_DESCRIPTION_SUMMARY "${DESCRIPTION}")
set(CPACK_PACKAGE_VENDOR ${PRODUCT})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PRODUCT})
Expand Down

0 comments on commit 8040f15

Please sign in to comment.