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

macOS build fix #1

Merged
merged 25 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
06f1da5
Rev1
farhangnaderi Sep 12, 2024
77c10ff
Rev2
farhangnaderi Sep 13, 2024
d0d157f
Added force relinking qt@5
farhangnaderi Sep 20, 2024
f7dc121
Update COMPILE.md
farhangnaderi Nov 10, 2024
84108a1
Getting CI corrections- disabling WF for other buld on push
farhangnaderi Nov 11, 2024
d2cf078
revert 84108a1
farhangnaderi Nov 11, 2024
1479a56
fix libzmq mosquitto parquet missing
farhangnaderi Nov 11, 2024
f9bb5ce
homebrew installation fix
farhangnaderi Nov 11, 2024
4ce1d72
zeromq brew installation fix
farhangnaderi Nov 11, 2024
216e5c1
Action v4 update, remove homebrew install
farhangnaderi Nov 12, 2024
1156cc5
add matrix for both archs
farhangnaderi Nov 12, 2024
b0e77b8
added cmake env and qt link force
farhangnaderi Nov 12, 2024
bb3fc2b
Added QT5 link or intsall!
farhangnaderi Nov 12, 2024
1d0866a
Conflicting ID resolution
farhangnaderi Nov 12, 2024
daaa685
remove aqt, py7zrversion
farhangnaderi Nov 12, 2024
2666b78
separating matrices
farhangnaderi Nov 12, 2024
67e16f1
add tmate
farhangnaderi Nov 12, 2024
7f6d857
removed Qt cache, switch to tmate if only fails
farhangnaderi Nov 12, 2024
cfebef8
added cmake flags, changed shell to bash
farhangnaderi Nov 12, 2024
f4dcfd9
introducting homebrew clear cache
farhangnaderi Nov 12, 2024
39e54ba
Compile doc added note, macos wokrflow file cleanups
farhangnaderi Nov 12, 2024
532e1bb
clang format correction in error_collector header file
farhangnaderi Nov 12, 2024
d7f42ea
error_collectors clang corrections
farhangnaderi Nov 12, 2024
757b0ee
clang newline format
farhangnaderi Nov 12, 2024
0e4864b
matrix format
farhangnaderi Nov 12, 2024
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
8 changes: 5 additions & 3 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ 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
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/PX4/PlotJuggler.git ~/plotjuggler_ws/src/PlotJuggler
farhangnaderi marked this conversation as resolved.
Show resolved Hide resolved
farhangnaderi marked this conversation as resolved.
Show resolved Hide resolved
cd ~/plotjuggler_ws
```

Expand Down
14 changes: 5 additions & 9 deletions cmake/FindZeroMQ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
# ZeroMQ_LIBRARIES - The libraries needed to use ZeroMQ
# ZeroMQ_DEFINITIONS - Compiler switches required for using ZeroMQ

find_path ( ZeroMQ_INCLUDE_DIR zmq.h )
find_library ( ZeroMQ_LIBRARY NAMES zmq )
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZMQ REQUIRED libzmq)

set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )

include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZeroMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIR )
set(ZeroMQ_FOUND TRUE)
set(ZeroMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS})
set(ZeroMQ_LIBRARIES ${ZMQ_LIBRARIES})
33 changes: 27 additions & 6 deletions plotjuggler_plugins/DataStreamZMQ/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
# Check for vcpkg, conan, or manual build environments
if(BUILDING_WITH_VCPKG)
message(STATUS "Finding ZeroMQ with vcpkg")
elseif(BUILDING_WITH_CONAN)
message(STATUS "Finding ZeroMQ with conan")
else()
message(STATUS "Finding ZeroMQ without package managers")
set(ZeroMQ_LIBS ${ZeroMQ_LIBRARIES})

# Find ZeroMQ using PkgConfig
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZMQ REQUIRED libzmq)

# Set the ZeroMQ libraries and include directories for manual configuration
set(ZeroMQ_LIBRARIES ${ZMQ_LIBRARIES})
set(ZeroMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS})
set(ZeroMQ_LIBRARY_DIRS /opt/homebrew/lib) # Add this line

# Add the library path explicitly
link_directories(${ZeroMQ_LIBRARY_DIRS}) # Add this line
endif()

# Find ZeroMQ library
find_package(ZeroMQ QUIET)

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

# Add QT definitions if needed
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)

QT5_WRAP_UI ( UI_SRC datastream_zmq.ui )
# Wrap the UI file for Qt
QT5_WRAP_UI(UI_SRC datastream_zmq.ui)

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

# Link Qt5Widgets and the plotjuggler_base target to DataStreamZMQ
target_link_libraries(DataStreamZMQ ${Qt5Widgets_LIBRARIES} plotjuggler_base)

# Handle different library linking for vcpkg, conan, or manual builds
if(BUILDING_WITH_VCPKG OR BUILDING_WITH_CONAN)
target_link_libraries(DataStreamZMQ libzmq-static)
else()
target_link_libraries(DataStreamZMQ ${ZeroMQ_LIBRARIES})
target_include_directories(DataStreamZMQ PRIVATE ${ZeroMQ_INCLUDE_DIRS})
target_link_libraries(DataStreamZMQ zmq) # Changed this to just 'zmq'
endif()

install(TARGETS DataStreamZMQ DESTINATION ${PJ_PLUGIN_INSTALL_DIRECTORY} )
# Install the plugin
install(TARGETS DataStreamZMQ DESTINATION ${PJ_PLUGIN_INSTALL_DIRECTORY})
else()
message("[ZeroMQ] not found. Skipping plugin DataStreamZMQ.")
message(STATUS "[ZeroMQ] not found. Skipping plugin DataStreamZMQ.")
endif()
9 changes: 9 additions & 0 deletions plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ void FileErrorCollector::AddWarning(const std::string& filename, int line, int,
qDebug() << msg;
}

void FileErrorCollector::RecordError(absl::string_view filename, int line, int column,
absl::string_view message) {
QString errorMessage = QString("Error in file: %1 at line: %2, column: %3: %4")
.arg(QString::fromStdString(std::string(filename)))
.arg(line)
.arg(column)
.arg(QString::fromStdString(std::string(message)));
_errors << errorMessage;
}
void IoErrorCollector::AddError(int line, google::protobuf::io::ColumnNumber,
const std::string& message)
{
Expand Down
34 changes: 20 additions & 14 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,19 +27,25 @@ 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 AddWarning(const std::string& filename, int line, int,
const std::string& message) override;

const QStringList& errors()
{
return _errors;
}

void AddError(const std::string& filename, int line, int column,
const std::string& message);

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

const QStringList& errors() const {
return _errors;
}

// Accessor for the collected warnings
const QStringList& warnings() const {
return _warnings;
}
private:
QStringList _errors;
QStringList _errors;
QStringList _warnings;
};

#endif // ERROR_COLLECTORS_H
Loading