Create bundle for macOS

This commit is contained in:
Joshua Peisach 2025-06-14 12:58:45 -04:00
parent 2733ffcf69
commit 6bb2528c6e
No known key found for this signature in database
GPG Key ID: 41C3D4189AFEDB5A
3 changed files with 109 additions and 1 deletions

View File

@ -463,7 +463,7 @@ if (NOT ISLE_MINIWIN)
endif()
if (ISLE_BUILD_APP)
add_executable(isle WIN32
add_executable(isle WIN32 MACOSX_BUNDLE
ISLE/res/isle.rc
ISLE/isleapp.cpp
)
@ -627,6 +627,7 @@ endif()
install(TARGETS isle ${install_extra_targets}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
BUNDLE DESTINATION "."
)
if(EMSCRIPTEN)
install(FILES "$<TARGET_FILE_DIR:isle>/isle.js" "$<TARGET_FILE_DIR:isle>/isle.wasm"
@ -638,6 +639,33 @@ set(CPACK_PACKAGE_DIRECTORY "dist")
set(CPACK_PACKAGE_FILE_NAME "isle-${PROJECT_VERSION}-${ISLE_PACKAGE_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
if(MSVC)
set(CPACK_GENERATOR ZIP)
elseif(APPLE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER com.github.isledecomp.isle-portable)
set(MACOSX_BUNDLE_COPYRIGHT LGPLv3)
set(MACOSX_BUNDLE_BUNDLE_NAME isle)
set(MACOSX_BUNDLE_DISPLAY_NAME LEGO Island)
set(MACOSX_BUNDLE_INFO_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
# TODO: darwin < 9
set(MACOSX_BUNDLE_REQUIRED_PLATFORM Carbon)
set(_icon_file AppIcon)
target_sources(isle PRIVATE "ISLE/apple/${_icon_file}.icns")
set_source_files_properties("./ISLE/apple/${_icon_file}.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(isle PROPERTIES MACOSX_BUNDLE_ICON_FILE "${_icon_file}.icns")
set_target_properties(isle PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ISLE/apple/Info.plist")
install(TARGETS isle DESTINATION ./)
install(CODE "
include(BundleUtilities)
fixup_bundle(${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app \"\" \"\")
"
COMPONENT Runtime)
set(CPACK_GENERATOR DragNDrop)
else()
set(CPACK_GENERATOR TGZ)
endif()

BIN
ISLE/apple/AppIcon.icns Normal file

Binary file not shown.

80
ISLE/apple/Info.plist Normal file
View File

@ -0,0 +1,80 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${MACOSX_BUNDLE_DISPLAY_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequires${MACOSX_BUNDLE_REQUIRED_PLATFORM}</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>resource</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
</dict>
</plist>