CMake: use BundleUtilities to fix up Dolphin.app

This commit is contained in:
Michael Maltese
2017-02-03 16:10:59 -08:00
parent 529dc6aa53
commit 38816bf51d
6 changed files with 61 additions and 176 deletions

View File

@ -49,13 +49,16 @@ if(APPLE)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
)
# Update library references to make the bundle portable
add_custom_command(TARGET ${DOLPHINQT2_BINARY} POST_BUILD
COMMAND echo "Fixing up application bundle: ${BUNDLE_PATH}"
COMMAND echo ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py $<TARGET_FILE_DIR:${DOLPHINQT2_BINARY}>/../..
)
# Copy qt.conf into the bundle
target_sources(${DOLPHINQT2_BINARY} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# Copy resources in the bundle
# Copy Qt plugins into the bundle
get_target_property(qtcocoa_location Qt5::QCocoaIntegrationPlugin LOCATION)
target_sources(${DOLPHINQT2_BINARY} PRIVATE "${qtcocoa_location}")
set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)
# Copy resources into the bundle
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
foreach(res ${resources})
target_sources(${DOLPHINQT2_BINARY} PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
@ -64,6 +67,10 @@ if(APPLE)
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
endforeach()
# Update library references to make the bundle portable
include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(${DOLPHINQT2_BINARY})
else()
install(TARGETS ${DOLPHINQT2_BINARY} RUNTIME DESTINATION ${bindir})
endif()

View File

View File

@ -176,11 +176,8 @@ if(wxWidgets_FOUND)
endforeach()
# Update library references to make the bundle portable
add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD
COMMAND echo "Fixing up application bundle: ${BUNDLE_PATH}"
COMMAND ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py $<TARGET_FILE_DIR:${DOLPHIN_EXE}>/../..
)
include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(${DOLPHIN_EXE})
# Install bundle into systemwide /Applications directory.
install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications)