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

Add macOS build script (Intel / x86_64) #7126

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ After compilation the plugin can be found in the build directory: `de_rest_plugi

### macOS

Currently only supported on Intel Macs (x86_64).

Install dependencies via Homebrew.

```
brew install qt@5 ninja cmake
```
Expand All @@ -94,11 +97,14 @@ brew install qt@5 ninja cmake

4. Compile the plugin with CMake

cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt@5 -G Ninja -B build .
cmake --build build
./build-macos.sh

After compilation the plugin can be found in the build directory: `de_rest_plugin.dylib`

5. Copy the plugin to the app bundle

cp build/de_rest_plugin.dylib /Applications/deCONZ.app/Contents/Plugins

## Build with QMake

**Important:** Building via QMake is deprecated and will be removed in future.
Expand Down
35 changes: 35 additions & 0 deletions build-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env sh

# Helper script to build libde_rest_plugin.dylib
# that can be copied into deCONZ.app/Contents/Plugins.

MACHINE=$(uname -m)
QTLOC=/usr/local/opt/qt@5

if [[ "$MACHINE" != "x86_64" ]]; then
echo "building currently only supported on x86_64"
exit 1
fi

if [ ! -d "$QTLOC" ]; then
echo "Homebrew (x86_64) or Qt5 not installed in $QTLOC"
exit 1
fi

rm -fr build

cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$QTLOC -G Ninja -B build .
cmake --build build

pushd build

for i in `otool -L libde_rest_plugin.dylib | grep /opt/qt | cut -f1 -d' '`
do
# fixup framework paths
# /usr/local/opt/qt@5/lib/ QtWidgets.framework/Versions/5/QtWidgets
# @executable_path/../Frameworks/ QtWidgets.framework/Versions/5/QtWidgets
newpath=`echo $i | awk '{gsub(/.*qt.*\/lib/,"@executable_path/../Frameworks");}1'`
install_name_tool -change $i $newpath libde_rest_plugin.dylib
done

popd