Skip to content

Commit 74e0a06

Browse files
committed
Now supporting building as a submodule of PJ.
1 parent 116c9a0 commit 74e0a06

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
cmake_minimum_required(VERSION 3.7)
22

3-
project(plotjuggler_can_plugins)
3+
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
4+
# Standalone build, call project and look for PlotJuggler
5+
project(plotjuggler_can_plugins)
46

5-
set(CMAKE_MODULE_PATH
6-
${CMAKE_MODULE_PATH}
7-
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
8-
)
7+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
8+
find_package(PlotJuggler REQUIRED)
9+
else()
10+
# Included from project (assuming from PlotJuggler)
11+
# Set PlotJuggler_LIBRARY manually since find_package fails in this configuration.
12+
set(PlotJuggler_LIBRARY plotjuggler_base)
13+
endif()
914

1015
set(CMAKE_INCLUDE_CURRENT_DIR ON)
1116
set(CMAKE_AUTOMOC ON)
@@ -33,7 +38,6 @@ find_package(Qt5 REQUIRED COMPONENTS
3338
find_package(Qt5 OPTIONAL_COMPONENTS
3439
SerialBus
3540
)
36-
find_package(PlotJuggler REQUIRED)
3741

3842
include_directories(
3943
${Qt5Core_INCLUDE_DIRS}
@@ -42,7 +46,7 @@ include_directories(
4246
${Qt5Xml_INCLUDE_DIRS}
4347
${PlotJuggler_INCLUDE_DIRS}
4448
${Qt5Svg_INCLUDE_DIRS}
45-
./3rdparty/dbcppp/include
49+
3rdparty/dbcppp/include
4650
)
4751

4852
set(PJ_LIBRARIES

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To build any plugin, PlotJuggler must be installed in your system.
1717

1818
For instance, in Linux, you should perform a full compilation and installation:
1919

20-
```
20+
```BASH
2121
git clone --recurse-submodules https://github.com/facontidavide/PlotJuggler.git
2222
cd PlotJuggler
2323
mkdir build; cd build
@@ -26,7 +26,7 @@ make -j
2626
sudo make install
2727
```
2828
After successfull installation of PlotJuggler, one can build DataLoadCAN and DataStreamCAN plugins as follows.
29-
```
29+
```BASH
3030
git clone --recurse-submodules https://github.com/PlotJuggler/plotjuggler-CAN-dbs.git
3131
cd plotjuggler-CAN-dbs
3232
mkdir build; cd build
@@ -35,6 +35,19 @@ make
3535

3636
```
3737

38+
An alternative approach is including this project in a local copy of PlotJuggler. This approach might be preferable on Windows or AppImage builds
39+
```BASH
40+
git clone --recurse-submodules https://github.com/facontidavide/PlotJuggler.git
41+
cd PlotJuggler/plotjuggler_plugins
42+
git clone --recurse-submodules https://github.com/PlotJuggler/plotjuggler-CAN-dbs.git
43+
# Add the following line in the CMakeList.txt of the PlotJuggler, just after other plugin include lines
44+
# add_subdirectory( plotjuggler_plugins/plotjuggler-CAN-dbs )
45+
cd ../; mkdir build; cd build # Create a build folder in the root of PlotJuggler
46+
cmake ..
47+
make -j
48+
sudo make install # In this approach, system-wide install is optional, you can diretly use the PJ inside the bin with CAN plugins included
49+
```
50+
3851
# Using the plugins
3952

4053
After building the plugins, one needs to include build directory to the plugins directory of the PlotJuggler.

0 commit comments

Comments
 (0)