Skip to content

Commit

Permalink
Try copying plugin libraries to the correct location
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Feb 15, 2024
1 parent 2012fc8 commit bf6a8a6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmake/modules/PostprocessBundle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@ if(CMAKE_GENERATOR)
return()
endif()

# IMHEX PATCH BEGIN
# The function defined above doesn't keep in mind that if we are cross-compiling to MacOS, APPLE must be 1,
# so we force it here (where else would this script be run anyway ? This seems to be MacOS-specific code)
SET(APPLE 1)
# IMHEX PATCHE END

get_filename_component(BUNDLE_PATH "${BUNDLE_PATH}" ABSOLUTE)
message(STATUS "Fixing up application bundle: ${BUNDLE_PATH}")


# Make sure to fix up any included ImHex plugin.
file(GLOB_RECURSE plugins "${BUNDLE_PATH}/Contents/MacOS/plugins/*.hexplug")
file(GLOB_RECURSE plugin_libs "${BUNDLE_PATH}/Contents/MacOS/plugins/*.hexpluglib")
file(GLOB plugins "${BUNDLE_PATH}/Contents/MacOS/plugins/*.hexplug")


# BundleUtilities doesn't support DYLD_FALLBACK_LIBRARY_PATH behavior, which
Expand All @@ -56,7 +53,7 @@ message(STATUS "Fixing up application bundle: ${extra_dirs}")
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)

fixup_bundle("${BUNDLE_PATH}" "${plugins}" "${plugin_libs}" "${extra_dirs}")
fixup_bundle("${BUNDLE_PATH}" "${plugins}" "${extra_dirs}")

if (CODE_SIGN_CERTIFICATE_ID)
# Hack around Apple Silicon signing bugs by copying the real app, signing it and moving it back.
Expand All @@ -68,4 +65,10 @@ if (CODE_SIGN_CERTIFICATE_ID)
endif()

# Add a necessary rpath to the imhex binary
get_bundle_main_executable("${BUNDLE_PATH}" IMHEX_EXECUTABLE)
get_bundle_main_executable("${BUNDLE_PATH}" IMHEX_EXECUTABLE)

file(GLOB plugin_libs "${BUNDLE_PATH}/Contents/MacOS/*.hexpluglib")
foreach(plugin_lib ${plugin_libs})
get_filename_component(plugin_lib_name "${plugin_lib}" NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${plugin_lib}" "${BUNDLE_PATH}/Contents/MacOS/plugins/${plugin_lib_name}")
endforeach()

0 comments on commit bf6a8a6

Please sign in to comment.