Specify an NSPrincipalClass in Info.plist to enable Retina display support

The default Info.plist template provided by CMake doesn't have this key, and
CMake only has minimal support for settingstypically found in this file.
In order to specify NSPrincipalClass, we need to provide the whole Info.plist instead.

Info.plist is also specified as a dependancy to the application so that it will
appear in the project explorer, and changes to this file will trigger a rebuild.
This commit is contained in:
Matt Lamont 2020-04-05 17:40:58 +12:00
parent 0264af9b73
commit 4e46567438
2 changed files with 38 additions and 5 deletions

View file

@ -25,7 +25,7 @@ set(HEADERS config.h imagewriter.h networkaccessmanagerfactory.h nan.h drivelist
# Add 3rd-party dependencies # Add 3rd-party dependencies
if (APPLE) if (APPLE)
set_source_files_properties("icons/rpi-imager.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_source_files_properties("icons/rpi-imager.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(DEPENDENCIES mac/macfile.cpp mac/macfile.h dependencies/mountutils/src/darwin/functions.cpp set(DEPENDENCIES mac/macfile.cpp mac/macfile.h mac/Info.plist dependencies/mountutils/src/darwin/functions.cpp
dependencies/drivelist/src/darwin/list.mm dependencies/drivelist/src/darwin/REDiskList.m icons/rpi-imager.icns) dependencies/drivelist/src/darwin/list.mm dependencies/drivelist/src/darwin/REDiskList.m icons/rpi-imager.icns)
enable_language(OBJC C) enable_language(OBJC C)
elseif (UNIX) elseif (UNIX)
@ -192,10 +192,7 @@ elseif(APPLE)
#find_package(Qt5 COMPONENTS Svg) #find_package(Qt5 COMPONENTS Svg)
#set(EXTRALIBS ${CoreFoundation} ${DiskArbitration} ${Security} ${Cocoa} Qt5::Svg) #set(EXTRALIBS ${CoreFoundation} ${DiskArbitration} ${Security} ${Cocoa} Qt5::Svg)
set(EXTRALIBS ${CoreFoundation} ${DiskArbitration} ${Security} ${Cocoa}) set(EXTRALIBS ${CoreFoundation} ${DiskArbitration} ${Security} ${Cocoa})
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE YES set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE YES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist)
MACOSX_BUNDLE_BUNDLE_NAME "Raspberry Pi Imager"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.raspberrypi.imagingutility"
MACOSX_BUNDLE_ICON_FILE "rpi-imager.icns")
find_program(MACDEPLOYQT "macdeployqt" PATHS "${Qt5_DIR}/../../../bin") find_program(MACDEPLOYQT "macdeployqt" PATHS "${Qt5_DIR}/../../../bin")
if (NOT MACDEPLOYQT) if (NOT MACDEPLOYQT)

36
mac/Info.plist Normal file
View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>rpi-imager</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>rpi-imager.icns</string>
<key>CFBundleIdentifier</key>
<string>org.raspberrypi.imagingutility</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>Raspberry Pi Imager</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>