-
Notifications
You must be signed in to change notification settings - Fork 19
Add support for macOS #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
59b0bfe
Update .gitignore for macOS
MichaelJBerk 0998949
Add support for macOS
MichaelJBerk 8e71a5e
Hide OpenLoco on macOS
MichaelJBerk 97e48b0
Added CI action to build for macOS
MichaelJBerk 6871c61
Update .github/workflows/ci.yml
MichaelJBerk 31f93e9
Cannot test macOS build before building it
Gymnasiast 0c89984
Codesign OpenRCT2.app when packaging it
MichaelJBerk 4e9e870
Replace logo file
Gymnasiast File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
#!/bin/bash | ||
#Modified from Avalonia's documentation: https://docs.avaloniaui.net/docs/0.10.x/distribution-publishing/macos | ||
|
||
set -e | ||
trap 'echo "Error packaging app"; exit 1' ERR | ||
|
||
PROJECT_NAME="openlauncher" | ||
OUTPUT_DIR="./src/openlauncher/bin/Release/net8.0" | ||
FINAL_OUTPUT_DIR="./src/openlauncher/bin/Release/net8.0/macos-universal" | ||
|
||
# Function to build for a specific architecture | ||
build_for_arch() { | ||
local arch=$1 | ||
echo "Building for $arch..." | ||
dotnet publish -r osx-$arch -c Release | ||
} | ||
|
||
# Build for both architectures | ||
build_for_arch "x64" | ||
build_for_arch "arm64" | ||
|
||
# Create the final output directory | ||
mkdir -p "$FINAL_OUTPUT_DIR" | ||
|
||
ARM_OUTPUT="$OUTPUT_DIR/osx-arm64/publish" | ||
X64_OUTPUT="$OUTPUT_DIR/osx-x64/publish" | ||
|
||
#Copy libraries into final output dir | ||
for FILE in "$ARM_OUTPUT"/*; do | ||
BASENAME=$(basename "$FILE") | ||
if [ -f "$FILE" ] && [[ "$BASENAME" != "openlauncher" ]]; then | ||
cp "$FILE" "$FINAL_OUTPUT_DIR"/. | ||
fi | ||
done | ||
|
||
# Create universal binary | ||
echo "Creating universal binary..." | ||
lipo -create \ | ||
"$OUTPUT_DIR/osx-x64/publish/$PROJECT_NAME" \ | ||
"$OUTPUT_DIR/osx-arm64/publish/$PROJECT_NAME" \ | ||
-output "$FINAL_OUTPUT_DIR/$PROJECT_NAME" |
This file contains hidden or 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,26 @@ | ||
<?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>CFBundleIconFile</key> | ||
<string>AppIcon.icns</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>io.openrct2.openlauncher</string> | ||
<key>CFBundleName</key> | ||
<string>OpenLauncher</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0.0</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.15</string> | ||
<key>CFBundleExecutable</key> | ||
<string>openlauncher</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>APP_VERSION_NUMBER</string> | ||
<key>NSHighResolutionCapable</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains hidden or 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,48 @@ | ||
#!/bin/bash | ||
#Modified from Avalonia's documentation: https://docs.avaloniaui.net/docs/0.10.x/distribution-publishing/macos | ||
set -e | ||
trap 'echo "Error packaging app"; exit 1' ERR | ||
|
||
APP_NAME="./src/openlauncher/bin/Release/net8.0/macos-universal/OpenLauncher.app" | ||
PUBLISH_OUTPUT_DIRECTORY="./src/openlauncher/bin/Release/net8.0/macos-universal/." | ||
Gymnasiast marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
INFO_PLIST="./info.plist" | ||
|
||
ICON_FILE="./src/openlauncher/resources/logo-mac.icns" | ||
|
||
if [ -d "$APP_NAME" ] | ||
then | ||
rm -rf "$APP_NAME" | ||
fi | ||
|
||
echo "Creating OpenLauncher.app" | ||
|
||
rm -r -f "$APP_NAME" | ||
mkdir "$APP_NAME" | ||
|
||
mkdir "$APP_NAME/Contents" | ||
mkdir "$APP_NAME/Contents/MacOS" | ||
mkdir "$APP_NAME/Contents/Resources" | ||
|
||
cp "$INFO_PLIST" "$APP_NAME/Contents/Info.plist" | ||
cp "$ICON_FILE" "$APP_NAME/Contents/Resources/AppIcon.icns" | ||
for FILE in "$PUBLISH_OUTPUT_DIRECTORY"/*; do | ||
if [ -f "$FILE" ]; then | ||
cp -a "$FILE" "$APP_NAME/Contents/MacOS/." | ||
fi | ||
done | ||
|
||
#Get version number from csproj | ||
VERSION_NUMBER=$(sed -n 's/.*<AssemblyVersion>\(.*\)<\/AssemblyVersion>.*/\1/p' ./src/openlauncher/openlauncher.csproj) | ||
#Replace placeholder version with real version number | ||
sed -i -e "s/APP_VERSION_NUMBER/$VERSION_NUMBER/" "$APP_NAME/Contents/Info.plist" | ||
#For whatever reason, sed on macOS creates a backup file when replacing text, so we need to remove it | ||
rm "$APP_NAME/Contents/Info.plist-e" | ||
|
||
codesign --sign - --force --deep "./src/openlauncher/bin/Release/net8.0/macos-universal/OpenLauncher.app" | ||
|
||
mkdir "$PUBLISH_OUTPUT_DIRECTORY/publish" | ||
|
||
echo "Zipping OpenLauncher.app..." | ||
|
||
ditto -c -k --keepParent "./src/openlauncher/bin/Release/net8.0/macos-universal/OpenLauncher.app" "./src/openlauncher/bin/Release/net8.0/macos-universal/publish/OpenLauncher.zip" |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.