-
Notifications
You must be signed in to change notification settings - Fork 55
Package OpenOMF for MacOS 26 #1428
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
base: master
Are you sure you want to change the base?
Changes from all commits
7a63f3b
1cfa169
a47e348
fe030a9
82a7c8f
1b8f4f4
558c303
b007e76
6c9f9c5
347a48d
62be030
61e319f
24dd353
8618908
19eb6f3
0220d38
02b1831
8403ef7
ac5d60b
ab0f230
0c63748
224f6d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,41 +10,93 @@ runs: | |
| shell: bash | ||
| run: | | ||
| brew update | ||
| brew install cunit sdl2_mixer confuse enet sdl2 libxmp libpng opusfile libepoxy miniupnpc libnatpmp | ||
| brew install confuse cunit enet libepoxy libnatpmp libxmp miniupnpc \ | ||
| opusfile sdl2-compat sdl2_mixer sdl3 | ||
| brew install coreutils create-dmg | ||
|
|
||
| - name: Generate Release | ||
| shell: bash | ||
| run: | | ||
| mkdir build-release && cd build-release | ||
| cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release/usr .. | ||
| cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=. .. | ||
| make -j $(getconf _NPROCESSORS_ONLN) | ||
| make -j $(getconf _NPROCESSORS_ONLN) install | ||
|
|
||
| - name: Verify openomf.app signature in ./openomf.app | ||
| shell: bash | ||
| run: | | ||
| cd build-release | ||
| cat ./openomf.app/Contents/Info.plist | ||
| codesign --display --verbose=4 ./openomf.app | ||
|
|
||
| - name: Get openomf assets | ||
| uses: ./.github/actions/assets | ||
|
|
||
| - name: Extract openomf assets | ||
| shell: bash | ||
| run: unzip -j openomf-assets.zip -d build-release/release/usr/share/games/openomf/resources | ||
| run: unzip -j openomf-assets.zip -d build-release/openomf.app/Contents/Resources | ||
|
|
||
| - name: Get openomf mods | ||
| uses: ./.github/actions/fetch_mods | ||
|
|
||
| - name: Extract openomf mods | ||
| shell: bash | ||
| run: | | ||
| mkdir -p build-release/release/usr/share/games/openomf/mods | ||
| unzip -o openomf-mods.zip -d build-release/release/usr/share/games/openomf/mods | ||
| mkdir -p build-release/openomf.app/Contents/mods | ||
| unzip -o openomf-mods.zip -d build-release/openomf.app/Contents/mods | ||
|
|
||
| - name: Create DMG package | ||
| shell: bash | ||
| run: | | ||
| create-dmg \ | ||
| --volname "OpenOMF" \ | ||
| --app-drop-link 300 150 \ | ||
| --hide-extension "OpenOMF.app" \ | ||
| "openomf_${{ env.OPENOMF_VERSION }}_macos26_arm.dmg" \ | ||
| "build-release/openomf.app/" | ||
|
|
||
| - name: Mount DMG and Install OpenOMF to /Applications | ||
| shell: bash | ||
| run: | | ||
| hdiutil attach "openomf_${{ env.OPENOMF_VERSION }}_macos26_arm.dmg" \ | ||
| -nobrowse -mountpoint ./mounted_openomf | ||
| cp -R ./mounted_openomf/openomf.app /Applications/ | ||
| hdiutil detach ./mounted_openomf | ||
|
|
||
| - name: Generate ZIP package | ||
| - name: Verify openomf.app signature in /Applications | ||
| shell: bash | ||
| run: | | ||
| cd build-release/release | ||
| zip -r ${GITHUB_WORKSPACE}/openomf_${{ env.OPENOMF_VERSION }}_macos14_arm.zip . | ||
| cat /Applications/openomf.app/Contents/Info.plist | ||
| codesign --display --verbose=4 /Applications/openomf.app | ||
|
|
||
| - name: Check openomf --version works | ||
| shell: bash | ||
| run: | | ||
| set -o pipefail | ||
| ret=0 | ||
| gtimeout 10 /Applications/openomf.app/Contents/MacOS/openomf \ | ||
| --version 2>&1 | tee $RUNNER_TEMP/version || ret=$? | ||
| if [ "$ret" -ne 1 ]; then | ||
| echo "openomf --version exit value: $ret" | ||
| if [ "$ret" -eq 124 ]; then | ||
| echo "openomf --version timed out" | ||
| fi | ||
| exit 1 | ||
| fi | ||
| if ! grep -q "$OPENOMF_VERSION" "$RUNNER_TEMP/version"; then | ||
| echo "$RUNNER_TEMP/version does not include $OPENOMF_VERSION" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Run REC tests | ||
| shell: bash | ||
| env: | ||
| OPENOMF_RESOURCE_PATH: /Applications/openomf.app/Contents | ||
| run: ./run_rectests.sh build-release | ||
|
Comment on lines
+91
to
+95
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not run the rec tests more times than we have to, as they take 6 minutes in CI. |
||
|
|
||
| - name: Upload artifacts | ||
| - name: Upload DMG artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: openomf_${{ env.OPENOMF_VERSION }}_macos14_arm | ||
| path: openomf_${{ env.OPENOMF_VERSION }}_macos14_arm.zip | ||
| name: openomf_${{ env.OPENOMF_VERSION }}_macos26_arm | ||
| path: openomf_${{ env.OPENOMF_VERSION }}_macos26_arm.dmg | ||
| if-no-files-found: error | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,7 +220,7 @@ omf_target_precompile_headers(openomf_core PUBLIC | |
| "<enet/enet.h>" | ||
| "<epoxy/gl.h>" | ||
| ) | ||
| if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$") | ||
| if(CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") | ||
| set_source_files_properties("${CMAKE_SOURCE_DIR}/src/vendored/argtable/argtable3.c" | ||
| PROPERTIES COMPILE_OPTIONS "-Wno-format-nonliteral" | ||
| ) | ||
|
|
@@ -480,6 +480,16 @@ set(DOC_FILES | |
| src/vendored/zip/LICENSE.zip | ||
| ) | ||
|
|
||
| if(APPLE) | ||
| set_target_properties(openomf PROPERTIES | ||
| MACOSX_BUNDLE TRUE | ||
| MACOSX_BUNDLE_BUNDLE_NAME "OpenOMF" | ||
| MACOSX_BUNDLE_GUI_IDENTIFIER "org.openomf.openomf" | ||
| MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_LABEL}" | ||
| MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_LABEL}" | ||
| ) | ||
| endif() | ||
|
|
||
| # Installation | ||
| if(WIN32) | ||
| # On windows, generate a flat directory structure under openomf/ subdir. | ||
|
|
@@ -488,6 +498,14 @@ if(WIN32) | |
| install(FILES resources/openomf.bk resources/gamecontrollerdb/gamecontrollerdb.txt DESTINATION openomf/resources/ COMPONENT Data) | ||
| install(DIRECTORY shaders/ DESTINATION openomf/shaders COMPONENT Data) | ||
| install(FILES ${DOC_FILES} DESTINATION openomf/ COMPONENT Data) | ||
| elseif(APPLE) | ||
| install(TARGETS openomf BUNDLE DESTINATION . RUNTIME DESTINATION bin COMPONENT Binaries) | ||
| install(FILES ${DOC_FILES} resources/openomf.bk resources/gamecontrollerdb/gamecontrollerdb.txt | ||
| resources/icons/openomf.png resources/flatpak/org.openomf.OpenOMF.desktop | ||
| DESTINATION openomf.app/Contents/Resources | ||
| COMPONENT Data | ||
| ) | ||
| install(DIRECTORY shaders/ DESTINATION openomf.app/Contents/shaders COMPONENT Data) | ||
| else() | ||
| # On unixy systems, follow standard. | ||
| install(TARGETS openomf RUNTIME DESTINATION bin COMPONENT Binaries) | ||
|
|
@@ -498,3 +516,36 @@ else() | |
| ) | ||
| install(DIRECTORY shaders/ DESTINATION share/games/openomf/shaders COMPONENT Data) | ||
| endif() | ||
|
|
||
| # Bundle in libSDL3.dylib since fixup_bundle() does not see the dependency. | ||
| if(APPLE) | ||
| find_package(SDL3 REQUIRED) | ||
| get_target_property(SDL3_LIBRARY_PATH SDL3::SDL3 LOCATION) | ||
| if(NOT SDL3_LIBRARY_PATH) | ||
| message(FATAL_ERROR "SDL3 not found") | ||
| endif() | ||
| message(STATUS "SDL3 is in ${SDL3_LIBRARY_PATH}") | ||
|
|
||
| set(SDL3_BUNDLE_SCRIPT "set(SDL3_LIBRARY_PATH [=[${SDL3_LIBRARY_PATH}]=])\n") | ||
|
|
||
| string(APPEND SDL3_BUNDLE_SCRIPT [[ | ||
| include(BundleUtilities) | ||
|
|
||
| set(APP_PATH "${CMAKE_INSTALL_PREFIX}/openomf.app") | ||
| set(CONTENTS_DIR "${APP_PATH}/Contents") | ||
|
|
||
| fixup_bundle("${APP_PATH}" "" "/opt/homebrew/lib;/usr/local/lib") | ||
| file(INSTALL "${SDL3_LIBRARY_PATH}" DESTINATION "${CONTENTS_DIR}/Frameworks" RENAME "libSDL3.dylib") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect we may run into trouble If this trouble does not occur, the manual file copy is good enough to stay-- considering an SDL3 port is inevitable, and will introduce a direct link dependency on SDL3, enabling fixup_bundle to grab SDL3 for us without any of this dancing around. Dumb idea: What if we linked SDL3 into the openomf target on macos? I wouldn't expect symbol conflicts between sdl2-compat and SDL3, and if the dep survives the linker, we've just successfully told |
||
|
|
||
| execute_process( | ||
| COMMAND codesign --force --sign - "${CONTENTS_DIR}/Frameworks/libSDL3.dylib" | ||
| COMMAND_ERROR_IS_FATAL ANY | ||
| ) | ||
| execute_process( | ||
| COMMAND codesign --force --identifier "org.openomf.openomf" --sign - "${APP_PATH}" | ||
| COMMAND_ERROR_IS_FATAL ANY | ||
| ) | ||
| ]]) | ||
|
|
||
| install(CODE "${SDL3_BUNDLE_SCRIPT}" COMPONENT Binaries) | ||
| endif() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before merging, I imagine you'll want to set the build type back to Release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, or at least making a different run for the rec tests.