Skip to content

Commit

Permalink
Link against Abseil for macOS builds & improve macOS compile docs #845 (
Browse files Browse the repository at this point in the history
#905)

* Link against Abseil for macOS builds & improve macOS compile docs #845

* Update plotjuggler_plugins/ParserProtobuf/CMakeLists.txt

---------

Co-authored-by: Davide Faconti <davide.faconti@gmail.com>
  • Loading branch information
Willmac16 and facontidavide authored Jan 26, 2024
1 parent 3d13507 commit 958f3a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
21 changes: 15 additions & 6 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,29 @@ On Mac, the dependencies can be installed using [brew](https://brew.sh/) with th
brew install cmake qt@5 protobuf mosquitto zeromq zstd
```

If a newer version of qt is installed, you may need to temporarily link to qt5

```shell
brew link qt@5 --override
# brew link qt --override # Run once you are done building to restore the original linking
```

Add CMake into your env-vars to be detected by cmake

```shell
echo "export CPPFLAGS=\"-I/opt/homebrew/opt/qt@5/include\"" >> $HOME/.zshrc
echo "export PKG_CONFIG_PATH=\"/opt/homebrew/opt/qt@5/lib/pkgconfig\"" >> $HOME/.zshrc
echo "export LDFLAGS=\"/opt/homebrew/opt/qt@5/lib\"" >> $HOME/.zshrc
echo 'QT_HOME=$(brew --prefix qt@5) \
export CPPFLAGS="-I $QT_HOME/include" \
export PKG_CONFIG_PATH="$QT_HOME/lib/pkgconfig" \
export LDFLAGS="$QT_HOME/lib"' >> $HOME/.zshrc
```

If you don't want to permanently add them into your main file, you can try by just exporting locally in the current terminal with:

```shell
export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig"
export LDFLAGS="/opt/homebrew/opt/qt@5/lib"
QT_HOME=$(brew --prefix qt@5)
export CPPFLAGS="-I $QT_HOME/include"
export PKG_CONFIG_PATH="$QT_HOME/lib/pkgconfig"
export LDFLAGS="$QT_HOME/lib"
```

Clone the repository into **~/plotjuggler_ws**:
Expand Down
6 changes: 6 additions & 0 deletions plotjuggler_plugins/ParserProtobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ if( Protobuf_FOUND)
protobuf_parser.h
${UI_SRC} )

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(ABSL_SPINLOCK_WAIT_LIB absl_spinlock_wait)

target_link_libraries(ProtobufParser ${ABSL_SPINLOCK_WAIT_LIB} )
endif()

target_link_libraries(ProtobufParser
${Qt5Widgets_LIBRARIES}
${Qt5Xml_LIBRARIES}
Expand Down

0 comments on commit 958f3a6

Please sign in to comment.