-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2739 from MRtrix3/cmake_app_bundles
Support for macOS app bundles for GUI apps
- Loading branch information
Showing
9 changed files
with
234 additions
and
2 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 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function(set_bundle_properties executable_name) | ||
set(icon_files ${CMAKE_CURRENT_SOURCE_DIR}/../icons/macos/${executable_name}.icns) | ||
if(${executable_name} STREQUAL "mrview") | ||
list(APPEND icon_files ${CMAKE_CURRENT_SOURCE_DIR}/../icons/macos/mrview_doc.icns) | ||
endif() | ||
|
||
string(TIMESTAMP CURRENT_YEAR "%Y") | ||
set(COPYRIGHT_YEAR "2008-${CURRENT_YEAR}" CACHE STRING "Copyright year") | ||
|
||
target_sources(${executable_name} PRIVATE ${icon_files}) | ||
set_target_properties(${executable_name} PROPERTIES | ||
MACOSX_BUNDLE TRUE | ||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../packaging/macos/bundle/${executable_name}.plist.in" | ||
RESOURCE "${icon_files}" | ||
INSTALL_RPATH "@executable_path/../../../../lib" | ||
) | ||
endfunction() | ||
|
||
function(install_bundle_wrapper_scripts executable_name) | ||
set(wrapper_script ${CMAKE_CURRENT_SOURCE_DIR}/../packaging/macos/bundle/wrapper_launcher.sh.in) | ||
configure_file(${wrapper_script} ${PROJECT_BINARY_DIR}/bin/${executable_name} | ||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE | ||
@ONLY | ||
) | ||
|
||
install(FILES ${PROJECT_BINARY_DIR}/bin/${executable_name} | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
RENAME "${executable_name}" | ||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||
|
||
endfunction() |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> | ||
<key>CFBundleDevelopmentRegion</key> <string>en</string> | ||
<key>CFBundleName</key> <string>MRView</string> | ||
<key>CFBundleDisplayName</key> <string>MRView</string> | ||
<key>CFBundleExecutable</key> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}.icns</string> | ||
<key>CFBundleIdentifier</key> <string>org.mrtrix.${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> | ||
<key>CFBundlePackageType</key> <string>APPL</string> | ||
<key>CFBundleShortVersionString</key> <string>${PROJECT_VERSION}</string> | ||
<key>CFBundleVersion</key> <string>${PROJECT_VERSION}</string> | ||
<key>NSHumanReadableCopyright</key> <string>Copyright (c) ${COPYRIGHT_YEAR} the MRtrix3 contributors</string> | ||
<key>LSMinimumSystemVersion</key> <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string> | ||
<key>LSBackgroundOnly</key> <string>0</string> | ||
<key>NSHighResolutionCapable</key> <true/> | ||
|
||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleURLName</key> | ||
<string>MRView file</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> | ||
</array> | ||
</dict> | ||
</array> | ||
|
||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>gz</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MRtrix of NIfTI image (compressed)</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mif</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MRtrix image</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mih</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MRtrix image header</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mif.gz</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MRtrix image (compressed)</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>nii</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>NIfTI image</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>nii.gz</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>NIfTI image (compressed)</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mgh</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MGH image</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mgz</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>MGH image (compressed)</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>img</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>Analyze image</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}_doc.icns</string> | ||
</dict> | ||
|
||
</array> | ||
</dict> | ||
</plist> |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> | ||
<key>CFBundleDevelopmentRegion</key> <string>en</string> | ||
<key>CFBundleName</key> <string>SHView</string> | ||
<key>CFBundleDisplayName</key> <string>SHView</string> | ||
<key>CFBundleExecutable</key> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}.icns</string> | ||
<key>CFBundleIdentifier</key> <string>org.mrtrix.${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> | ||
<key>CFBundlePackageType</key> <string>APPL</string> | ||
<key>CFBundleShortVersionString</key> <string>${PROJECT_VERSION}</string> | ||
<key>CFBundleVersion</key> <string>${PROJECT_VERSION}</string> | ||
<key>NSHumanReadableCopyright</key> <string>Copyright (c) ${COPYRIGHT_YEAR} the MRtrix3 contributors</string> | ||
<key>LSMinimumSystemVersion</key> <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string> | ||
<key>LSBackgroundOnly</key> <string>0</string> | ||
<key>NSHighResolutionCapable</key> <true/> | ||
</dict> | ||
</plist> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is a wrapper around the actual MacOSX bundle executable. | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
real_path=${DIR}/@executable_name@.app/Contents/MacOS/@executable_name@ | ||
if [ -x "${real_path}" ]; then | ||
exec "${real_path}" "$@" | ||
else | ||
echo "Could not find executable at ${real_path}" | ||
exit 1 | ||
fi |