-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
85 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,86 @@ | ||
# Variables must be prefixed with "CPACK_" to be visible here | ||
# See also CpackOptions.cmake.in | ||
set(APP "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/${CPACK_PROJECT_NAME_UCASE}.app") | ||
execute_process(COMMAND convert | ||
"${CPACK_CURRENT_SOURCE_DIR}/*.png" | ||
"${CPACK_CURRENT_BINARY_DIR}/background.tiff" | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
|
||
# Copy missing files | ||
file(COPY "${CPACK_CURRENT_SOURCE_DIR}/project.icns" DESTINATION "${APP}/Contents/Resources") | ||
|
||
# Updates appdmg.json with CPACK_TEMPORARY_INSTALL_DIRECTORY | ||
# - .DS_Store can be recreated using appdmg appdmg.json lmms.dmg | ||
# - Find new .DS_Store from the root of the DMG file | ||
# - cp /Volumes/lmms-x.x.x/.DS_Store ../cmake/apple/DS_Store | ||
configure_file("${CPACK_CURRENT_BINARY_DIR}/_appdmg.json.in" "${CPACK_CURRENT_BINARY_DIR}/appdmg.json") | ||
file(REMOVE "${CPACK_CURRENT_BINARY_DIR}/_appdmg.json.in") | ||
|
||
# Create bundle structure | ||
file(MAKE_DIRECTORY "${APP}/Contents/MacOS") | ||
file(MAKE_DIRECTORY "${APP}/Contents/Frameworks") | ||
file(MAKE_DIRECTORY "${APP}/Contents/Resources") | ||
|
||
# Make all libraries writable for macdeployqt | ||
file(CHMOD_RECURSE "${APP}/Contents" PERMISSIONS | ||
OWNER_EXECUTE OWNER_WRITE OWNER_READ | ||
GROUP_EXECUTE GROUP_WRITE GROUP_READ | ||
WORLD_READ) | ||
|
||
# Fix layout | ||
file(RENAME "${APP}/Contents/Resources/lib" "${APP}/Contents/lib") | ||
file(RENAME "${APP}/Contents/Resources/share" "${APP}/Contents/share") | ||
file(RENAME "${APP}/Contents/Resources/bin" "${APP}/Contents/bin") | ||
|
||
# Move binaries into Contents/MacOS | ||
file(RENAME "${APP}/Contents/bin/lmms" "${APP}/Contents/MacOS/lmms") | ||
file(RENAME "${APP}/Contents/lib/lmms/RemoteZynAddSubFx" "${APP}/Contents/MacOS/RemoteZynAddSubFx") | ||
file(REMOVE_RECURSE "${APP}/Contents/bin") | ||
|
||
# Replace @rpath with @loader_path for Carla | ||
execute_process(COMMAND install_name_tool -change | ||
"@rpath/libcarlabase.dylib" | ||
"@loader_path/libcarlabase.dylib" | ||
"${APP}/Contents/lib/lmms/libcarlapatchbay.so" | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
execute_process(COMMAND install_name_tool -change | ||
"@rpath/libcarlabase.dylib" | ||
"@loader_path/libcarlabase.dylib" | ||
"${APP}/Contents/lib/lmms/libcarlarack.so" | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
|
||
# Build list of executables to inform macdeployqt about | ||
# e.g. -executable=foo.dylib -executable=bar.dylib | ||
file(GLOB LIBS "${APP}/Contents/lib/lmms/*.so") | ||
file(GLOB LADSPA "${APP}/Contents/lib/lmms/ladspa/*.so") | ||
list(APPEND LIBS "${APP}/Contents/MacOS/RemoteZynAddSubFx") | ||
list(APPEND LIBS ${LADSPA}) | ||
list(SORT LIBS) | ||
|
||
# Construct macdeployqt parameters | ||
foreach(_LIB IN LISTS LIBS) | ||
list(APPEND EXECUTABLES "-executable=${_LIB}") | ||
endforeach() | ||
|
||
# Call macdeployqt | ||
get_filename_component(QTBIN "${CPACK_QMAKE_EXECUTABLE}" DIRECTORY) | ||
message(STATUS "Calling ${QTBIN}/macdeployqt ${APP} [... executables]") | ||
execute_process(COMMAND "${QTBIN}/macdeployqt" "${APP}" ${EXECUTABLES} COMMAND_ERROR_IS_FATAL ANY) | ||
|
||
# Remove dummy carla libs, relink to a sane location (e.g. /Applications/Carla.app/...) | ||
# (must be done after calling macdeployqt) | ||
file(GLOB CARLALIBS "${APP}/Contents/lib/lmms/libcarla*") | ||
foreach(_CARLALIB IN LISTS CARLALIBS) | ||
foreach(_LIB "${CPACK_CARLA_LIBRARIES}") | ||
set(_OLDPATH "../../Frameworks/lib${_LIB}.dylib") | ||
set(_NEWPATH "Carla.app/Contents/MacOS/lib${_LIB}.dylib") | ||
execute_process(COMMAND install_name_tool -change | ||
"@loader_path/${_OLDPATH}" | ||
"@executable_path/../../../${_NEWPATH}" | ||
"${_CARLALIB}" | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
file(REMOVE "${APP}/Contents/Frameworks/lib${_LIB}.dylib") | ||
endforeach() | ||
endforeach() | ||
|
||
# Call ad-hoc codesign manually (CMake offers this as well) | ||
execute_process(COMMAND codesign --force --deep --sign - "${APP}" COMMAND_ERROR_IS_FATAL ANY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters