Skip to content

Commit

Permalink
install plugin stuff (#40) (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyTheCo authored Oct 20, 2023
1 parent 17847ea commit d8ed5fc
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 85 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

include(local_conf.cmake OPTIONAL)
include(${CMAKE_CURRENT_BINARY_DIR}/local_conf.cmake OPTIONAL)

include(FetchContent)
FetchContent_Declare(
Expand Down
1 change: 1 addition & 0 deletions Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
include(CMakeFindDependencyMacro)
find_dependency(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg OPTIONAL_COMPONENTS Multimedia )
find_dependency(OpenCV REQUIRED COMPONENTS core objdetect )
find_dependency(MyDesigns 0.3 REQUIRED CONFIG)
include ( "${CMAKE_CURRENT_LIST_DIR}/qrCodeTargets.cmake" )
25 changes: 18 additions & 7 deletions QtQrDec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick OPTIONAL_COMPONENTS Multimedia)

FetchContent_Declare(
MyDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
GIT_TAG v0.3.1
FIND_PACKAGE_ARGS 0.3 CONFIG
)
FetchContent_MakeAvailable(MyDesigns)


if (Qt6_FOUND AND TARGET QrDec)
Expand All @@ -16,19 +23,21 @@ if (Qt6_FOUND AND TARGET QrDec)
"/esterVtech.com/imports"
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/QtQrDec
IMPORT_PATH ${QML_IMPORT_PATH}
${CMAKE_BINARY_DIR}/QtQrDec
IMPORT_PATH ${CMAKE_BINARY_DIR}
)
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 QrDec)
target_link_libraries(QtQrDec PRIVATE MyDesigns)
target_link_libraries(QtQrDec PRIVATE MyDesigns
$<$<STREQUAL:$<TARGET_PROPERTY:MyDesigns,TYPE>,STATIC_LIBRARY>:MyDesignsplugin>
)

if(TARGET Qt6::Multimedia)
target_link_libraries(QtQrDec PUBLIC Qt6::Multimedia)
endif(TARGET Qt6::Multimedia)
install(TARGETS QtQrDec ${out_targets_var}
install(TARGETS QtQrDec QtQrDecplugin ${out_targets_var}
EXPORT qrCodeTargets
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QtQr
Expand All @@ -37,10 +46,12 @@ if (Qt6_FOUND AND TARGET QrDec)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qrCode
COMPONENT QtQr
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/QtQrDec/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/QMLPlugins/QtQrDec
COMPONENT QtQr
)

if(EMSCRIPTEN)
target_compile_definitions(QtQrDec PUBLIC 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)
7 changes: 0 additions & 7 deletions QtQrDec/Qrimagedecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@



namespace fooQtQrDec
{
QString fooPrint(void)
{
return "https://forum.qt.io/post/762513";
}
}

#ifdef USE_EMSCRIPTEN

Expand Down
5 changes: 0 additions & 5 deletions QtQrDec/include/Qrimagedecoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#endif
#include <qrcodedec.hpp>

//foo namespace to force the linker to link the backing library composed only of qml files
namespace fooQtQrDec
{
QString fooPrint(void);
};

class QRImageDecoder : public QObject
{
Expand Down
111 changes: 58 additions & 53 deletions QtQrGen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,66 +1,71 @@
find_package(Qt6 COMPONENTS Core Gui Qml Quick OPTIONAL_COMPONENTS Svg)
FetchContent_Declare(
MyDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
GIT_TAG v0.2.3
FIND_PACKAGE_ARGS 0.2 CONFIG
)
MyDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
GIT_TAG v0.3.1
FIND_PACKAGE_ARGS 0.3 CONFIG
)
FetchContent_MakeAvailable(MyDesigns)

if (Qt6_FOUND)
qt_standard_project_setup()
qt6_add_qml_module(QtQrGen
URI QtQrGen
VERSION 1.0
SOURCES Qrimageprovider.cpp include/Qrimageprovider.hpp
QML_FILES qml/AddressQr.qml qml/PayQrPop.qml qml/QrLabel.qml
RESOURCE_PREFIX
"/esterVtech.com/imports"
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/QtQrGen
IMPORT_PATH ${QML_IMPORT_PATH}
)
qt_standard_project_setup()
qt6_add_qml_module(QtQrGen
URI QtQrGen
VERSION 1.0
SOURCES Qrimageprovider.cpp include/Qrimageprovider.hpp
QML_FILES
qml/AddressQr.qml
qml/PayQrPop.qml
qml/QrLabel.qml
RESOURCE_PREFIX
"/esterVtech.com/imports"
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/QtQrGen
IMPORT_PATH ${CMAKE_BINARY_DIR}
)


target_include_directories(QtQrGen PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qrCode>")
if(NOT TARGET Qt6::Svg)
FetchContent_Declare(
qtsvg
GIT_REPOSITORY git://code.qt.io/qt/qtsvg.git
GIT_TAG 6.5.0
)
FetchContent_MakeAvailable(qtsvg)
endif()
target_include_directories(QtQrGen PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qrCode>")
if(NOT TARGET Qt6::Svg)
FetchContent_Declare(
qtsvg
GIT_REPOSITORY git://code.qt.io/qt/qtsvg.git
GIT_TAG 6.5.0
)
FetchContent_MakeAvailable(qtsvg)
endif()


target_link_libraries(QtQrGen PUBLIC
Qt6::Quick
)
target_link_libraries(QtQrGen PRIVATE
QrGen
Qt6::Core
Qt6::Gui
Qt6::Qml
Qt6::Svg
MyDesigns
)
target_link_libraries(QtQrGen PUBLIC
Qt6::Quick
)
target_link_libraries(QtQrGen PRIVATE
QrGen
Qt6::Core
Qt6::Gui
Qt6::Qml
Qt6::Svg
MyDesigns
$<$<STREQUAL:$<TARGET_PROPERTY:MyDesigns,TYPE>,STATIC_LIBRARY>:MyDesignsplugin>
)

install(TARGETS QtQrGen ${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
)
install(TARGETS QtQrGen QtQrGenplugin ${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
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/QtQrGen/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/QMLPlugins/QtQrGen
COMPONENT QtQr
)
endif(Qt6_FOUND)
if(BUILD_DOCS)
get_target_property(build_docs cmake_build_docs SOURCES)
include(${build_docs})
get_target_property(build_docs cmake_build_docs SOURCES)
include(${build_docs})
endif()
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)
7 changes: 0 additions & 7 deletions QtQrGen/Qrimageprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
#include <QDebug>


namespace fooQtQrGen
{
QString fooPrint(void)
{
return "https://forum.qt.io/post/762513";
}
}

using namespace qrcodegen;

Expand Down
5 changes: 0 additions & 5 deletions QtQrGen/include/Qrimageprovider.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include <qquickimageprovider.h>

//foo namespace to force the linker to link the backing library composed only of qml files
namespace fooQtQrGen
{
QString fooPrint(void);
};

class QRImageProvider : public QQuickImageProvider
{
Expand Down

0 comments on commit d8ed5fc

Please sign in to comment.