Skip to content

Commit

Permalink
cmake: Copy Qt platform plugins on Windows
Browse files Browse the repository at this point in the history
Fixes #1.
  • Loading branch information
danpla committed Jun 20, 2019
1 parent 5212f7f commit e78ba9d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmake/install_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ install(
file(GLOB DLLS "${CMAKE_BINARY_DIR}/*.dll")
install(FILES ${DLLS} DESTINATION .)

install(DIRECTORY "${CMAKE_BINARY_DIR}/platforms" DESTINATION .)

install(
DIRECTORY "${CMAKE_BINARY_DIR}/tessdata"
DESTINATION .
Expand Down
17 changes: 17 additions & 0 deletions cmake/install_windows_msys2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,24 @@ endfunction()
copy_tessdata("${CMAKE_BINARY_DIR}")


function(copy_qt5_plugins dst_dir)
set(SRC_DIR "$ENV{MINGW_PREFIX}/share/qt5/plugins")

add_custom_command(
OUTPUT "${dst_dir}/platforms"
COMMAND ${CMAKE_COMMAND} -E make_directory "${dst_dir}/platforms"
COMMAND ${CMAKE_COMMAND} -E copy "${SRC_DIR}/platforms/qwindows.dll" "${dst_dir}/platforms"
DEPENDS "${SRC_DIR}"
VERBATIM
)

add_custom_target("qt5_plugins" ALL DEPENDS "${dst_dir}/platforms")
endfunction()


if (DPSO_UI STREQUAL "qt")
copy_qt5_plugins("${CMAKE_BINARY_DIR}")

include(qt_utils)
include(get_linguas)

Expand Down
7 changes: 5 additions & 2 deletions doc/building-windows-msys2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ necessary data files:
* "locale" dir - compiled gettext catalogs. Only created if the
DPSO_COMPILE_PO is enabled.

* "platforms" dir - platform-specific Qt plugins

* "tessdata" dir - Tesseract data files. CMake will copy that
directory from "$MINGW_PREFIX/share", and then remove "osd" and
"equ" traineddata files, which are not used by dpScreenOCR.
Expand All @@ -177,8 +179,9 @@ section below.
2.2 Copying DLLs
----------------

CMake doesn't copy DLL files, so you have to do this yourself with the
following command:
CMake only copies DLL files from the "$MINGW_PREFIX/share/qt5/plugins"
directory. Other DLLs need to be copied manually with the following
command:

cp $(sed -e "s:^:$MINGW_PREFIX/bin/:" ../doc/msys2-dlls.txt) .

Expand Down

0 comments on commit e78ba9d

Please sign in to comment.