Skip to content

Commit

Permalink
Fix build with external graphviz
Browse files Browse the repository at this point in the history
  • Loading branch information
drdanz committed Dec 9, 2024
1 parent d31092b commit 2f6ccb9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update -qq
sudo apt install -y doxygen
sudo apt install -y doxygen libgraphviz-dev
- name: Install Dependencies on macOS
if: ${{ runner.os == 'macOS' }}
Expand Down Expand Up @@ -91,6 +91,7 @@ jobs:
-DBUILD_TESTS=${{ matrix.build_type == 'Debug' }}
-DBUILD_EXAMPLES=ON
-DBUILD_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }}
-DWITH_INTERNAL_GRAPHVIZ=${{ runner.os != 'Linux' }}
- name: Build Project
run: cmake --build ./build
Expand Down
15 changes: 12 additions & 3 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ if(BUILD_QT6)
target_link_libraries(kdstatemachineeditor_core PRIVATE Qt6::StateMachine)
endif()

if (NOT WITH_INTERNAL_GRAPHVIZ)
target_include_directories(kdstatemachineeditor_core PRIVATE ${GRAPHVIZ_INCLUDE_DIR})
endif()

set_target_properties(
kdstatemachineeditor_core
PROPERTIES SOVERSION ${KDSME_SOVERSION}
Expand All @@ -110,12 +114,17 @@ endif()

generate_export_header(kdstatemachineeditor_core EXPORT_FILE_NAME kdsme_core_export.h BASE_NAME KDSME_CORE)

if(NOT GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY)
set(GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY gvplugin_dot_layout)

if(WITH_INTERNAL_GRAPHVIZ)
set(GRAPHVIZ_GVC_LIBRARY gvc)
set(GRAPHVIZ_CGRAPH_LIBRARY cgraph)
if(NOT GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY)
set(GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY gvplugin_dot_layout)
endif()
endif()

if(GRAPHVIZ_FOUND)
target_link_libraries(kdstatemachineeditor_core PRIVATE cgraph gvc ${GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY})
target_link_libraries(kdstatemachineeditor_core PRIVATE ${GRAPHVIZ_CGRAPH_LIBRARY} ${GRAPHVIZ_GVC_LIBRARY} ${GRAPHVIZ_PLUGIN_DOT_LAYOUT_LIBRARY})
endif()

set(build_iface_dirs
Expand Down

0 comments on commit 2f6ccb9

Please sign in to comment.