-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed unused test * align names and added dependencies when installing also created custom type for qrdecoding * using a pointer and deleting to avoid memory leak of opencv * use mybutton and use the wasm version if emscriptem * Added the emscriptem macro and wasm functions * use the singleton * added wasm version of qrQmlCamera * add emscripten macro * added the javascript link video stream and wasm decoder * Added the wasm Image provider for stream * use internal imageprovider to show stream * use prebuilt opencv if not found on the system * added shader tools and multimedia qt modules to action * build qt multimedia if not found * link to qtMultimedia if target exist * find opencv config in windows * fixed macos prebuilt link
- Loading branch information
Showing
17 changed files
with
462 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@PACKAGE_INIT@ | ||
include(CMakeFindDependencyMacro) | ||
find_dependency(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg ) | ||
find_dependency(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg OPTIONAL_COMPONENTS Multimedia ) | ||
find_dependency(OpenCV QUIET ) | ||
include ( "${CMAKE_CURRENT_LIST_DIR}/qrCodeTargets.cmake" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,55 @@ | ||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR) | ||
include(local_conf.cmake OPTIONAL) | ||
project(QrCodeDecLib VERSION 0.1 DESCRIPTION "library for qr codes decription" LANGUAGES CXX) | ||
|
||
|
||
set(default_build_type "Release") | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE | ||
STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
find_package(OpenCV) | ||
if(NOT OpenCV_FOUND) | ||
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/download/v0.0.14/OpenCV-ubuntu-latest-wasm_false.tar") | ||
if(WIN32) | ||
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/download/v0.0.14/OpenCV-windows-latest-wasm_false.tar") | ||
endif(WIN32) | ||
if (APPLE) | ||
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/download/v0.0.14/OpenCV-macos-latest-wasm_false.tar") | ||
endif(APPLE) | ||
if(EMSCRIPTEN) | ||
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/download/v0.0.14/OpenCV-ubuntu-latest-wasm_true.tar") | ||
endif(EMSCRIPTEN) | ||
FetchContent_Declare( | ||
OpenCV | ||
URL ${builturl} | ||
) | ||
FetchContent_GetProperties(OpenCV) | ||
if(NOT OpenCV_POPULATED) | ||
message(STATUS "OpenCV prebuilt will be downloaded from ${builturl} if not found on the system") | ||
FetchContent_Populate(OpenCV) | ||
message(STATUS "OpenCV is installed in ${opencv_SOURCE_DIR}") | ||
set(OpenCV_DIR ${opencv_SOURCE_DIR}/lib/cmake/opencv4) | ||
if(WIN32) | ||
set(OpenCV_DIR ${opencv_SOURCE_DIR}) | ||
endif(WIN32) | ||
find_package(OpenCV) | ||
endif() | ||
endif() | ||
|
||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
|
||
find_package( OpenCV REQUIRED ) | ||
add_library(QrDec qrcodedec.cpp include/qrcodedec.hpp) | ||
|
||
|
||
target_compile_features(QrDec PUBLIC cxx_std_11) | ||
|
||
set_target_properties(QrDec PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
target_include_directories(QrDec PRIVATE ${OpenCV_INCLUDE_DIRS}) | ||
target_link_libraries(QrDec PRIVATE ${OpenCV_LIBS}) | ||
|
||
target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
"$<INSTALL_INTERFACE:include>") | ||
|
||
install(TARGETS QrDec EXPORT QrDecTargets DESTINATION lib) | ||
install(DIRECTORY include/ DESTINATION include/) | ||
|
||
install(EXPORT QrDecTargets | ||
FILE QrDecTargets.cmake | ||
NAMESPACE qr:: | ||
DESTINATION lib/cmake/QrDec | ||
) | ||
include(CMakePackageConfigHelpers) | ||
# generate the config file that is includes the exports | ||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/QrDecConfig.cmake" | ||
INSTALL_DESTINATION "lib/cmake/QrDec" | ||
NO_SET_AND_CHECK_MACRO | ||
NO_CHECK_REQUIRED_COMPONENTS_MACRO | ||
) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/QrDecConfigVersion.cmake" | ||
VERSION "0.1.1.0" | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/QrDecConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/QrDecConfigVersion.cmake | ||
DESTINATION lib/cmake/QrDec | ||
) | ||
export(EXPORT QrDecTargets | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/QrDecTargets.cmake" | ||
) | ||
|
||
|
||
if(OpenCV_FOUND) | ||
|
||
add_library(QrDec qrcodedec.cpp) | ||
|
||
set_target_properties(QrDec PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
target_include_directories(QrDec PRIVATE ${OpenCV_INCLUDE_DIRS}) | ||
target_link_libraries(QrDec PRIVATE ${OpenCV_LIBS}) | ||
|
||
target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qrCode>") | ||
|
||
install(TARGETS QrDec | ||
EXPORT qrCodeTargets | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT Qr | ||
) | ||
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qrCode | ||
COMPONENT Qr | ||
) | ||
else() | ||
message(STATUS "OpenCV was not found") | ||
endif(OpenCV_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
#include<qrcodedec.hpp> | ||
#include<opencv2/opencv.hpp> | ||
|
||
|
||
|
||
namespace qrcodedec { | ||
using namespace std; | ||
using namespace cv; | ||
using namespace std; | ||
using namespace cv; | ||
string decode_grey(unsigned char* img,int rows ,int cols) | ||
{ | ||
Mat greyImg = cv::Mat(rows,cols, CV_8UC1, img); | ||
Mat greyImg = Mat(rows,cols, CV_8UC1, img); | ||
|
||
QRCodeDetector decoder = QRCodeDetector(); | ||
return decoder.detectAndDecode(greyImg); | ||
QRCodeDetector* decoder = new QRCodeDetector(); | ||
auto str=decoder->detectAndDecode(greyImg); | ||
delete decoder; | ||
return str; | ||
} | ||
|
||
|
||
} | ||
|
||
#ifdef USE_EMSCRIPTEN | ||
EMSCRIPTEN_BINDINGS(qrcodedec) { | ||
function("decode_grey", &qrcodedec::decode_grey); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,69 @@ | ||
|
||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) | ||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick OPTIONAL_COMPONENTS Multimedia) | ||
|
||
qt_add_library(QtQrDec Qrimagedecoder.cpp include/Qrimagedecoder.hpp) | ||
|
||
target_include_directories(QtQrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
"$<INSTALL_INTERFACE:include>") | ||
|
||
target_link_libraries(QtQrDec PUBLIC | ||
Qt6::Core | ||
Qt6::Qml | ||
) | ||
target_link_libraries(QtQrDec PRIVATE | ||
QrDec | ||
Qt6::Gui | ||
Qt6::Quick | ||
if (Qt6_FOUND) | ||
qt_standard_project_setup() | ||
if(NOT TARGET Qt6::Multimedia AND NOT EMSCRIPTEN) | ||
FetchContent_Declare( | ||
qtmultimedia | ||
GIT_REPOSITORY git://code.qt.io/qt/qtmultimedia.git | ||
GIT_TAG 6.5.0 | ||
) | ||
FetchContent_MakeAvailable(qtmultimedia) | ||
endif() | ||
endif(Qt6_FOUND) | ||
FetchContent_Declare( | ||
MyDesigns | ||
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git | ||
GIT_TAG v0.2.3 | ||
FIND_PACKAGE_ARGS 0.2 CONFIG | ||
) | ||
FetchContent_MakeAvailable(MyDesigns) | ||
|
||
install(TARGETS QtQrDec | ||
EXPORT ${PROJECT_NAME}-config | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT QtQr | ||
install(DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} | ||
COMPONENT QtQr | ||
) | ||
if (Qt6_FOUND AND TARGET QrDec) | ||
|
||
if(TARGET Qt6::Multimedia) | ||
list(APPEND qml_files "qml/QrQmlCamera.qml") | ||
else() | ||
if(EMSCRIPTEN) | ||
list(APPEND qml_files "qml/wasm/QrQmlCamera.qml") | ||
endif() | ||
endif() | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
include(CTest) | ||
if(BUILD_TESTING) | ||
add_subdirectory(tests) | ||
endif(BUILD_TESTING) | ||
endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
qt6_add_qml_module(QtQrDec | ||
URI QtQrDec | ||
VERSION 1.0 | ||
SOURCES Qrimagedecoder.cpp include/Qrimagedecoder.hpp | ||
QML_FILES ${qml_files} | ||
RESOURCE_PREFIX | ||
"/esterVtech.com/imports" | ||
OUTPUT_TARGETS out_targets_var | ||
OUTPUT_DIRECTORY | ||
${CMAKE_CURRENT_BINARY_DIR}/QtQrDec | ||
IMPORT_PATH ${QML_IMPORT_PATH} | ||
) | ||
target_include_directories(QtQrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qrCode>") | ||
|
||
target_link_libraries(QtQrDec PUBLIC Qt6::Gui Qt6::Quick) | ||
target_link_libraries(QtQrDec PRIVATE QrDec MyDesigns) | ||
|
||
if(TARGET Qt6::Multimedia) | ||
target_link_libraries(QtQrDec PUBLIC Qt6::Multimedia) | ||
endif(TARGET Qt6::Multimedia) | ||
install(TARGETS QtQrDec ${out_targets_var} | ||
EXPORT qrCodeTargets | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT QtQr | ||
) | ||
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qrCode | ||
COMPONENT QtQr | ||
) | ||
if(EMSCRIPTEN) | ||
target_compile_definitions(QtQrDec PRIVATE USE_EMSCRIPTEN) | ||
endif(EMSCRIPTEN) | ||
endif(Qt6_FOUND AND TARGET QrDec) | ||
list(APPEND QML_IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qml ${CMAKE_CURRENT_BINARY_DIR}) | ||
list(REMOVE_DUPLICATES QML_IMPORT_PATH) | ||
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} CACHE STRING "" FORCE) |
Oops, something went wrong.