Merge pull request #213 from brianlheim/topic/pkg-dmg

cmake: use macdeployqt instead of fixup_bundle to deploy on macOS
This commit is contained in:
mjbudd77 2020-10-29 18:55:36 -04:00 committed by GitHub
commit ed61b97050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

3
.gitignore vendored
View File

@ -40,3 +40,6 @@ fceux-net-server
/output/cheats /output/cheats
/output/snaps /output/snaps
/output/sav /output/sav
# typical CMake build directory
/build

View File

@ -57,6 +57,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_PREFIX_PATH=`brew --prefix qt5` \
-DCMAKE_PROJECT_VERSION_MAJOR=$FCEUX_VERSION_MAJOR \ -DCMAKE_PROJECT_VERSION_MAJOR=$FCEUX_VERSION_MAJOR \
-DCMAKE_PROJECT_VERSION_MINOR=$FCEUX_VERSION_MINOR \ -DCMAKE_PROJECT_VERSION_MINOR=$FCEUX_VERSION_MINOR \
-DCMAKE_PROJECT_VERSION_PATCH=$FCEUX_VERSION_PATCH \ -DCMAKE_PROJECT_VERSION_PATCH=$FCEUX_VERSION_PATCH \

View File

@ -514,19 +514,24 @@ install( TARGETS ${APP_NAME}
BUNDLE DESTINATION . COMPONENT Runtime BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION bin COMPONENT Runtime ) RUNTIME DESTINATION bin COMPONENT Runtime )
set( APPS ${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app) # Use \$ to defer expansion until install script is called; CPack will call it with its own CMAKE_INSTALL_PREFIX
set( DIRS ${CMAKE_BINARY_DIR} /usr/local/lib) set(APP \${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app)
message(STATUS APPS: ${APPS})
message(STATUS DIRS: ${DIRS} )
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns ) set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
set(CPACK_GENERATOR "DRAGNDROP") set(CPACK_GENERATOR "DRAGNDROP")
include(CPACK) include(CPACK)
install( CODE "include(BundleUtilities) # macdeployqt tool that comes with Qt: https://doc.qt.io/qt-5/macos-deployment.html#macdeploy
fixup_bundle( \"${APPS}\" \"\" \"${DIRS}\") " # Compared to fixup_bundle, correctly finds and installs Qt-specific resources as well as non-Qt dependencies
find_program(MACDEPLOYQT macdeployqt)
if(NOT MACDEPLOYQT)
message(FATAL_ERROR "Could not find macdeployqt executable")
endif()
install( CODE "
message(STATUS \"Deploying and fixing up dependencies in app: ${APP}\")
execute_process(COMMAND \"${MACDEPLOYQT}\" \"${APP}\" -verbose=1)
"
COMPONENT Runtime COMPONENT Runtime
) )