Skip to content

Commit

Permalink
Merge pull request #1 from bunty95/MacOS_arm64_x86-64
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
bunty95 authored Jun 10, 2024
2 parents 519c0f1 + 69010c8 commit 7aaf8e7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/BuildPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
matrix:
macos: [ macos-13 ]
xcode: [ Xcode_15.2 ]
include:
- xcode: Xcode
macos: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
17 changes: 13 additions & 4 deletions scripts/darwin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ rm -rf "${SRC_DIR}/build"
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"

Qt5_DIR="/usr/local/opt/qt"
echo "Run on MacOS $(uname -m) Qt5_DIR=$Qt5_DIR"
qmake ../BuildDltViewer.pro
make
if [[ $(uname -m) == 'arm64' ]]; then
Qt5_DIR="/opt/homebrew/opt/qt5"
# for an unknown reason, I was not able to make it work with qmake. Any help is welcome here TODO
echo "Build with cmake $(uname -m) $Qt5_DIR"
cmake ..
else
Qt5_DIR="/usr/local/opt/qt"
echo "Build with qmake $(uname -m) $Qt5_DIR"
qmake ../BuildDltViewer.pro
make
fi

#make

echo Cleanup
rm -rf "${INSTALL_DIR}"
Expand Down
31 changes: 26 additions & 5 deletions scripts/darwin/install.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/usr/bin/env bash
set -ex

id
env
pwd

brew update
brew install qt@5
brew link qt@5 --force --overwrite
brew unlink qt@5 && brew link --force qt@5
#brew link --overwrite qt@5 --force --overwrite
# https://github.com/Homebrew/homebrew-core/issues/8392
# https://github.com/Homebrew/legacy-homebrew/issues/29938
QT_VERSION=$(brew list --versions qt@5 | sed -n '/qt@5/s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*.*\).*$/\1/p')
sudo ln -s "/usr/local/Cellar/qt@5/${QT_VERSION}/mkspecs" /usr/local/mkspecs
sudo ln -s "/usr/local/Cellar/qt@5/${QT_VERSION}/plugins" /usr/local/plugins
QT_VERSION=$(brew list --versions qt@5 | awk '{print $2}')
echo "QT_VERSION=$QT_VERSION"
if [[ -z "$QT_VERSION" ]]; then
echo "QT_VERSION is empty"
exit 1
fi

# follow brew install suggestions
echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/opt/homebrew/opt/qt@5/lib"
export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig"
source ~/.bash_profile

uname -a
if [[ $(uname -m) == 'arm64' ]]; then
echo "Run on MacOS arm64"
sudo ln -s -F "/opt/homebrew/Cellar/qt@5/${QT_VERSION}/mkspecs" /usr/local/mkspecs
sudo ln -s -F "/opt/homebrew/Cellar/qt@5/${QT_VERSION}/plugins" /usr/local/plugins
else
echo "Run on MacOS x86"
sudo ln -s "/usr/local/Cellar/qt@5/${QT_VERSION}/mkspecs" /usr/local/mkspecs
sudo ln -s "/usr/local/Cellar/qt@5/${QT_VERSION}/plugins" /usr/local/plugins
fi

brew install ninja tree

0 comments on commit 7aaf8e7

Please sign in to comment.