-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Provide automatic macOS releases with Apple Silicon support #14839
Changes from all commits
8f60d99
14c2231
ed046ae
b583d16
5fc7344
e1cb1c9
90cb3d3
82249ce
c8204a2
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 |
---|---|---|
|
@@ -25,7 +25,15 @@ endif() | |
|
||
# Detect CPU from CMAKE configuration. Toolchains should set this up | ||
if(CMAKE_SYSTEM_PROCESSOR) | ||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64") | ||
if(CMAKE_OSX_ARCHITECTURES) | ||
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*86.*") | ||
set(X86_DEVICE ON) | ||
set(X86_64_DEVICE ON) | ||
endif() | ||
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64") | ||
set(ARM64 ON) | ||
endif() | ||
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64") | ||
set(ARM64 ON) | ||
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm64") | ||
# M1 Mac | ||
|
@@ -94,10 +102,14 @@ if(ANDROID OR WIN32 OR (UNIX AND NOT ARM_NO_VULKAN)) | |
endif() | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||
if(NOT ((ARM64 AND MACOSX) OR IOS)) | ||
if(NOT IOS) | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/sdl) | ||
endif() | ||
|
||
if(MACOSX AND NOT USE_SYSTEM_LIBSDL2) | ||
set(SDL2_LIBRARY ${CMAKE_SOURCE_DIR}/SDL/macOS/SDL2.framework) | ||
endif() | ||
|
||
include(ccache) | ||
include(GNUInstallDirs) | ||
|
||
|
@@ -139,6 +151,8 @@ option(USE_MINIUPNPC "Build with miniUPnPc support" ON) | |
option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY}) | ||
option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG}) | ||
option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP}) | ||
option(USE_SYSTEM_LIBSDL2 "Dynamically link against system SDL2" ON) | ||
option(USE_SYSTEM_LIBPNG "Dynamically link against system libpng" ON) | ||
option(USE_ASAN "Use address sanitizer" OFF) | ||
option(USE_UBSAN "Use undefined behaviour sanitizer" OFF) | ||
|
||
|
@@ -959,7 +973,9 @@ else() | |
set(PNG_REQUIRED_VERSION 1.6) | ||
endif() | ||
|
||
if(USE_SYSTEM_LIBPNG) | ||
find_package(PNG ${PNG_REQUIRED_VERSION}) | ||
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. Can this be indented? -[Unknown] 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. Yes, this one is finding "system" libpng, which on macOS can come from a package manager, such as brew or MacPorts. Doing this will result in linking to a library that does not come with macOS and is thus broken. 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 just mean mechanically, the -[Unknown] |
||
endif() | ||
if(PNG_FOUND) | ||
include_directories(${PNG_INCLUDE_DIRS}) | ||
else() | ||
|
@@ -2317,10 +2333,10 @@ if(TargetBin) | |
endif() | ||
|
||
if(IOS) | ||
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard" "MoltenVK/iOS/Frameworks") | ||
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard" "ext/vulkan/iOS/Frameworks") | ||
else() | ||
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource}) | ||
file(INSTALL "${CMAKE_SOURCE_DIR}/MoltenVK/macOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPPSDL.app/Contents/Frameworks/") | ||
file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/macOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPPSDL.app/Contents/Frameworks/") | ||
if(TARGET SDL2::SDL2 AND NOT USING_QT_UI) | ||
add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/SDL/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPSDL.app") | ||
elseif(USING_QT_UI) | ||
|
@@ -2379,7 +2395,7 @@ if(IOS) | |
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ios/PPSSPP-Info.plist" | ||
RESOURCE "ios/Launch Screen.storyboard" | ||
RESOURCE "ios/Settings.bundle" | ||
RESOURCE "MoltenVK/iOS/Frameworks" | ||
RESOURCE "ext/vulkan/iOS/Frameworks" | ||
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} | ||
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "iPhone/iPad" | ||
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,36 @@ if [ ! -f "${PPSSPPSDL}" ]; then | |
fi | ||
|
||
SDL=$(otool -L "${PPSSPPSDL}" | grep -v @executable_path | grep -Eo /.+libSDL.+dylib) | ||
if [ "${SDL}" = "" ]; then | ||
echo "SDL is already bundled/unused." | ||
exit 0 | ||
fi | ||
if [ "${SDL}" != "" ]; then | ||
if [ ! -f "${SDL}" ]; then | ||
echo "Cannot locate SDL: ${SDL}!" | ||
exit 0 | ||
fi | ||
|
||
if [ ! -f "${SDL}" ]; then | ||
echo "Cannot locate SDL: ${SDL}!" | ||
exit 0 | ||
fi | ||
echo "Installing SDL from ${SDL}..." | ||
|
||
echo "Installing SDL from ${SDL}..." | ||
SDLNAME=$(basename "${SDL}") | ||
mkdir -p "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
cp -r "$SDL" "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
install_name_tool -change "${SDL}" "@executable_path/../Frameworks/${SDLNAME}" "${PPSSPPSDL}" || exit 0 | ||
elif [ "$(otool -L "${PPSSPPSDL}" | grep @rpath/SDL)" != "" ]; then | ||
cd "$(dirname "$0")" | ||
RPATH="$(pwd)/macOS" | ||
cd - | ||
SDL="${RPATH}/SDL2.framework" | ||
if [ ! -d "${SDL}" ]; then | ||
echo "Cannot locate SDL.framework: ${SDL}!" | ||
exit 0 | ||
fi | ||
|
||
SDLNAME=$(basename "${SDL}") | ||
mkdir -p "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
cp -r "$SDL" "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
install_name_tool -change "${SDL}" "@executable_path/../Frameworks/${SDLNAME}" "${PPSSPPSDL}" || exit 0 | ||
rm -rf "${PPSSPP}/Contents/Frameworks/SDL2.framework" || exit 0 | ||
mkdir -p "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
cp -a "$SDL" "${PPSSPP}/Contents/Frameworks" || exit 0 | ||
install_name_tool -rpath "${RPATH}" "@executable_path/../Frameworks" "${PPSSPPSDL}" || echo "Already patched." | ||
fi | ||
|
||
GIT_VERSION_LINE=$(grep "PPSSPP_GIT_VERSION = " "$(dirname "${0}")/../git-version.cpp") | ||
echo "Setting version to ${GIT_VERSION_LINE}..." | ||
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 am worried about the version string in the builds. Currently there seem to be 2 bugs:
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 believe fixed (1) in https://github.com/vit9696/ppsspp/commit/ed046aebf5608869fd49fb55204715b01bc5620b. I am not sure what route shall I take to fix (2). Is it alright to make 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 guess that's fine, as long as it has the right values. I would think you'd need to fetch tags, i.e. -[Unknown] 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 tried that, but it did not work for me. I believe the reason is that we not only need to fetch the tags, but also connect tags to the history, otherwise one would get |
||
SHORT_VERSION_MATCH='.*"v([0-9\.]+(-[0-9]+)?).*";' | ||
LONG_VERSION_MATCH='.*"v(.*)";' | ||
if [[ "${GIT_VERSION_LINE}" =~ ^${SHORT_VERSION_MATCH}$ ]]; then | ||
|
@@ -36,3 +48,6 @@ else | |
plutil -replace CFBundleShortVersionString -string "" ${PPSSPP}/Contents/Info.plist | ||
plutil -replace CFBundleVersion -string "" ${PPSSPP}/Contents/Info.plist | ||
fi | ||
|
||
# AdHoc codesign is required for Apple Silicon. | ||
codesign -fs - --deep "${PPSSPP}" || exit 1 |
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.
I'm not really a fan of creating releases with generic messages for each release. That's exactly the terrible practice Android apps have started using, and I hate it there too.
-[Unknown]
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.
Well, it feels natural to me to edit the release message afterwards with e.g. a changelog manually. This code is just a convenience message to have something before this happens. There is no restriction to the amount of edits, so I feel there is no big issue in leaving it as is, especially since there is no good place to source the release message automatically anyway. Correct me if you think I am wrong.
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.
Well, I don't think anyone will edit them, but okay. Honestly, I'd prefer the release notes were just the version again like now:
https://github.com/hrydgard/ppsspp/releases
Rather than a message that repeats for every single release. Those are not "release notes", those are a description (this repo already has one of those.)
-[Unknown]