Use Xcode for macOS builds (#275)

This commit is contained in:
Alexander Batalov 2023-05-01 07:10:04 +03:00 committed by GitHub
parent fcf8a87603
commit d6a74468da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 17 deletions

View File

@ -213,28 +213,34 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: build path: build
key: macos-cmake-v3 key: macos-cmake-v4
- name: Configure - name: Configure
run: | run: |
cmake \ cmake \
-B build \ -B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \ -G Xcode \
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY='' \
# EOL # EOL
- name: Build - name: Build
run: | run: |
cmake \ cmake \
--build build \ --build build \
--config RelWithDebInfo \
-j $(sysctl -n hw.physicalcpu) \ -j $(sysctl -n hw.physicalcpu) \
--target package \
# EOL # EOL
- name: Pack
run: |
cd build
cpack -C RelWithDebInfo
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: fallout2-ce-macos.dmg name: fallout2-ce-macos.dmg
path: build/fallout2-ce.dmg path: build/Fallout II Community Edition.dmg
retention-days: 7 retention-days: 7
windows: windows:

View File

@ -318,16 +318,30 @@ if(APPLE)
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.alexbatalov.fallout2-ce" XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.alexbatalov.fallout2-ce"
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2"
) )
set(MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE_NAME}")
set(MACOSX_BUNDLE_DISPLAY_NAME "Fallout 2")
else() else()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/macos/Info.plist") set(RESOURCES
target_sources(${EXECUTABLE_NAME} PUBLIC "os/macos/fallout2-ce.icns") "os/macos/fallout2-ce.icns"
set_source_files_properties("os/macos/fallout2-ce.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") )
target_sources(${EXECUTABLE_NAME} PUBLIC ${RESOURCES})
set_source_files_properties(${RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
OUTPUT_NAME "Fallout II Community Edition"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/macos/Info.plist"
XCODE_ATTRIBUTE_EXECUTABLE_NAME "${EXECUTABLE_NAME}"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.alexbatalov.fallout2-ce"
)
set(MACOSX_BUNDLE_ICON_FILE "fallout2-ce.icns") set(MACOSX_BUNDLE_ICON_FILE "fallout2-ce.icns")
set(MACOSX_BUNDLE_BUNDLE_NAME "Fallout II: Community Edition")
set(MACOSX_BUNDLE_DISPLAY_NAME "Fallout II")
endif() endif()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.alexbatalov.fallout2-ce") set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.alexbatalov.fallout2-ce")
set(MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE_NAME}")
set(MACOSX_BUNDLE_DISPLAY_NAME "Fallout 2")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.2.0") set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.2.0")
set(MACOSX_BUNDLE_BUNDLE_VERSION "1.2.0") set(MACOSX_BUNDLE_BUNDLE_VERSION "1.2.0")
endif() endif()
@ -360,22 +374,17 @@ if(APPLE)
set(CPACK_ARCHIVE_FILE_EXTENSION "ipa") set(CPACK_ARCHIVE_FILE_EXTENSION "ipa")
else() else()
install(TARGETS ${EXECUTABLE_NAME} DESTINATION .) install(TARGETS ${EXECUTABLE_NAME} DESTINATION .)
install(CODE "
include(BundleUtilities)
fixup_bundle(${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app \"\" \"\")
"
COMPONENT Runtime)
if (CPACK_BUNDLE_APPLE_CERT_APP) if (CPACK_BUNDLE_APPLE_CERT_APP)
install(CODE " install(CODE "
execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app) execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/Fallout II Community Edition.app)
" "
COMPONENT Runtime) COMPONENT Runtime)
endif() endif()
set(CPACK_GENERATOR "DragNDrop") set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON) set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
set(CPACK_PACKAGE_FILE_NAME "fallout2-ce") set(CPACK_PACKAGE_FILE_NAME "Fallout II Community Edition")
endif() endif()
include(CPack) include(CPack)

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>${MACOSX_BUNDLE_DISPLAY_NAME}</string> <string>${MACOSX_BUNDLE_DISPLAY_NAME}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@ -28,6 +28,8 @@
<string>${MACOSX_BUNDLE_COPYRIGHT}</string> <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<string>True</string> <string>True</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.role-playing-games</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.11</string> <string>10.11</string>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key> <key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>