2023-04-05 17:47:15 +02:00
|
|
|
############################################################################
|
2024-01-17 14:31:45 +01:00
|
|
|
# QSkinny - Copyright (C) The authors
|
2023-04-06 09:23:37 +02:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2023-04-05 17:47:15 +02:00
|
|
|
############################################################################
|
|
|
|
|
|
|
|
macro(qsk_setup_Qt)
|
|
|
|
|
2024-01-17 11:47:21 +01:00
|
|
|
# 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)
|
2023-04-05 17:47:15 +02:00
|
|
|
|
2024-01-08 16:06:43 +01:00
|
|
|
if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6)
|
|
|
|
# we need the qsb tool for Qt6
|
|
|
|
find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
|
|
|
|
endif()
|
|
|
|
|
2023-04-05 17:47:15 +02:00
|
|
|
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)
|
2024-09-13 10:27:13 +02:00
|
|
|
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
|
|
|
OPTIONAL_COMPONENTS WebEngine)
|
|
|
|
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
|
|
|
OPTIONAL_COMPONENTS QuickShapes)
|
|
|
|
|
2023-04-05 17:47:15 +02:00
|
|
|
set( Qt5WebEngineQuick_FOUND ${Qt5WebEngine_FOUND} )
|
2024-09-13 10:27:13 +02:00
|
|
|
set( Qt5QuickShapesPrivate_FOUND ${Qt5QuickShapes_FOUND} )
|
2023-04-05 17:47:15 +02:00
|
|
|
else()
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
|
|
|
OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick)
|
2024-09-13 10:27:13 +02:00
|
|
|
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
|
|
|
OPTIONAL_COMPONENTS QuickShapesPrivate)
|
2025-01-07 16:02:59 +01:00
|
|
|
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
|
|
|
OPTIONAL_COMPONENTS QuickDialogs2Utils QuickDialogs2 )
|
2023-04-05 17:47:15 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if( NOT Qt${QT_VERSION_MAJOR}WebEngineQuick_FOUND)
|
|
|
|
message(STATUS "No Qt/Quick WebEngine support: skipping some unimportant examples")
|
|
|
|
endif()
|
2024-09-13 10:27:13 +02:00
|
|
|
|
|
|
|
if (NOT Qt${QT_VERSION_MAJOR}QuickShapesPrivate_FOUND)
|
|
|
|
message(STATUS "No Qt/Quick Shapes support: skipping some unimportant examples")
|
|
|
|
endif()
|
2025-01-07 16:02:59 +01:00
|
|
|
|
|
|
|
if( NOT Qt${QT_VERSION_MAJOR}QuickDialogs2_FOUND)
|
|
|
|
message(STATUS "No Qt/Quick Dialogs2 support: skipping some unimportant examples")
|
|
|
|
endif()
|
2023-04-05 17:47:15 +02:00
|
|
|
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()
|