mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-06 06:45:05 +01:00
Improve post steps on macOS
This commit is contained in:
parent
79d7503704
commit
ac7ee4f13e
@ -342,46 +342,40 @@ if (APPLE)
|
|||||||
|
|
||||||
# Copy required frameworks to bundle
|
# Copy required frameworks to bundle
|
||||||
target_link_libraries(Zelda64Recompiled PRIVATE ${MOLTENVK_PATH} ${VULKAN_LOADER_PATH})
|
target_link_libraries(Zelda64Recompiled PRIVATE ${MOLTENVK_PATH} ${VULKAN_LOADER_PATH})
|
||||||
|
|
||||||
|
# Post-build steps for macOS bundle
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
||||||
|
# 1. Copy and fix frameworks first
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/.github/macos/fixup_bundle.cmake
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/.github/macos/fixup_bundle.cmake
|
||||||
)
|
|
||||||
|
|
||||||
# Copy assets folder to the MacOS folder of the app bundle
|
# 2. Copy all resources
|
||||||
set(TEMP_ASSETS_DIR "${CMAKE_BINARY_DIR}/temp_assets")
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets ${CMAKE_BINARY_DIR}/temp_assets
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/temp_assets/scss
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets ${TEMP_ASSETS_DIR}
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/temp_assets $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/assets
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEMP_ASSETS_DIR}/scss
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/temp_assets
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEMP_ASSETS_DIR} $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/assets
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEMP_ASSETS_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Copy ICD files to macOS Resources folder
|
# 3. Copy Vulkan ICD files
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/vulkan/icd.d
|
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/vulkan/icd.d
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/.github/macOS/MoltenVK_icd.json $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/vulkan/icd.d/
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/.github/macOS/MoltenVK_icd.json $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/vulkan/icd.d/
|
||||||
)
|
|
||||||
|
|
||||||
# Copy controller db file to macOS Resources folder
|
# 4. Copy controller database
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/
|
||||||
)
|
|
||||||
|
|
||||||
# Use install_name_tool to set the RPATH after the build
|
# 5. Set RPATH
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
|
||||||
COMMAND install_name_tool -add_rpath "@executable_path/../Frameworks/" $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/MacOS/Zelda64Recompiled
|
COMMAND install_name_tool -add_rpath "@executable_path/../Frameworks/" $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/MacOS/Zelda64Recompiled
|
||||||
)
|
|
||||||
|
|
||||||
# Apply JIT compilation workaround
|
# 6. Apply JIT workaround
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "Applying JIT compilation workaround"
|
COMMAND ${CMAKE_COMMAND} -E echo "Applying JIT compilation workaround"
|
||||||
COMMAND /bin/bash -c "printf '\\x07' | dd of=$<TARGET_FILE:Zelda64Recompiled> bs=1 seek=160 count=1 conv=notrunc"
|
COMMAND /bin/bash -c "printf '\\x07' | dd of=$<TARGET_FILE:Zelda64Recompiled> bs=1 seek=160 count=1 conv=notrunc"
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
|
|
||||||
# Code sign the app bundle with ad-hoc identity
|
# 7. Sign frameworks first
|
||||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
COMMAND codesign --force --sign - $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Frameworks/*
|
||||||
COMMAND codesign --deep --force --sign - $<TARGET_BUNDLE_DIR:Zelda64Recompiled>
|
|
||||||
COMMENT "Code signing the app bundle with ad-hoc identity"
|
# 8. Finally sign the whole bundle with runtime option
|
||||||
|
COMMAND codesign --deep --force --sign - --options runtime $<TARGET_BUNDLE_DIR:Zelda64Recompiled>
|
||||||
|
|
||||||
|
COMMENT "Performing post-build steps for macOS bundle"
|
||||||
|
VERBATIM
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -428,7 +422,7 @@ endif()
|
|||||||
target_link_libraries(Zelda64Recompiled PRIVATE
|
target_link_libraries(Zelda64Recompiled PRIVATE
|
||||||
PatchesLib
|
PatchesLib
|
||||||
RecompiledFuncs
|
RecompiledFuncs
|
||||||
SDL2
|
SDL2::SDL2
|
||||||
librecomp
|
librecomp
|
||||||
ultramodern
|
ultramodern
|
||||||
rt64
|
rt64
|
||||||
|
Loading…
Reference in New Issue
Block a user