From 2480ee81d4efc7cdda66c0bbba0a878ce42e09d2 Mon Sep 17 00:00:00 2001 From: Brian Heim Date: Thu, 29 Oct 2020 08:51:20 -0500 Subject: [PATCH 1/3] cmake: use macdeployqt instead of fixup_bundle to deploy on macOS remove unused variable - bundle generator vars are unused by dragndrop see comments for more info --- src/CMakeLists.txt | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c543c79..c26f5fd8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -514,19 +514,24 @@ install( TARGETS ${APP_NAME} BUNDLE DESTINATION . COMPONENT Runtime RUNTIME DESTINATION bin COMPONENT Runtime ) -set( APPS ${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app) -set( DIRS ${CMAKE_BINARY_DIR} /usr/local/lib) - -message(STATUS APPS: ${APPS}) -message(STATUS DIRS: ${DIRS} ) +# Use \$ to defer expansion until install script is called; CPack will call it with its own CMAKE_INSTALL_PREFIX +set(APP \${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app) set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns ) -set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns ) set(CPACK_GENERATOR "DRAGNDROP") include(CPACK) -install( CODE "include(BundleUtilities) - fixup_bundle( \"${APPS}\" \"\" \"${DIRS}\") " +# macdeployqt tool that comes with Qt: https://doc.qt.io/qt-5/macos-deployment.html#macdeploy +# 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 ) From a3e66d0a80bcb7b60cfefff6fd8bb70936fa6d15 Mon Sep 17 00:00:00 2001 From: Brian Heim Date: Thu, 29 Oct 2020 10:00:35 -0500 Subject: [PATCH 2/3] gitignore: add /build --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 04d5c0d0..1697f268 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ fceux-net-server /output/cheats /output/snaps /output/sav + +# typical CMake build directory +/build From 74e4cfe0de01a25f55ebd47ca045b794febb7d76 Mon Sep 17 00:00:00 2001 From: Brian Heim Date: Thu, 29 Oct 2020 10:00:54 -0500 Subject: [PATCH 3/3] appveyor: add qt5 prefix path to CMAKE_PREFIX_PATH when configuring --- pipelines/macOS_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pipelines/macOS_build.sh b/pipelines/macOS_build.sh index 9774b0d3..b6ac0807 100755 --- a/pipelines/macOS_build.sh +++ b/pipelines/macOS_build.sh @@ -57,6 +57,7 @@ cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ + -DCMAKE_PREFIX_PATH=`brew --prefix qt5` \ -DCMAKE_PROJECT_VERSION_MAJOR=$FCEUX_VERSION_MAJOR \ -DCMAKE_PROJECT_VERSION_MINOR=$FCEUX_VERSION_MINOR \ -DCMAKE_PROJECT_VERSION_PATCH=$FCEUX_VERSION_PATCH \