mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
add macOS .app bundle and dmg packaging
This commit is contained in:
parent
698fd32071
commit
f241e4c355
9 changed files with 180 additions and 16 deletions
72
dev/cmake/BuildMacBundle.cmake
Normal file
72
dev/cmake/BuildMacBundle.cmake
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# VoxelCore.app packed to VoxelCore.dmg with cpack
|
||||
set(VC_BUNDLE_CONTENTS VoxelCore.app/Contents)
|
||||
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/constants.hpp VC_CONSTANTS)
|
||||
string(REGEX MATCH "ENGINE_VERSION_MAJOR = ([0-9]+)" _ "${VC_CONSTANTS}")
|
||||
set(VC_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "ENGINE_VERSION_MINOR = ([0-9]+)" _ "${VC_CONSTANTS}")
|
||||
set(VC_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
|
||||
if(VC_VERSION_PATCH STREQUAL "")
|
||||
set(VC_BUNDLE_VERSION ${VC_VERSION_MAJOR}.${VC_VERSION_MINOR}.0)
|
||||
else()
|
||||
set(VC_BUNDLE_VERSION
|
||||
${VC_VERSION_MAJOR}.${VC_VERSION_MINOR}.${VC_VERSION_PATCH})
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dev/macos/Info.plist.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY
|
||||
)
|
||||
|
||||
install(
|
||||
PROGRAMS $<TARGET_FILE:VoxelCore>
|
||||
DESTINATION ${VC_BUNDLE_CONTENTS}/MacOS
|
||||
RENAME VoxelCore-bin
|
||||
)
|
||||
install(
|
||||
PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/dev/macos/launcher.sh
|
||||
DESTINATION ${VC_BUNDLE_CONTENTS}/MacOS
|
||||
RENAME VoxelCore
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
|
||||
DESTINATION ${VC_BUNDLE_CONTENTS}
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/dev/macos/VoxelCore.icns
|
||||
DESTINATION ${VC_BUNDLE_CONTENTS}/Resources
|
||||
)
|
||||
install(
|
||||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res
|
||||
DESTINATION ${VC_BUNDLE_CONTENTS}/Resources
|
||||
)
|
||||
|
||||
|
||||
execute_process(
|
||||
COMMAND brew --prefix
|
||||
OUTPUT_VARIABLE VC_BREW_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "set(VC_LIB_DIRS \"${VC_BREW_PREFIX}/lib\")"
|
||||
)
|
||||
install(
|
||||
CODE [[
|
||||
include(BundleUtilities)
|
||||
set(app "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/VoxelCore.app")
|
||||
fixup_bundle("${app}" "${app}/Contents/MacOS/VoxelCore-bin"
|
||||
"${VC_LIB_DIRS}")
|
||||
execute_process(COMMAND codesign --force --deep --sign - "${app}"
|
||||
COMMAND_ERROR_IS_FATAL ANY)
|
||||
]])
|
||||
|
||||
set(CPACK_GENERATOR DragNDrop)
|
||||
set(CPACK_PACKAGE_NAME VoxelCore)
|
||||
set(CPACK_PACKAGE_VERSION ${VC_BUNDLE_VERSION})
|
||||
set(CPACK_PACKAGE_FILE_NAME VoxelCore)
|
||||
set(CPACK_DMG_VOLUME_NAME VoxelCore)
|
||||
set(CPACK_DMG_BACKGROUND_IMAGE ${CMAKE_CURRENT_SOURCE_DIR}/dev/macos/dmg-background.tiff)
|
||||
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/dev/macos/dmg-setup.applescript)
|
||||
include(CPack)
|
||||
28
dev/macos/Info.plist.in
Normal file
28
dev/macos/Info.plist.in
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?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>CFBundleName</key>
|
||||
<string>VoxelCore</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>VoxelCore</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.github.mihailris.voxelcore</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>VoxelCore</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>VoxelCore</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@VC_BUNDLE_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@VC_BUNDLE_VERSION@</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>VoxelCore uses the microphone for audio input when content requests it.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
dev/macos/VoxelCore.icns
Normal file
BIN
dev/macos/VoxelCore.icns
Normal file
Binary file not shown.
BIN
dev/macos/dmg-background.tiff
Normal file
BIN
dev/macos/dmg-background.tiff
Normal file
Binary file not shown.
36
dev/macos/dmg-setup.applescript
Normal file
36
dev/macos/dmg-setup.applescript
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
on run argv
|
||||
set volumeName to item 1 of argv
|
||||
tell application "Finder"
|
||||
set targetDisk to missing value
|
||||
set candidates to every disk whose name is volumeName
|
||||
repeat with i from 1 to count of candidates
|
||||
set d to item i of candidates
|
||||
set diskPath to POSIX path of (d as alias)
|
||||
try
|
||||
do shell script "test -w " & quoted form of diskPath
|
||||
set targetDisk to d
|
||||
exit repeat
|
||||
end try
|
||||
end repeat
|
||||
if targetDisk is missing value then error "writable disk not found: " & volumeName
|
||||
|
||||
tell targetDisk
|
||||
open
|
||||
set win to container window
|
||||
set current view of win to icon view
|
||||
set toolbar visible of win to false
|
||||
set statusbar visible of win to false
|
||||
set the bounds of win to {200, 120, 800, 548}
|
||||
set opts to the icon view options of win
|
||||
set arrangement of opts to not arranged
|
||||
set icon size of opts to 128
|
||||
set text size of opts to 13
|
||||
set background picture of opts to file ".background:background.tiff"
|
||||
set position of item "VoxelCore.app" of win to {180, 200}
|
||||
set position of item "Applications" of win to {420, 200}
|
||||
update without registering applications
|
||||
delay 2
|
||||
close
|
||||
end tell
|
||||
end tell
|
||||
end run
|
||||
7
dev/macos/launcher.sh
Executable file
7
dev/macos/launcher.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
USER_DIR="$HOME/Library/Application Support/VoxelCore"
|
||||
|
||||
mkdir -p "$USER_DIR"
|
||||
exec "$DIR/VoxelCore-bin" --res "$DIR/../Resources/res" --dir "$USER_DIR" "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue