3 Commits

Author SHA1 Message Date
d41accd111 cleanup 2025-03-08 17:33:24 +03:00
957ccc9946 dirty minimal working version 2025-03-08 12:42:43 +03:00
7d42cbd111 unneeded dependencies 2025-03-07 16:36:12 +03:00
5 changed files with 62 additions and 64 deletions

View File

@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.10)
project(checks-parser VERSION 0.1 LANGUAGES CXX)
option(BUILD_TRANSLATIONS "Build translations?" ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC OFF)
@@ -41,7 +43,6 @@ set(PROJECT_SOURCES
exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp
)
# Specify the UI files and source files for translation
set(TRANSLATION_SOURCES
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
@@ -51,50 +52,43 @@ set(TRANSLATION_SOURCES
adjustpicturedialog.cpp adjustpicturedialog.h adjustpicturedialog.ui
)
# qt_add_resources(RESOURCES
# ${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc
# )
qt5_add_translation(QM_FILES translations/en_US.ts translations/ru_RU.ts)
# qt5_add_resources(TRANSLATIONQRC translations.qrc OPTIONS --root ${CMAKE_CURRENT_BINARY_DIR})
# qt5_add_resources(TRANSLATIONQRC translations.qrc)
add_custom_target(translations
DEPENDS ${QM_FILES}
# DEPENDS ${RESOURCES}
VERBATIM
)
file(GLOB QM_FILES ${CMAKE_CURRENT_SOURCE_DIR}/translations/*.qm)
qt_add_resources(translation_resources
${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc
set(TS_FILES
translations/en_US.ts
translations/ru_RU.ts
)
foreach(QM_FILE ${QM_FILES})
file(APPEND ${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc
" <file>${QM_FILE}</file>\n"
)
endforeach()
if (BUILD_TRANSLATIONS)
qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" ${TS_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY)
qt5_add_resources(TRANSLATIONQRC ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
add_custom_target(translations ALL DEPENDS ${QM_FILES})
add_custom_target(resources ALL DEPENDS ${TRANSLATIONQRC})
add_dependencies(resources translations)
endif()
set(SOURCES "")
if (BUILD_TRANSLATIONS)
list(APPEND SOURCES ${TRANSLATIONQRC})
endif()
if(ANDROID)
add_library(checks-parser SHARED
${PROJECT_SOURCES}
${SOURCES}
)
else()
add_executable(checks-parser
${PROJECT_SOURCES}
${RESOURCES}
${SOURCES}
)
endif()
target_link_libraries(checks-parser PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_link_libraries(checks-parser PRIVATE Qt5::Widgets)
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.checks-parser)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER org.foxarmy.checks-parser)
set_target_properties(checks-parser PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
@@ -110,16 +104,20 @@ install(TARGETS checks-parser
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(WIN32)
#????
set(OpenCV_DIR /usr/local/lib/cmake/opencv4)
endif()
find_package(OpenCV 4 REQUIRED COMPONENTS core imgproc imgcodecs)
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
include_directories( ${OpenCV_INCLUDE_DIRS} )
target_link_libraries(checks-parser PRIVATE -lzbar)
target_link_libraries(checks-parser PRIVATE -ltesseract)
target_link_libraries(checks-parser PRIVATE -lcurl)
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS})
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS} )
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
target_link_libraries(checks-parser PRIVATE -lstdc++fs)
target_link_libraries(checks-parser PRIVATE -lstdc++fs)
endif()

View File

@@ -29,7 +29,6 @@ In general, you need to install following dependencies in order to build that ap
* curl
* nlohmann-json
* qt5
* vtk
Please, do not hesitate to open an issue if you cannot build that. I will help and if you are building on a distro that is not listed there, we can append that list as soon as we will solve your problem!
### Linux

View File

@@ -29,7 +29,6 @@
* curl
* nlohmann-json
* qt5
* vtk
Пожалуйста, не стесняйтесь и открывайте issue, если вы не можете собрать приложение. Я помогу вам, и если вы собираете приложение на дистрибутиве, который здесь не перечислен, как только мы решим вашу проблему, я добавлю новый дистрибутив в этот список!

View File

@@ -54,6 +54,9 @@ int main(int argc, char *argv[]) {
} else {
lang = QString::fromStdString("en_US");
}
std::cout << "Using locale: " << lang.toStdString() << std::endl;
translator.load(":/translation/" + lang + ".qm");
a.installTranslator(&translator);

View File

@@ -3,5 +3,4 @@
<file>en_US.qm</file>
<file>ru_RU.qm</file>
</qresource>
<qresource prefix="/translations"/>
</RCC>