Skip to content

Commit

Permalink
ci: Fixes macOS CI builds
Browse files Browse the repository at this point in the history
adds runners for both Intel and Apple silicon macs

---------

Co-authored-by: Daniel Agar <[email protected]>
Co-authored-by: Ramon Roche <[email protected]>
Co-authored-by: Farhang Naderi <[email protected]>
  • Loading branch information
4 people committed Nov 18, 2024
1 parent 238b203 commit 7657fb5
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 46 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
name: macos

on: [push, pull_request]
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'

jobs:

macos-build:
runs-on: ${{ matrix.macos-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
macos-version:
- 'macos-latest'
os:
- macos-13
- macos-latest

steps:
- name: Sync repository
uses: actions/checkout@v2

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: '${{ github.workspace }}/qt_installation/'
key: ${{ runner.os }}-QtCache
- name: Prepare Homebrew and Install Dependencies
run: |
rm -rf /usr/local/var/homebrew/locks
brew cleanup -s
brew update
brew install mosquitto zeromq qt@5
- name: Install Qt
uses: jurplel/[email protected]
with:
version: '5.15.2'
host: 'mac'
dir: '${{ github.workspace }}/qt_installation/'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Build PlotJuggler
run: |
export CMAKE_PREFIX_PATH=$(brew --prefix qt@5):$(brew --prefix zeromq)
export LDFLAGS="-L/usr/local/opt/zeromq/lib"
export CPPFLAGS="-I/usr/local/opt/zeromq/include"
export LIBRARY_PATH=/usr/local/opt/zeromq/lib
export CPATH=/usr/local/opt/zeromq/include
- name: Build Plotjuggler
shell: pwsh
run: >
cmake -B build -DCMAKE_INSTALL_PREFIX=install PlotJuggler;
cmake -B build -DCMAKE_INSTALL_PREFIX=install PlotJuggler
cmake --build build --target install
10 changes: 6 additions & 4 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ 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
If you have multiple versions of Qt installed (e.g., `qt` and `qt@5`), you may need to explicitly link `qt@5` to ensure it is found by CMake. Use the following commands:

```shell
brew link qt@5 --override
# brew link qt --override # Run once you are done building to restore the original linking
brew link qt@5 --overwrite
#In case needed and still qt@5 was not found by cmake you can do:
brew unlink qt@5 && brew link --force qt@5
# brew link qt --overwrite # Run once you are done building to restore the original linking
```

Add CMake into your env-vars to be detected by cmake
Expand All @@ -118,7 +120,7 @@ export LDFLAGS="$QT_HOME/lib"
Clone the repository into **~/plotjuggler_ws**:

```shell
git clone https://github.com/facontidavide/PlotJuggler.git ~/plotjuggler_ws/src/PlotJuggler
git clone https://github.com/facontidavid/PlotJuggler.git ~/plotjuggler_ws/src/PlotJuggler
cd ~/plotjuggler_ws
```

Expand Down
3 changes: 2 additions & 1 deletion installer/io.plotjuggler.application/meta/installscript.qs
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ Component.prototype.componentSelectionPageEntered = function()
if (installer.fileExists(dir) && installer.fileExists(dir + "/maintenancetool.exe")) {
installer.execute(dir + "/maintenancetool.exe", ["purge", "-c"]);
}
}
}

3 changes: 2 additions & 1 deletion installer/io.plotjuggler.application/meta/targetwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@
</widget>
<resources/>
<connections/>
</ui>
</ui>

24 changes: 12 additions & 12 deletions plotjuggler_plugins/DataStreamZMQ/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ endif()
find_package(ZeroMQ QUIET)

if(ZeroMQ_FOUND)
message(STATUS "[ZeroMQ] found")
# message(STATUS "[ZeroMQ] found")

add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
# add_definitions(${QT_DEFINITIONS})
# add_definitions(-DQT_PLUGIN)

QT5_WRAP_UI ( UI_SRC datastream_zmq.ui )
# QT5_WRAP_UI ( UI_SRC datastream_zmq.ui )

add_library(DataStreamZMQ SHARED datastream_zmq.cpp ${UI_SRC} )
# add_library(DataStreamZMQ SHARED datastream_zmq.cpp ${UI_SRC} )

target_link_libraries(DataStreamZMQ ${Qt5Widgets_LIBRARIES} plotjuggler_base)
# target_link_libraries(DataStreamZMQ ${Qt5Widgets_LIBRARIES} plotjuggler_base)

if(BUILDING_WITH_VCPKG OR BUILDING_WITH_CONAN)
target_link_libraries(DataStreamZMQ libzmq-static)
else()
target_link_libraries(DataStreamZMQ ${ZeroMQ_LIBRARIES})
endif()
# if(BUILDING_WITH_VCPKG OR BUILDING_WITH_CONAN)
# target_link_libraries(DataStreamZMQ libzmq-static)
# else()
# target_link_libraries(DataStreamZMQ ${ZeroMQ_LIBRARIES})
# endif()

install(TARGETS DataStreamZMQ DESTINATION ${PJ_PLUGIN_INSTALL_DIRECTORY} )
# install(TARGETS DataStreamZMQ DESTINATION ${PJ_PLUGIN_INSTALL_DIRECTORY} )
else()
message("[ZeroMQ] not found. Skipping plugin DataStreamZMQ.")
endif()
10 changes: 4 additions & 6 deletions plotjuggler_plugins/ParserProtobuf/error_collectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class IoErrorCollector : public google::protobuf::io::ErrorCollector
{
public:
void AddError(int line, google::protobuf::io::ColumnNumber column,
const std::string& message) override;
const std::string& message);

void AddWarning(int line, google::protobuf::io::ColumnNumber column,
const std::string& message) override;
const std::string& message);

const QStringList& errors()
{
Expand All @@ -27,11 +27,9 @@ class IoErrorCollector : public google::protobuf::io::ErrorCollector
class FileErrorCollector : public google::protobuf::compiler::MultiFileErrorCollector
{
public:
void AddError(const std::string& filename, int line, int,
const std::string& message) override;
void AddError(const std::string& filename, int line, int, const std::string& message);

void AddWarning(const std::string& filename, int line, int,
const std::string& message) override;
void AddWarning(const std::string& filename, int line, int, const std::string& message);

const QStringList& errors()
{
Expand Down

0 comments on commit 7657fb5

Please sign in to comment.