Skip to content

Commit

Permalink
Fix windows (#79)
Browse files Browse the repository at this point in the history
* install dlls on bin and should install compiler-specific libraries for example app

* do not choose the camera format

* prepare for qt 6.7.0 and multimedia argument for windeployqt
  • Loading branch information
EddyTheCo authored Apr 7, 2024
1 parent 1ae452e commit be98358
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
include(GNUInstallDirs)


if(BUILD_QRDEC)
add_subdirectory(QrDec)
endif(BUILD_QRDEC)
Expand Down
4 changes: 3 additions & 1 deletion QrDec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ if(NOT OpenCV_FOUND AND OpenCV_DOWNLOAD)
if(OpenCV_FOUND AND NOT ANDROID AND NOT EMSCRIPTEN)
install(IMPORTED_RUNTIME_ARTIFACTS ${OpenCV_LIBS}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QrDec
COMPONENT OpenCVDep
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT OpenCVDep
)
endif()
endif()
Expand All @@ -58,6 +59,7 @@ if(OpenCV_FOUND)
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QrDec
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QrDec
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
Expand Down
1 change: 1 addition & 0 deletions QrGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install(TARGETS QrGen
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QrGen
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QrGen
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
Expand Down
10 changes: 6 additions & 4 deletions QtQrDec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

if(EMSCRIPTEN)
find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools)
find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools)
else()
find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools Multimedia)
find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools Multimedia)
endif(EMSCRIPTEN)


Expand All @@ -11,7 +11,7 @@ if (Qt6_FOUND AND TARGET QrDec)
FetchContent_Declare(
EstervDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
GIT_TAG v1.2.0
GIT_TAG develop
FIND_PACKAGE_ARGS 1.2 COMPONENTS SimpleStyle CustomControls CONFIG
)
FetchContent_MakeAvailable(EstervDesigns)
Expand All @@ -29,7 +29,7 @@ if (Qt6_FOUND AND TARGET QrDec)
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrDec
IMPORT_PATH ${CMAKE_BINARY_DIR}
IMPORT_PATH ${CMAKE_BINARY_DIR}
)

add_library(${PROJECT_NAME}::QtQrDec ALIAS QtQrDec)
Expand Down Expand Up @@ -63,6 +63,7 @@ if (Qt6_FOUND AND TARGET QrDec)
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QtQrDec
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QtQrDec
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
Expand All @@ -77,6 +78,7 @@ if (Qt6_FOUND AND TARGET QrDec)
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrDec
COMPONENT QtQrDec
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QtQrDec
)

if(EMSCRIPTEN)
Expand Down
10 changes: 0 additions & 10 deletions QtQrDec/Qrimagedecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ void QRImageDecoder::getCamera(void)
}
}
m_camera=new QCamera(best,this);
auto bvF=best.videoFormats().at(0);
for (const QCameraFormat &format : best.videoFormats())
{
if(abs(format.resolution().width()*1.0-format.resolution().height())<abs(bvF.resolution().width()*1.0-bvF.resolution().height()))
{
bvF=format;
}
}
m_camera->setCameraFormat(bvF);

}

}
Expand Down
4 changes: 3 additions & 1 deletion QtQrDec/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if(BUILD_EXAMPLES)
include(InstallRequiredSystemLibraries)
if(EMSCRIPTEN OR ANDROID)
find_package(Qt6 REQUIRED COMPONENTS QuickControls2)
find_package(EstervDesigns 0.4 REQUIRED COMPONENTS FlatControl CONFIG )
Expand All @@ -20,7 +21,7 @@ if(BUILD_EXAMPLES)
if(NOT EMSCRIPTEN)
target_link_libraries(${example} PRIVATE Qt6::Multimedia)
endif(NOT EMSCRIPTEN)
target_link_libraries(${example} PRIVATE Qt::Gui Qt::Qml Qt::Quick $<TARGET_NAME_IF_EXISTS:Qt6::Multimedia> QtQrDec
target_link_libraries(${example} PRIVATE Qt::Gui Qt::Qml Qt::Quick QtQrDec
$<$<STREQUAL:$<TARGET_PROPERTY:QtQrDec,TYPE>,STATIC_LIBRARY>:QtQrDecplugin>
)

Expand All @@ -37,6 +38,7 @@ if(BUILD_EXAMPLES)
qt_generate_deploy_qml_app_script(
TARGET ${example}
OUTPUT_SCRIPT deploy_script
# DEPLOY_TOOL_OPTIONS -multimedia #Qt> 6.7.0 only for windows
)
install(SCRIPT ${deploy_script} COMPONENT examples)
endif(QTDEPLOY)
Expand Down
4 changes: 3 additions & 1 deletion QtQrGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (Qt6_FOUND AND TARGET QrGen)
FetchContent_Declare(
EstervDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
GIT_TAG v1.2.0
GIT_TAG develop
FIND_PACKAGE_ARGS 1.2 COMPONENTS SimpleStyle CustomControls CONFIG
)
FetchContent_MakeAvailable(EstervDesigns)
Expand Down Expand Up @@ -65,6 +65,7 @@ if (Qt6_FOUND AND TARGET QrGen)
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QtQrGen
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QtQrGen
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
Expand All @@ -79,6 +80,7 @@ if (Qt6_FOUND AND TARGET QrGen)
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrGen
COMPONENT QtQrGen
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QtQrGen
)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
Expand Down
1 change: 1 addition & 0 deletions QtQrGen/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if(BUILD_EXAMPLES)
include(InstallRequiredSystemLibraries)
if(EMSCRIPTEN OR ANDROID)
find_package(Qt6 REQUIRED COMPONENTS QuickControls2)
find_package(EstervDesigns 0.4 REQUIRED COMPONENTS FlatControl CONFIG )
Expand Down

0 comments on commit be98358

Please sign in to comment.