Skip to content

Commit

Permalink
macOS packaging: replace our use of PackageMaker with that of product…
Browse files Browse the repository at this point in the history
…build (#2210).
  • Loading branch information
agarny committed Nov 25, 2019
1 parent d8aa1a5 commit a24ec55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Expand Up @@ -1262,6 +1262,8 @@ endif()

# Package OpenCOR

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${CMAKE_PROJECT_NAME})

set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_CONTACT "Team OpenCOR (team@opencor.ws)")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
Expand Down Expand Up @@ -1411,12 +1413,14 @@ if(WIN32)
")
endif()
elseif(APPLE)
# Select PackageMaker and ZIP as the packagers on macOS
# Select productbuild and ZIP as the packagers on macOS

set(CPACK_GENERATOR PackageMaker ZIP)
set(CPACK_GENERATOR productbuild ZIP)
set(CPACK_SYSTEM_NAME "macOS")
set(CPACK_PROJECT_CONFIG_FILE ${PLATFORM_DISTRIB_DIR}/package.cmake)

set(CPACK_COMPONENTS_ALL ${CMAKE_PROJECT_NAME})

set(CPACK_RESOURCE_FILE_WELCOME "${PLATFORM_DISTRIB_DIR}/welcome.txt")
set(CPACK_RESOURCE_FILE_README "${DISTRIB_DIR}/readMe.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
Expand Down
12 changes: 12 additions & 0 deletions package
Expand Up @@ -21,6 +21,18 @@ cpack

exitCode=$?

if [ "`uname -s`" = "Darwin" ]; then
packageName="OpenCOR-`date '+%Y-%m-%d'`-macOS"

mkdir ${packageName}

mv ${packageName}.pkg ${packageName}

hdiutil create -srcfolder ${packageName} ${packageName}.dmg

rm -fr ${packageName}
fi

cd $origDir

if [ $exitCode -eq 0 ]; then
Expand Down

0 comments on commit a24ec55

Please sign in to comment.