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 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 \ 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 )