Skip to content

Commit 51d66ad

Browse files
committed
Fix Linux build
1 parent 9e96c9d commit 51d66ad

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

qt/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ set_target_properties(bibref-qt PROPERTIES
8787
MACOSX_BUNDLE TRUE
8888
)
8989

90+
if(MINGW)
91+
SET(EXTRA_LIBS -lgvplugin_dot_layout -lgvplugin_rsvg -lgvplugin_core -lgvplugin_pango)
92+
endif(MINGW)
93+
9094
target_link_libraries(bibref-qt PRIVATE
9195
Qt6::Core
9296
Qt6::Gui
@@ -95,7 +99,7 @@ target_link_libraries(bibref-qt PRIVATE
9599
Qt6::SvgWidgets
96100
${sword_LIBRARIES} ${Boost_LIBRARIES} ${readline_LIBRARIES}
97101
${ICU_LIBRARIES} ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}
98-
${gvc_LIBRARIES} -lgvplugin_dot_layout -lgvplugin_rsvg -lgvplugin_core -lgvplugin_pango
102+
${gvc_LIBRARIES} ${EXTRA_LIBS}
99103
)
100104

101105
# If not set, XDG_DATA_HOME is set to $HOME:

qt/visualizewindow.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ VisualizeWindow::VisualizeWindow(QWidget *parent, string input)
2121
setCentralWidget(tile);
2222

2323
GVC_t *gvc= gvContext();
24-
/* This seems to be required, at least on Windows.
24+
#ifdef __MINGW32__
25+
/* This seems to be required on Windows, otherwise the
26+
* executable will not know anything about the dot format,
27+
* the svg export, and so on.
2528
* Also, in CMake's library settings these 4 dynamic libraries
26-
* must be included.
29+
* must be included. There seems to be no official way to
30+
* do this elegantly.
2731
*/
2832
extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
2933
extern gvplugin_library_t gvplugin_rsvg_LTX_library;
@@ -33,6 +37,7 @@ VisualizeWindow::VisualizeWindow(QWidget *parent, string input)
3337
gvAddLibrary(gvc, &gvplugin_rsvg_LTX_library);
3438
gvAddLibrary(gvc, &gvplugin_core_LTX_library);
3539
gvAddLibrary(gvc, &gvplugin_pango_LTX_library);
40+
#endif
3641

3742
Agraph_t *g = agmemread((char*)input.c_str());
3843
gvLayout(gvc, g, "dot");

0 commit comments

Comments
 (0)