-
Notifications
You must be signed in to change notification settings - Fork 439
Build OpenBoard on MacOS (Universal)
These instructions work only for the coming version : OpenBoard 1.7. At the time you are reading, you need to place yourself on the dev
branch (explained below). Universal building is not supported before Qt 5.15.10, which is for now only available with a commercial license. For now, these instructions are made to work with Qt 6, and were not tested with Qt 5.15.10.
Install Xcode via Apple Store. Then, open a terminal and run the following command :
xcode-select --install
sudo xcodebuild -license
Go to https://www.macports.org/install.php and pick the package corresponding to the version of your OS.
Once downloaded, double click on it and follow the instructions to install it. Then, go to your terminal and run :
sudo port -v selfupdate
sudo port upgrade outdated
If you already have Qt and added Qt bin path to PATH, you can go to the next section.
Qt WebEngine is built using Qt, so we need to install Qt 6.
Download Qt installer from this page : https://www.qt.io/download-qt-installer
Open it and follow the instructions.
Select the Qt version you want to install. For this wiki, we'll use the Qt 6.3.2 version, and we simply select :
- macOS
Note that for this example, Qt was installed in user's home directory (i-e /Users/username/Qt
)
Open /etc/paths
in your favorite text editor, and add the following entry (adapted to the path you chose to install Qt in) :
/Users/username/Qt/6.3.2/macOS/bin
Follow the instructions and pick the <Qt_version> you want (for example 6.3.2). You'll need :
- Desktop gcc 64-bit
- Qt Multimedia
- Qt Positioning
- Qt WebChannel
- Qt 5 Compatibility Module
- Qt Debug Information Files (recommended but not mandatory)
Open /etc/paths
in a text editor with administrator rights :
sudo nano /etc/paths
And add the following line (the location of the qmake binary, when installed with macports) :
/opt/local/libexec/qt5/bin
At the time you are reading this page, using macports to install the following libraries with +universal
won't work, because of a boost issue. So we need to compile them by our own
git clone --recursive https://github.com/boostorg/boost.git
cd boost
git checkout develop # or whatever branch you want to use
Create a script called build.sh, containing this :
#!/bin/sh
rm -rf arm64 x86_64 universal stage bin.v2
rm -f b2 project-config*
./bootstrap.sh cxxflags="-arch x86_64 -arch arm64" cflags="-arch x86_64 -arch arm64" linkflags="-arch x86_64 -arch arm64"
./b2 toolset=clang-darwin target-os=darwin architecture=arm abi=aapcs cxxflags="-arch arm64" cflags="-arch arm64" linkflags="-arch arm64" -a
mkdir -p arm64 && cp stage/lib/*.dylib arm64
./b2 toolset=clang-darwin target-os=darwin architecture=x86 cxxflags="-arch x86_64" cflags="-arch x86_64" linkflags="-arch x86_64" abi=sysv binary-format=mach-o -a
mkdir x86_64 && cp stage/lib/*.dylib x86_64
mkdir universal
for dylib in arm64/*; do
lipo -create -arch arm64 $dylib -arch x86_64 x86_64/$(basename $dylib) -output universal/$(basename $dylib);
done
for dylib in universal/*; do
lipo $dylib -info;
done
Launch it.
sudo ./build.sh
git clone https://github.com/freedesktop/poppler.git
cd poppler
mkdir build
cd build
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DENABLE_UNSTABLE_API_ABI_HEADERS=ON
make -j8
sudo make install
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DQUAZIP_QT_MAJOR_VERSION=6 -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib
make
sudo make install
# place yourself in the directory you want
# (in this example at user's home directory)
cd
# create the folder
mkdir openboard
# enter in it
cd openboard
# Download OpenBoard sources
git clone https://github.com/OpenBoard-org/OpenBoard.git
# place yourself on the dev branch
cd OpenBoard
git checkout dev
Then, go to OpenBard's directory
cd <path_to_openboard>
cd Openboard
Open the OpenBoard.pro file, and edit it as following :
# For universal builds
# QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64" <-- uncomment
QMAKE_APPLE_DEVICE_ARCHS = arm64 <-- comment
Thus, Qt will build OpenBoard as a universal binary.
You can now compile OpenBoard :
qmake OpenBoard.pro
make
Go the the release_scripts
directory :
cd release_scripts/osx
Now, we need to edit the scripts to define where qmake is located. Open build.sh and package.sh and change the value of BASE_QT_DIR
to :
BASE_QT_DIR=/opt/local/libexec/qt5
When you want to package a new version of OpenBoard, you have 4 scripts to execute, to create a fully built, packaged, signed and notarized application. Note that you need an Apple developer account to sign and notarize your app. :
sudo ./build.sh
sudo ./codesign.sh "Developer ID Application : ..." # <= you need to replace the parameter by your own certificate
sudo ./package.sh
sudo ./notarize.sh "[email protected]"
Now, you should see your OpenBoard installer in <path_to_openboard>/Openboard/install/macos>
- Home
- Downloads
- Documentation
- OpenBoard
- Web Widgets
- Qt WebEngine
- Build Qt WebEngine from source
- Changes with Qt WebEngine
- Changelog
- Roadmap