############################################################################ # QSkinny - Copyright (C) The authors # SPDX-License-Identifier: BSD-3-Clause ############################################################################ macro(qsk_setup_Qt) # relying on cmake heuristics to select a specific Qt version is no good idea. # using -DCMAKE_PREFIX_PATH="..." is highly recommended find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick) if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) # we need the qsb tool for Qt6 find_package(Qt6 REQUIRED COMPONENTS ShaderTools) endif() if ( QT_FOUND ) # Would like to have a status message about where the Qt installation # has been found without having the mess of CMAKE_FIND_DEBUG_MODE # With Qt6 there seems to be: _qt_cmake_dir message(STATUS "Found Qt ${QT_VERSION} ${_qt_cmake_dir}") else() message(FATAL_ERROR "Couldn't find any Qt package !") endif() # Using find_package is probably no good idea as all other Qt modules should # be located below ${_qt_cmake_dir}. Otherwise we might end up with modules # from different packages. TODO ... if( BUILD_TOOLS ) # needed for building the svg2qvg tool find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Svg) endif() if( BUILD_EXAMPLES OR BUILD_PLAYGROUND ) # On embedded systems you often find optimized Qt installations without # Qt/Widgets support. QSkinny itself does not need Qt/Widgets - however # playground/grids demonstrates the differences between the various # grid layouts. So no big deal when it is missing. find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS QuickWidgets) if (NOT Qt${QT_VERSION_MAJOR}QuickWidgets_FOUND) message(STATUS "No Qt/Quick Widgets support: skipping some unimportant examples") endif() endif() if(BUILD_PLAYGROUND) # When building Qt most of the time is spent on the WebEngine modules # while only few applications need it. So it is a common situation to # have Qt installations without. # playground/webview shows how to use the Qt/Quick frontend from # C++, but QSkinny itself does not need the WebEngine at all. if (QT_VERSION_MAJOR VERSION_LESS 6) find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS WebEngine) find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS QuickShapes) set( Qt5WebEngineQuick_FOUND ${Qt5WebEngine_FOUND} ) set( Qt5QuickShapesPrivate_FOUND ${Qt5QuickShapes_FOUND} ) else() find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick) find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS QuickShapesPrivate) find_package(Qt${QT_VERSION_MAJOR} QUIET OPTIONAL_COMPONENTS QuickDialogs2Utils QuickDialogs2 ) endif() if( NOT Qt${QT_VERSION_MAJOR}WebEngineQuick_FOUND) message(STATUS "No Qt/Quick WebEngine support: skipping some unimportant examples") endif() if (NOT Qt${QT_VERSION_MAJOR}QuickShapesPrivate_FOUND) message(STATUS "No Qt/Quick Shapes support: skipping some unimportant examples") endif() if( NOT Qt${QT_VERSION_MAJOR}QuickDialogs2_FOUND) message(STATUS "No Qt/Quick Dialogs2 support: skipping some unimportant examples") endif() endif() endmacro() macro(qsk_setup_Hunspell) find_package(PkgConfig) pkg_check_modules(hunspell hunspell IMPORTED_TARGET) set(package_name "PkgConfig::hunspell") if (NOT TARGET "${package_name}") set(Hunspell_FOUND 0) return() endif() add_library(Hunspell::Hunspell INTERFACE IMPORTED) target_link_libraries(Hunspell::Hunspell INTERFACE ${package_name}) unset(package_name) set(Hunspell_FOUND TRUE) endmacro() macro(qsk_setup_Pinyin) # does this code work ???? find_package(PkgConfig) pkg_check_modules(PKG_PINYIN QUIET pinyin) find_path(PINYIN_INCLUDE_DIRS NAMES pinyinime.h PATH_SUFFIXES pinyin LibIME LibIME/libime/pinyin HINTS ${PKG_PINYIN_INCLUDE_DIRS}) find_library(PINYIN_LIBRARIES NAMES ${PKG_PINYIN_LIBRARIES} IMEPinyin imepinyin ime libime libimepinyin HINTS ${PKG_PINYIN_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PINYIN REQUIRED_VARS PINYIN_LIBRARIES PINYIN_INCLUDE_DIRS VERSION_VAR PKG_PINYIN_VERSION) mark_as_advanced(PINYIN_INCLUDE_DIRS PINYIN_LIBRARIES) add_library(pinyin SHARED IMPORTED GLOBAL) set_target_properties(pinyin PROPERTIES IMPORTED_LOCATION ${PINYIN_LIBRARIES}) target_include_directories(pinyin INTERFACE ${PINYIN_INCLUDE_DIRS}) find_package(LibIMEPinyin REQUIRED) find_package(Fcitx5Utils REQUIRED) endmacro()