mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:49:19 +01:00
macOS: Update how resources are copied in the bundle
Instead of using install() commands, we use the MACOSX_PACKAGE_LOCATION property, which will allow the files to be identified and updated individually by the build system without having to remove the entire folder and copy it each time. deploy-mac.py is now idempotent and should be working properly, so we'll call it all the time from now on.
This commit is contained in:
parent
0f9a6697fb
commit
e9aac53cec
@ -49,41 +49,21 @@ if(APPLE)
|
|||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
||||||
)
|
)
|
||||||
|
|
||||||
# get rid of any old copies
|
# Update library references to make the bundle portable
|
||||||
file (REMOVE_RECURSE ${BUNDLE_PATH}/Contents/Resources/Sys)
|
|
||||||
if(NOT SKIP_POSTPROCESS_BUNDLE)
|
|
||||||
# Fix up the bundle after it is finished.
|
|
||||||
# There does not seem to be an easy way to run CMake commands post-build,
|
|
||||||
# so we invoke CMake again on a generated script.
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake "
|
|
||||||
include(BundleUtilities)
|
|
||||||
message(\"Fixing up application bundle: ${BUNDLE_PATH}\")
|
|
||||||
message(\"(Note: This is only necessary to produce a redistributable binary.\")
|
|
||||||
message(\"To skip, pass -DSKIP_POSTPROCESS_BUNDLE=1 to cmake.)\")
|
|
||||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py -p platforms/libqcocoa.dylib \"${BUNDLE_PATH}\"
|
|
||||||
RESULT_VARIABLE retcode
|
|
||||||
)
|
|
||||||
if(NOT \${retcode} EQUAL 0)
|
|
||||||
message(FATAL_ERROR \"Error when postprocessing bundle (return code: \${retcode}).\")
|
|
||||||
endif()
|
|
||||||
file(INSTALL ${CMAKE_SOURCE_DIR}/Data/Sys
|
|
||||||
DESTINATION ${BUNDLE_PATH}/Contents/Resources
|
|
||||||
)
|
|
||||||
")
|
|
||||||
add_custom_command(TARGET ${DOLPHINQT2_BINARY} POST_BUILD
|
add_custom_command(TARGET ${DOLPHINQT2_BINARY} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake
|
COMMAND echo "Fixing up application bundle: ${BUNDLE_PATH}"
|
||||||
|
COMMAND echo ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py $<TARGET_FILE_DIR:${DOLPHINQT2_BINARY}>/../..
|
||||||
)
|
)
|
||||||
else()
|
|
||||||
add_custom_command(OUTPUT ${BUNDLE_PATH}/Contents/Resources/Sys
|
# Copy resources in the bundle
|
||||||
COMMAND ln -nfs ${CMAKE_SOURCE_DIR}/Data/Sys ${BUNDLE_PATH}/Contents/Resources/Sys
|
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
|
||||||
VERBATIM
|
foreach(res ${resources})
|
||||||
)
|
target_sources(${DOLPHINQT2_BINARY} PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
|
||||||
add_custom_target(CopyDataIntoBundleQt ALL
|
get_filename_component(resdir "${res}" DIRECTORY)
|
||||||
DEPENDS ${BUNDLE_PATH}/Contents/Resources/Sys
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
|
||||||
)
|
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
|
||||||
endif()
|
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
|
||||||
|
endforeach()
|
||||||
else()
|
else()
|
||||||
install(TARGETS ${DOLPHINQT2_BINARY} RUNTIME DESTINATION ${bindir})
|
install(TARGETS ${DOLPHINQT2_BINARY} RUNTIME DESTINATION ${bindir})
|
||||||
endif()
|
endif()
|
||||||
|
@ -153,7 +153,6 @@ if(wxWidgets_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
include(BundleUtilities)
|
|
||||||
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app)
|
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app)
|
||||||
|
|
||||||
# Ask for an application bundle.
|
# Ask for an application bundle.
|
||||||
@ -162,48 +161,25 @@ if(wxWidgets_FOUND)
|
|||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
||||||
)
|
)
|
||||||
|
|
||||||
# get rid of any old copies
|
# Copy resources in the bundle
|
||||||
file (REMOVE_RECURSE ${BUNDLE_PATH}/Contents/Resources/Sys)
|
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
|
||||||
if(NOT SKIP_POSTPROCESS_BUNDLE)
|
foreach(res ${resources})
|
||||||
# Fix up the bundle after it is finished.
|
target_sources(${DOLPHIN_EXE} PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
|
||||||
# There does not seem to be an easy way to run CMake commands post-build,
|
get_filename_component(resdir "${res}" DIRECTORY)
|
||||||
# so we invoke CMake again on a generated script.
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake "
|
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
|
||||||
include(BundleUtilities)
|
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
|
||||||
message(\"Fixing up application bundle: ${BUNDLE_PATH}\")
|
endforeach()
|
||||||
message(\"(Note: This is only necessary to produce a redistributable binary.\")
|
|
||||||
message(\"To skip, pass -DSKIP_POSTPROCESS_BUNDLE=1 to cmake.)\")
|
|
||||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py \"${BUNDLE_PATH}\"
|
|
||||||
RESULT_VARIABLE retcode
|
|
||||||
)
|
|
||||||
if(NOT \${retcode} EQUAL 0)
|
|
||||||
message(FATAL_ERROR \"Error when postprocessing bundle (return code: \${retcode}).\")
|
|
||||||
endif()
|
|
||||||
file(INSTALL \"${CMAKE_SOURCE_DIR}/Data/Sys\"
|
|
||||||
DESTINATION \"${BUNDLE_PATH}/Contents/Resources\"
|
|
||||||
)
|
|
||||||
")
|
|
||||||
add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_custom_command(OUTPUT ${BUNDLE_PATH}/Contents/Resources/Sys
|
|
||||||
COMMAND ln -nfs ${CMAKE_SOURCE_DIR}/Data/Sys ${BUNDLE_PATH}/Contents/Resources/Sys
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
add_custom_target(CopyDataIntoBundleWx ALL
|
|
||||||
DEPENDS ${BUNDLE_PATH}/Contents/Resources/Sys
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# 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 echo ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py $<TARGET_FILE_DIR:${DOLPHIN_EXE}>/../..
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Install bundle into systemwide /Applications directory.
|
# Install bundle into systemwide /Applications directory.
|
||||||
install(DIRECTORY ${BUNDLE_PATH} DESTINATION /Applications
|
install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications)
|
||||||
USE_SOURCE_PERMISSIONS
|
|
||||||
)
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set_target_properties(${DOLPHIN_EXE} PROPERTIES
|
set_target_properties(${DOLPHIN_EXE} PROPERTIES
|
||||||
WIN32_EXECUTABLE ON
|
WIN32_EXECUTABLE ON
|
||||||
|
Loading…
x
Reference in New Issue
Block a user