Skip to content

Commit

Permalink
Merge pull request #955 from qw-ctf/macos-build-stuff
Browse files Browse the repository at this point in the history
Minor macOS build cleanups.
  • Loading branch information
dsvensson authored Oct 21, 2024
2 parents 95c43ff + c8c3b63 commit 7064430
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
lipo -create -output ezQuake.app/Contents/MacOS/ezQuake \
artifacts/x64/ezQuake.app/Contents/MacOS/ezQuake \
artifacts/arm64/ezQuake.app/Contents/MacOS/ezQuake
codesign --force --sign - --entitlements misc/install/ezquake.entitlements.plist --options runtime --timestamp ezQuake.app
codesign --force --sign - --entitlements dist/macOS/ezquake.entitlements.plist --options runtime --timestamp ezQuake.app
zip -r ezQuake.zip ezQuake.app
- name: Delete macOS arch specific builds
Expand Down
49 changes: 8 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ get_target_property(version_build git_version REVISION)
get_target_property(version_commit git_version COMMIT)

# macOS icon
set(macos_icon "${PROJECT_SOURCE_DIR}/misc/install/ezquake.icns")
set(macos_icon "${PROJECT_SOURCE_DIR}/dist/macOS/ezquake.icns")
set_source_files_properties(${macos_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

# Windows icon, and exe metadata
Expand Down Expand Up @@ -906,50 +906,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
XCODE_ATTRIBUTE_INFOPLIST_KEY_CFBundleDisplayName "ezQuake"
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.action-games"
XCODE_ATTRIBUTE_INFOPLIST_KEY_NSHumanReadableCopyright "GNU General Public License, version 2"
MACOSX_BUNDLE_ICON_FILE "ezquake"
XCODE_ATTRIBUTE_INFOPLIST_FILE "${PROJECT_SOURCE_DIR}/dist/macOS/MacOSXBundleInfo.plist.in"
)

if(ENABLE_SANDBOX)
set_target_properties(ezquake PROPERTIES
XCODE_ATTRIBUTE_ENABLE_APP_SANDBOX YES
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS YES
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "misc/install/ezquake.entitlements.plist"
XCODE_ATTRIBUTE_ENABLE_APP_SANDBOX YES
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=Debug] YES
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=RelWithDebInfo] YES
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=Release] NO
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "dist/macOS/ezquake.entitlements.plist"
)
endif()

add_custom_command(
TARGET ezquake POST_BUILD
COMMAND /usr/libexec/PlistBuddy
-c "Add :NSHighResolutionCapable bool YES"
"$<TARGET_FILE_DIR:ezquake>/../Info.plist"
)

# qw:// protocol support
add_custom_command(
TARGET ezquake POST_BUILD
COMMAND /usr/libexec/PlistBuddy
-c "Add :CFBundleURLTypes array"
-c "Add :CFBundleURLTypes:0 dict"
-c "Add :CFBundleURLTypes:0:CFBundleURLName string QW"
-c "Add :CFBundleURLTypes:0:CFBundleURLSchemes array"
-c "Add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string qw"
"$<TARGET_FILE_DIR:ezquake>/../Info.plist"
)

# .mvd/.qwd/.dem file type support
add_custom_command(
TARGET ezquake POST_BUILD
COMMAND /usr/libexec/PlistBuddy
-c "Add :CFBundleDocumentTypes array"
-c "Add :CFBundleDocumentTypes:0 dict"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeName string \"Quake demo\""
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeRole string Viewer"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeIconFile string ezquake.icns"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions array"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions: string mvd"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions: string qwd"
-c "Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions: string dem"
"$<TARGET_FILE_DIR:ezquake>/../Info.plist"
)
endif()
38 changes: 38 additions & 0 deletions dist/macOS/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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>ezquake.icns</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mvd</string>
<string>qwd</string>
<string>dem</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ezquake.icns</string>
<key>CFBundleTypeName</key>
<string>Quake demo</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>QW</string>
<key>CFBundleURLSchemes</key>
<array>
<string>qw</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
File renamed without changes.
File renamed without changes.

0 comments on commit 7064430

Please sign in to comment.