Skip to content
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

Build for Apple Silicon #1743

Merged
merged 110 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
527166f
Updated conan file
rhinoella Nov 15, 2023
307c4c3
Changing outdated ptsl references to dpl
rhinoella Nov 15, 2023
eb75f4c
Updating includes to latest standard
rhinoella Nov 15, 2023
ad8cc5a
Upgrading conan requirement to use latest oneDPL version
rhinoella Nov 15, 2023
8c766d8
Changing cmake tbb reference to oneTBB
rhinoella Nov 15, 2023
33dfdb1
Turn off QT moc keywords
rhinoella Nov 15, 2023
5986e16
WIP - manually define QT keywords
rhinoella Nov 15, 2023
b7480ef
Manually define QT keywords
rhinoella Nov 15, 2023
6f7fde2
CMakeLists: removed depreciated --noall_load and added fix for google…
rhinoella Nov 15, 2023
b1db066
Removed fix for google libs- maybe better in different PR
rhinoella Nov 15, 2023
4721cc1
Merge branch 'develop' into upgrade-tbb
rhinoella Nov 15, 2023
036ced4
Added arm64 to cmake architectures
rhinoella Nov 15, 2023
bd37965
Added arm64 to cmake architectures
rhinoella Nov 15, 2023
e0bef1b
Formatting
rhinoella Nov 15, 2023
1bae25f
Get nix to install onetbb
rhinoella Nov 15, 2023
bad5edd
Get nix to install onetbb
rhinoella Nov 15, 2023
9d135e6
Remove cross compillation- for now
Nov 16, 2023
3176175
Test- nix
Nov 16, 2023
81717ab
Upgrade tbb nix (#1716)
rprospero Nov 17, 2023
5df824b
Upgrade ANTLR4 from 4.9.3 to 4.13.1 (#1721)
rhinoella Dec 1, 2023
1e4de0f
Merge branch 'develop' into upgrade-tbb
rhinoella Dec 1, 2023
120478f
Test silicon workflow
rhinoella Dec 1, 2023
f4eabce
Test silicon workflow
rhinoella Dec 1, 2023
6cb702f
Test silicon workflow
rhinoella Dec 1, 2023
9606dd0
Test silicon workflow
rhinoella Dec 1, 2023
1b98421
Update 'emit'
rhinoella Dec 1, 2023
974fc72
Merge branch 'upgrade-tbb' into apple-silicon
rhinoella Dec 1, 2023
685f971
Unspecify ftgl
rhinoella Dec 1, 2023
c0afbaf
Fix ftgl linking
Dec 4, 2023
886352e
Install freetype through conan
Dec 4, 2023
1032cae
Install freetype through conan
Dec 4, 2023
a5c6415
Cmake fixes
Dec 4, 2023
68ed95e
FTGLFix
Dec 4, 2023
9825b1a
Fixing packaging ftgl path
rhinoella Dec 4, 2023
0e73931
Fix linkage?
rhinoella Dec 6, 2023
a5e282b
Fix linkage?
rhinoella Dec 6, 2023
c34ff00
Fix ftgl include path
rhinoella Dec 6, 2023
5b3aa08
Fix freetype & ftgl rpaths
rhinoella Dec 7, 2023
41a7da3
Fix mistake
rhinoella Dec 7, 2023
b21c361
Update conan
rhinoella Dec 7, 2023
004bceb
fix mistake
rhinoella Dec 7, 2023
ab73fd1
fix mistake
rhinoella Dec 7, 2023
163ba18
fix mistake
rhinoella Dec 8, 2023
3ed48d4
fix mistake
rhinoella Dec 8, 2023
1ae723c
Sudo copying
rhinoella Dec 8, 2023
025e454
fix rpaths
rhinoella Dec 13, 2023
c56d9d8
Uninstall Freetype first
rhinoella Jan 15, 2024
00f7360
Merge branch 'develop' into apple-silicon
rhinoella Jan 16, 2024
9686572
Fix indentation
rhinoella Jan 16, 2024
18561f1
Fix indentation
rhinoella Jan 16, 2024
bf0686f
Fix lint
rhinoella Jan 16, 2024
7164f2f
Fix yaml indentation
rhinoella Jan 16, 2024
ea51627
Fix build env vars
rhinoella Jan 16, 2024
f6c3ac3
Change uninstall to only freetype
rhinoella Jan 16, 2024
3b73c0a
Uninstall force
rhinoella Jan 16, 2024
4a63099
Fix linking onedpl
rhinoella Jan 16, 2024
254423b
Try cleanup
rhinoella Jan 16, 2024
522ffa7
Remove find freetype
rhinoella Jan 16, 2024
482349e
Force remove freetype
rhinoella Jan 16, 2024
93b58a4
Turn off rpath changing & fix freetype ref
rhinoella Jan 17, 2024
3fb9365
Include freetype paths in cmake command
rhinoella Jan 17, 2024
9c10947
Fix freetype include dirs
rhinoella Jan 17, 2024
6d4cf84
Try get freetype from conan
rhinoella Jan 17, 2024
bf63e96
Find freetype
rhinoella Jan 18, 2024
3dcb299
Try again to set freetype_dir env var
rhinoella Jan 18, 2024
ab6a2f2
Merge branch 'develop' into apple-silicon
rhinoella Jan 18, 2024
d2f8331
Forgot to commit conanfile
rhinoella Jan 18, 2024
28bf090
Find freetype dependencies
rhinoella Jan 18, 2024
ad8b4e8
link brotli
rhinoella Jan 18, 2024
2b50d37
Fix formatting
rhinoella Jan 18, 2024
8afa3be
Fix formatting
rhinoella Jan 18, 2024
a735aab
FindBrotli
rhinoella Jan 18, 2024
b2d3362
Formatting
rhinoella Jan 18, 2024
a686f73
Format
rhinoella Jan 18, 2024
0ebf70c
Format
rhinoella Jan 18, 2024
cf97860
Try use conan lib paths
rhinoella Jan 18, 2024
9591312
Remove qc
rhinoella Jan 18, 2024
31954b0
Freetype too
rhinoella Jan 18, 2024
17d1ee6
Fix packaging
rhinoella Jan 19, 2024
e07ad9c
Fix tbb &dpl include dirs, include freetype as well
rhinoella Jan 19, 2024
25ae7e9
Change order of linking
rhinoella Jan 19, 2024
b787177
Use arm64 brew prefix
rhinoella Jan 19, 2024
9795456
Remove mkdir
rhinoella Jan 19, 2024
4448f05
Sudo
rhinoella Jan 19, 2024
81f73ee
Chown homebrew
rhinoella Jan 19, 2024
3eb88f3
wait
rhinoella Jan 19, 2024
e9d3c49
Use intel brew and stop modifying ftgl rpath
rhinoella Jan 19, 2024
d91af35
Reintroduce shared libs
rhinoella Jan 19, 2024
8b3772e
Fix lint cmakelist
rhinoella Jan 19, 2024
9a70194
Fix prep dmg call
rhinoella Jan 21, 2024
3bd0104
Try to include libs in bundle
rhinoella Jan 22, 2024
c1e4b63
Revert osx build workflow file
rhinoella Jan 23, 2024
396007f
Revert osx build workflow file
rhinoella Jan 23, 2024
512e217
Revert windows build workflow file
rhinoella Jan 23, 2024
5c7252b
Fix apple silicon packaging
rhinoella Jan 23, 2024
129cda1
Fix dissolve app path in packaging and change osx to osx-intel
rhinoella Jan 23, 2024
827d940
Add homebrew rpath, fix cmakelists
rhinoella Jan 24, 2024
095cd9f
Revert workflows to normal
rhinoella Jan 24, 2024
a6ef410
Remove indentation errors
rhinoella Jan 24, 2024
814ea81
Remove indentation errors
rhinoella Jan 24, 2024
bc9d357
Remove indentation errors
rhinoella Jan 24, 2024
7634c74
Upgrade onedpl version
rhinoella Jan 24, 2024
5320783
Find dependencies for windows as well (ftgl deps)
rhinoella Jan 24, 2024
effbc6a
Separate intel and silicon packaging steps
rhinoella Jan 24, 2024
6fad424
specify osx_ to vars
rhinoella Jan 24, 2024
13b3767
Delete cmake/Modules/FindBrotli.cmake
rhinoella Jan 24, 2024
8c918c4
Readd buildLinux to needs for package step
rhinoella Jan 24, 2024
da493ff
Undo changes to FindFTGL.cmake
rhinoella Jan 24, 2024
c5163ed
Remove if: false
rhinoella Jan 26, 2024
69c2bb5
Remove install_name_tool
rhinoella Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ runs:
target: ${{ inputs.target }}
cacheOnly: ${{ inputs.cacheOnly }}

- name: Build (OSX)
if: runner.os == 'MacOS'
uses: "./.github/workflows/build/osx"
- name: Build (OSX) Intel
if: runner.os == 'MacOS' && env.OSX_CMAKE_TARGET == 'x86_64'
uses: "./.github/workflows/build/osx-intel"
with:
cacheOnly: ${{ inputs.cacheOnly }}

- name: Build (OSX) Silicon
if: runner.os == 'MacOS' && env.OSX_CMAKE_TARGET == 'arm64'
uses: "./.github/workflows/build/osx-silicon"
with:
cacheOnly: ${{ inputs.cacheOnly }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
python-version: ${{ env.pythonVersion }}

- name: Install Homebrew Dependencies for Intel
if: ${{ inputs.cacheOnly == 'false' && env.OSX_CMAKE_TARGET == 'x86_64' }}
if: ${{ inputs.cacheOnly == 'false' }}
shell: bash
run: |

Expand Down Expand Up @@ -60,7 +60,7 @@ runs:
id: cache-conan
uses: actions/cache@v3
with:
key: osx-conan-${{ env.conanHash }}
key: osx-intel-conan-${{ env.conanHash }}
path: |
~/.conan
~/.conancache
Expand Down
132 changes: 132 additions & 0 deletions .github/workflows/build/osx-silicon/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Build
description: Build on OSX

inputs:
threading:
default: true
antlrVersion:
default: "4.13.1"
ftglVersion:
default: "2.1.3-rc5"
extraCMakeFlags:
default: ""
cacheOnly:
type: boolean
default: false

runs:
using: "composite"
steps:

#
# Setup / Install Dependencies
#

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}

- name: Install Homebrew Dependencies
if: ${{ inputs.cacheOnly }}
shell: bash
run: |
set -ex
brew update-reset
brew install ninja
PACKAGES=(libpng freetype ftgl antlr)
for PACKAGE in "${PACKAGES[@]}"
do
brew fetch --force --bottle-tag=arm64_monterey $PACKAGE
brew install $(brew --cache --bottle-tag=arm64_monterey $PACKAGE)
done

- name: Install Python Dependencies
shell: bash
run: |
pip3 install --user aqtinstall conan==1.58.0

- name: Retrieve Qt Cache
id: cache-qt
uses: actions/cache@v3
with:
key: osx-qt-${{ env.qtVersion }}
path: ${{ runner.temp }}/qt

- name: Install Qt
if: ${{ steps.cache-qt.outputs.cache-hit != 'true' }}
shell: bash
run: |
export PATH="$(python3 -m site --user-base)/bin:$PATH"
aqt install-qt --outputdir ${{ runner.temp }}/qt mac desktop ${{ env.qtVersion }}

#
# Main Build
#

- name: Install Conan Dependencies
shell: bash
run: |
set -ex

# Setup paths
export PATH="$(python3 -m site --user-base)/bin:$PATH"

mkdir build && cd build
conan config set storage.download_cache="${GITHUB_WORKSPACE}/.conancache"
conan install .. --build missing -s arch=armv8

- name: Build
if: ${{ inputs.cacheOnly == 'false' }}
shell: bash
run: |
set -ex

# Setup paths
# Must specify correct arm64 libs
export PATH="$(python3 -m site --user-base)/bin:$PATH"
Qt6_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/lib/cmake/Qt6
QT_BASE_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos
ANTLR_EXE=$(brew --prefix antlr)/antlr-${{ inputs.antlrVersion }}-complete.jar
FTGL_INCLUDE_DIRS=$(brew --prefix ftgl)/include/
FTGL_LIBRARIES=$(brew --prefix ftgl)/lib/libftgl.2.dylib

CMAKE_PARAMS=(
-DGUI:bool=true
-DMULTI_THREADING:bool=${{ inputs.threading }}
-DJava_JAVA_EXECUTABLE:path=$JAVA_HOME_21_X64/bin/java
-DANTLR_EXECUTABLE:string=$ANTLR_EXE
-DFTGL_INCLUDE_DIRS:path=$FTGL_INCLUDE_DIRS
-DFTGL_LIBRARIES:path=$FTGL_LIBRARIES
-DCMAKE_OSX_ARCHITECTURES:string="arm64"
-DQT_BASE_DIR=$QT_BASE_DIR
)

echo "Detected ANTLR exe as [$ANTLR_EXE]"
echo "JAVA HOME: $JAVA_HOME_21_X64"

# Build
cd build
cmake -G Ninja "${CMAKE_PARAMS[@]}" ${{ inputs.extraCMakeFlags }} ../
cmake --build . --config Release

cd ../

# Deploy Conan dependencies for ease
mkdir deploy && cd deploy
conan install .. -g deploy -s arch=armv8

# Copy over ftgl so it can be shipped with the bundle
mkdir ftgl
cp $(brew --prefix ftgl)/lib/libftgl.2.dylib ftgl
cp $(brew --prefix ftgl)/lib/libftgl.2.1.3.dylib ftgl

- name: Upload Raw Build Artifacts
if: ${{ inputs.cacheOnly == 'false' }}
uses: actions/upload-artifact@v3
with:
name: osx-build-artifacts-silicon
path: |
${{ github.workspace }}/build
${{ github.workspace }}/deploy
retention-days: 1
6 changes: 6 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
Expand Down Expand Up @@ -77,6 +80,9 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ runs:
using: "composite"
steps:

- name: Package (OSX)
if: runner.os == 'MacOS'
uses: "./.github/workflows/package/osx"
- name: Package (OSX) Intel
if: runner.os == 'MacOS' && env.OSX_CMAKE_TARGET == 'x86_64'
uses: "./.github/workflows/package/osx-intel"

- name: Package (OSX) Silicon
if: runner.os == 'MacOS' && env.OSX_CMAKE_TARGET == 'arm64'
uses: "./.github/workflows/package/osx-silicon"

- name: Package (Windows)
if: runner.os == 'Windows'
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/package/osx-intel/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Package
description: Package OSX artifacts

runs:
using: "composite"
steps:

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}

- name: Retrieve Qt Cache
uses: actions/cache@v3
with:
key: osx-qt-${{ env.qtVersion }}
path: ${{ runner.temp }}/qt

- name: Download Raw Build Artifacts
uses: actions/download-artifact@v3
with:
name: osx-build-artifacts
path: ${{ github.workspace }}

- name: Install Python Dependencies
shell: bash
run: |
pip3 install --user dmgbuild biplist

- name: Install Custom Dependencies
shell: bash
run: |
set -ex
wget https://raw.githubusercontent.com/disorderedmaterials/scripts/master/prep-dmg
chmod u+x ./prep-dmg

- name: Prepare DMG Dirs
shell: bash
run: |
set -ex
Qt6_ROOT=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/
export PATH="$(python3 -m site --user-base)/bin:$PATH"

# Handle ANTLR & TBB
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.*.dylib /usr/local/lib
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.dylib /usr/local/lib/libantlr4-runtime.dylib

for FILE in ./deploy/onetbb/lib/*.dylib; do
FILENAME=$(basename $FILE)
cp ./deploy/onetbb/lib/$FILENAME /usr/local/lib/$FILENAME
done

install_name_tool -add_rpath "@executable_path/../Frameworks/" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui
install_name_tool -add_rpath "/usr/local/lib" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui
./prep-dmg -a Dissolve-GUI -v ${{ env.dissolveVersion }} -b build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui -d ${Qt6_ROOT} -i icon/icon-1024x1024.png -p build/bin/dissolve-gui.app/Contents/Info.plist -L /usr/local/lib

- name: Create Disk Image
shell: bash
run: |
set -ex
export PATH="$(python3 -m site --user-base)/bin:$PATH"

# Fix icon link
sed -i -e "s/Dissolve.icns/Dissolve-GUI.icns/g" Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Info.plist

# Create DMG
dmgbuild -s ci/osx/dmgbuild-settings.py -D app=./Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app -D icon=./Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Resources/Dissolve-GUI.icns "Dissolve GUI" Dissolve-GUI-${dissolveVersion}.dmg

# Collect artifacts
mkdir packages
mv Dissolve-GUI-${dissolveVersion}.dmg packages/

- name: Upload Package Artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ${{ github.workspace }}/packages
83 changes: 83 additions & 0 deletions .github/workflows/package/osx-silicon/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Package
description: Package OSX artifacts

runs:
using: "composite"
steps:

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}

- name: Retrieve Qt Cache
uses: actions/cache@v3
with:
key: osx-qt-${{ env.qtVersion }}
path: ${{ runner.temp }}/qt

- name: Download Raw Build Artifacts
uses: actions/download-artifact@v3
with:
name: osx-build-artifacts-silicon
path: ${{ github.workspace }}

- name: Install Python Dependencies
shell: bash
run: |
pip3 install --user dmgbuild biplist

- name: Install Custom Dependencies
shell: bash
run: |
set -ex
wget https://raw.githubusercontent.com/disorderedmaterials/scripts/master/prep-dmg
chmod u+x ./prep-dmg

- name: Prepare DMG Dirs
shell: bash
run: |
set -ex
Qt6_ROOT=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/
export PATH="$(python3 -m site --user-base)/bin:$PATH"

install_name_tool -add_rpath "@executable_path/../Frameworks/" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui
# Add homebrew rpath
install_name_tool -add_rpath "/opt/homebrew/lib" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui

./prep-dmg -a Dissolve-GUI -v ${{ env.dissolveVersion }} -b build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui -d ${Qt6_ROOT} -i icon/icon-1024x1024.png -p build/bin/dissolve-gui.app/Contents/Info.plist

# Copy dependencies into Frameworks folder in app bundle
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.4.13.1.dylib Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Frameworks/libantlr4-runtime.4.13.1.dylib
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.dylib Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Frameworks/libantlr4-runtime.dylib

cp ./deploy/ftgl/libftgl.2.dylib Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Frameworks/libftgl.2.dylib
cp ./deploy/ftgl/libftgl.2.dylib Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Frameworks/libftgl.2.1.3.dylib

for FILE in ./deploy/onetbb/lib/*.dylib; do
FILENAME=$(basename $FILE)
cp ./deploy/onetbb/lib/$FILENAME Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Frameworks/$FILENAME
done


- name: Create Disk Image
shell: bash
run: |
set -ex
export PATH="$(python3 -m site --user-base)/bin:$PATH"

# Fix icon link
sed -i -e "s/Dissolve.icns/Dissolve-GUI.icns/g" Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Info.plist

# Create DMG
dmgbuild -s ci/osx/dmgbuild-settings.py -D app=./Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app -D icon=./Dissolve-GUI-${dissolveVersion}/Dissolve-GUI.app/Contents/Resources/Dissolve-GUI.icns "Dissolve GUI" Dissolve-GUI-${dissolveVersion}.dmg

# Collect artifacts
mkdir packages
mv Dissolve-GUI-${dissolveVersion}.dmg packages/

- name: Upload Package Artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ${{ github.workspace }}/packages
13 changes: 11 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ jobs:
uses: "./.github/workflows/qc"

Build:
needs: QC
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
Expand Down Expand Up @@ -76,7 +78,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest ]
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
Expand Down