mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
build: Add support for x86 macOS 10.15 and ARM64 macOS 11.0 (#2607)
This PR drops the use of brew for dependency management in favor of macports so we can support lower macOS versions instead of just the lowest one supported by Apple Closes #2586
This commit is contained in:
81
.github/workflows/build.yml
vendored
81
.github/workflows/build.yml
vendored
@@ -251,7 +251,6 @@ jobs:
|
||||
- name: ⬇️ Install dependencies
|
||||
run: |
|
||||
cp dist/vcpkg.json vcpkg.json
|
||||
vcpkg install
|
||||
|
||||
- name: ⬇️ Install CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
@@ -390,18 +389,7 @@ jobs:
|
||||
id-token: write
|
||||
attestations: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- file_suffix: "-NoGPU"
|
||||
name_suffix: "NoGPU"
|
||||
custom_glfw: true
|
||||
- file_suffix: ""
|
||||
name_suffix: ""
|
||||
custom_glfw: false
|
||||
|
||||
name: 🍎 macOS 15 x86_64 ${{ matrix.name_suffix }}
|
||||
name: 🍎 macOS 10.15 x86_64
|
||||
|
||||
steps:
|
||||
- name: 🧰 Checkout
|
||||
@@ -416,61 +404,40 @@ jobs:
|
||||
- name: 📜 Setup ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ runner.os }}${{ matrix.file_suffix }}-ccache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}${{ matrix.file_suffix }}-ccache
|
||||
key: ${{ runner.os }}-ccache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}-ccache
|
||||
max-size: 1G
|
||||
|
||||
- name: Set Xcode version
|
||||
run: sudo xcode-select -s /Library/Developer/CommandLineTools
|
||||
run: |
|
||||
sudo xcode-select --install || true
|
||||
sudo xcode-select -s /Library/Developer/CommandLineTools
|
||||
|
||||
- name: 📦 Install MacPorts
|
||||
run: |
|
||||
wget https://github.com/macports/macports-base/releases/download/v2.11.6/MacPorts-2.11.6-15-Sequoia.pkg
|
||||
sudo installer -pkg MacPorts-2.11.6-15-Sequoia.pkg -target /
|
||||
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
|
||||
echo "PATH=/opt/local/bin:/opt/local/sbin:$PATH" >> $GITHUB_ENV
|
||||
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
|
||||
echo "universal_target 10.15" | sudo tee -a /opt/local/etc/macports/macports.conf
|
||||
echo "macos_deployment_target 10.15" | sudo tee -a /opt/local/etc/macports/macports.conf
|
||||
echo "macosx_sdk_version 10.15" | sudo tee -a /opt/local/etc/macports/macports.conf
|
||||
sudo port selfupdate
|
||||
|
||||
- name: ⬇️ Install dependencies
|
||||
env:
|
||||
# Make brew not display useless errors
|
||||
HOMEBREW_TESTS: 1
|
||||
run: |
|
||||
brew reinstall python --quiet || true
|
||||
brew link --overwrite --quiet python 2>/dev/null || true
|
||||
brew bundle --quiet --file dist/macOS/Brewfile || true
|
||||
rm -rf /usr/local/Cellar/capstone
|
||||
|
||||
- name: ⬇️ Install classic glfw
|
||||
if: ${{! matrix.custom_glfw }}
|
||||
run: |
|
||||
brew install --quiet glfw || true
|
||||
brew install llvm automake
|
||||
sudo -E port install mbedtls3 nlohmann-json ccache freetype libmagic pkgconfig curl glfw ninja zlib xz bzip2 zstd libssh2 md4c
|
||||
|
||||
- name: ⬇️ Install .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.100'
|
||||
|
||||
- name: 🧰 Checkout glfw
|
||||
if: ${{ matrix.custom_glfw }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: glfw/glfw
|
||||
path: glfw
|
||||
|
||||
# GLFW custom build (to allow software rendering)
|
||||
- name: ⬇️ Patch and install custom glfw
|
||||
if: ${{ matrix.custom_glfw }}
|
||||
run: |
|
||||
set -x
|
||||
cd glfw
|
||||
git apply ../dist/macOS/0001-glfw-SW.patch
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
|
||||
..
|
||||
ninja install
|
||||
|
||||
# MacOS cmake build
|
||||
- name: 🛠️ Configure CMake
|
||||
run: |
|
||||
@@ -481,8 +448,8 @@ jobs:
|
||||
CXX=$(brew --prefix llvm)/bin/clang++ \
|
||||
OBJC=$(brew --prefix llvm)/bin/clang \
|
||||
OBJCXX=$(brew --prefix llvm)/bin/clang++ \
|
||||
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DIMHEX_GENERATE_PACKAGE=ON \
|
||||
-DIMHEX_SYSTEM_LIBRARY_PATH="$(brew --prefix llvm)/lib;$(brew --prefix llvm)/lib/unwind;$(brew --prefix llvm)/lib/c++;$(brew --prefix)/lib" \
|
||||
@@ -531,7 +498,7 @@ jobs:
|
||||
break;
|
||||
fi
|
||||
done
|
||||
mv *.dmg ../../imhex-${{ env.IMHEX_VERSION }}-macOS${{ matrix.file_suffix }}-x86_64.dmg
|
||||
mv *.dmg ../../imhex-${{ env.IMHEX_VERSION }}-macOS-x86_64.dmg
|
||||
|
||||
- name: 🗝️ Generate build provenance attestations
|
||||
uses: actions/attest-build-provenance@v2
|
||||
@@ -544,12 +511,12 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: macOS DMG ${{ matrix.name_suffix }} x86_64
|
||||
name: macOS DMG x86_64
|
||||
path: ./*.dmg
|
||||
|
||||
macos-arm64:
|
||||
runs-on: ubuntu-24.04
|
||||
name: 🍎 macOS 15 arm64
|
||||
name: 🍎 macOS 11 arm64
|
||||
|
||||
outputs:
|
||||
IMHEX_VERSION: ${{ steps.build.outputs.IMHEX_VERSION }}
|
||||
|
||||
6
dist/macOS/arm64.Dockerfile
vendored
6
dist/macOS/arm64.Dockerfile
vendored
@@ -1,7 +1,7 @@
|
||||
# This base image is also known as "crosscompile". See arm64.crosscompile.Dockerfile
|
||||
FROM ghcr.io/werwolv/macos-crosscompile:4c4af2d1a6a102fab93cc9cd660280c2ec9d72af as build
|
||||
FROM ghcr.io/werwolv/macos-crosscompile:6d89b20ac5ebedb6f680f94637591c94cb36f40b as build
|
||||
|
||||
ENV MACOSX_DEPLOYMENT_TARGET 13.0
|
||||
ENV MACOSX_DEPLOYMENT_TARGET 11.0
|
||||
|
||||
# -- DOWNLOADING STUFF
|
||||
|
||||
@@ -132,6 +132,7 @@ if [ "$CUSTOM_GLFW" ]; then
|
||||
mkdir build
|
||||
cd build
|
||||
CC=o64-clang CXX=o64-clang++ cmake -G "Ninja" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
@@ -168,6 +169,7 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/
|
||||
-DIMHEX_STRICT_WARNINGS=OFF \
|
||||
-DIMHEX_PATTERNS_PULL_MASTER=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=/mnt/ImHex/build/install \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-B build
|
||||
## Build ImHex
|
||||
RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/_deps <<EOF
|
||||
|
||||
11
dist/macOS/osx_10_15/x64-osx.cmake
vendored
Normal file
11
dist/macOS/osx_10_15/x64-osx.cmake
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
set(VCPKG_BUILD_TYPE release)
|
||||
set(VCPKG_CRT_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
|
||||
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
|
||||
set(VCPKG_OSX_ARCHITECTURES x86_64)
|
||||
set(VCPKG_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "" FORCE)
|
||||
set(VCPKG_C_FLAGS "-mmacosx-version-min=10.15")
|
||||
set(VCPKG_CXX_FLAGS "-mmacosx-version-min=10.15")
|
||||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.15")
|
||||
2
dist/web/source/wasm-config.js
vendored
2
dist/web/source/wasm-config.js
vendored
@@ -166,7 +166,7 @@ var Module = {
|
||||
if (status == 1) {
|
||||
GLFW.active.buttons |= (1 << eventButton);
|
||||
try {
|
||||
event.target.setCapture();
|
||||
event.target.setPointerCapture(event.pointerId);
|
||||
} catch (e) {}
|
||||
} else {
|
||||
GLFW.active.buttons &= ~(1 << eventButton);
|
||||
|
||||
@@ -424,9 +424,15 @@
|
||||
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
||||
willPresentNotification:(UNNotification *)notification
|
||||
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
||||
if (@available(macOS 11.0, *)) {
|
||||
completionHandler(UNNotificationPresentationOptionBanner |
|
||||
UNNotificationPresentationOptionSound |
|
||||
UNNotificationPresentationOptionList);
|
||||
} else {
|
||||
// For macOS 10.15 and earlier
|
||||
completionHandler(UNNotificationPresentationOptionAlert |
|
||||
UNNotificationPresentationOptionSound);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1201,7 +1201,8 @@ static EM_BOOL ImGui_ImplGlfw_OnCanvasSizeChange(int event_type, const Emscripte
|
||||
ImGui_ImplGlfw_Data* bd = (ImGui_ImplGlfw_Data*)user_data;
|
||||
double canvas_width, canvas_height;
|
||||
emscripten_get_element_css_size(bd->CanvasSelector, &canvas_width, &canvas_height);
|
||||
glfwSetWindowSize(bd->Window, (int)canvas_width, (int)canvas_height);
|
||||
double scale = emscripten_get_device_pixel_ratio();
|
||||
glfwSetWindowSize(bd->Window, (int)canvas_width * scale, (int)canvas_height * scale);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1210,7 +1211,8 @@ static EM_BOOL ImGui_ImplEmscripten_FullscreenChangeCallback(int event_type, con
|
||||
ImGui_ImplGlfw_Data* bd = (ImGui_ImplGlfw_Data*)user_data;
|
||||
double canvas_width, canvas_height;
|
||||
emscripten_get_element_css_size(bd->CanvasSelector, &canvas_width, &canvas_height);
|
||||
glfwSetWindowSize(bd->Window, (int)canvas_width, (int)canvas_height);
|
||||
double scale = emscripten_get_device_pixel_ratio();
|
||||
glfwSetWindowSize(bd->Window, (int)canvas_width * scale, (int)canvas_height * scale);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace hex::init {
|
||||
if (meanScale <= 0.0F)
|
||||
meanScale = 1.0F;
|
||||
|
||||
#if !defined(OS_LINUX)
|
||||
#if !defined(OS_LINUX) && !defined(OS_WEB)
|
||||
meanScale /= hex::ImHexApi::System::getBackingScaleFactor();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -168,7 +168,6 @@ namespace hex {
|
||||
ImHexApi::System::impl::setNativeScale(currScaleFactor);
|
||||
|
||||
ThemeManager::reapplyCurrentTheme();
|
||||
ImGui::GetStyle().ScaleAllSizes(currScaleFactor / prevScaleFactor);
|
||||
}
|
||||
|
||||
prevScaleFactor = currScaleFactor;
|
||||
|
||||
Reference in New Issue
Block a user