cmake files reorganized
This commit is contained in:
parent
832345ff22
commit
4df68aec3e
|
|
@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.16.3) # unclear - TODO
|
|||
|
||||
macro(qsk_setup_options)
|
||||
|
||||
option(BUILD_PEDANTIC "Enable pedantic compile flags ( only GNU/CLANG )" OFF)
|
||||
option(BUILD_QSKDLL "Build libs ( not plugins ) as shared library" ON)
|
||||
option(BUILD_QML_EXPORT "Exporting QSkinny to QML" ON)
|
||||
|
||||
|
|
@ -31,6 +32,35 @@ macro(qsk_setup_options)
|
|||
|
||||
endmacro()
|
||||
|
||||
macro(qsk_setup_build)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC OFF)
|
||||
set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF)
|
||||
set(AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/autogen")
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
qsk_initialize_build_flags()
|
||||
|
||||
if ( BUILD_PEDANTIC )
|
||||
message( STATUS "Setting pedantic compiler flags" )
|
||||
qsk_enable_pedantic_flags()
|
||||
endif()
|
||||
|
||||
# Loading individual settings from a file that is
|
||||
# propagated by the environmant variable QSK_LOCAL_CMAKE_RULES
|
||||
# This is a leftover from the previous qmake build environment.
|
||||
# Let's if we can do this using cmake standard mechanisms TODO ...
|
||||
|
||||
qsk_load_optional_build_flags()
|
||||
|
||||
# Finalizing after processing QSK_LOCAL_CMAKE_RULES
|
||||
qsk_finalize_build_flags()
|
||||
|
||||
endmacro()
|
||||
|
||||
############################################################################
|
||||
# QSkinny
|
||||
############################################################################
|
||||
|
|
@ -40,17 +70,19 @@ project(QSkinny
|
|||
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
|
||||
VERSION 999.99.9)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
qsk_setup_options()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# loading helper macros
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
include("QskFindQt")
|
||||
include("QskAutogen")
|
||||
include("QskBuild")
|
||||
include("QskConfigMacros")
|
||||
include("QskFindMacros")
|
||||
include("QskBuildFunctions")
|
||||
|
||||
qsk_setup_Qt()
|
||||
qsk_setup_build()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(skins)
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKG_HUNSPELL QUIET hunspell)
|
||||
find_path(HUNSPELL_INCLUDE_DIRS
|
||||
NAMES hunspell.hxx
|
||||
PATH_SUFFIXES hunspell
|
||||
HINTS ${PKG_HUNSPELL_INCLUDE_DIRS})
|
||||
find_library(HUNSPELL_LIBRARIES
|
||||
NAMES ${PKG_HUNSPELL_LIBRARIES} hunspell hunspell-1.8 hunspell-1.7 hunspell-1.6 libhunspell
|
||||
HINTS ${PKG_HUNSPELL_LIBRARY_DIRS})
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HUNSPELL
|
||||
REQUIRED_VARS HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIRS
|
||||
VERSION_VAR PKG_HUNSPELL_VERSION)
|
||||
mark_as_advanced(HUNSPELL_INCLUDE_DIRS HUNSPELL_LIBRARIES)
|
||||
|
||||
add_library(hunspell SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(hunspell PROPERTIES IMPORTED_LOCATION ${HUNSPELL_LIBRARIES})
|
||||
target_include_directories(hunspell
|
||||
INTERFACE
|
||||
${HUNSPELL_INCLUDE_DIRS})
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
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)
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC OFF)
|
||||
set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF)
|
||||
set(AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/autogen")
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# TODO find compiler flag equivalent
|
||||
list(APPEND CONFIG warn_on)
|
||||
#list(APPEND CONFIG -= depend_includepath) # TODO was -=
|
||||
list(APPEND CONFIG pedantic)
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
|
||||
add_compile_definitions(QT_NO_KEYWORDS)
|
||||
|
||||
if ("pedantic" IN_LIST CONFIG)
|
||||
|
||||
if(QT_VERSION_MAJOR VERSION_EQUAL "5")
|
||||
add_compile_definitions(QT_STRICT_ITERATORS)
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*linux-g\\+\\+" OR "${CMAKE_CXX_COMPILER}" MATCHES ".*linux-g\\+\\+-64")
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -pedantic-errors)
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wextra)
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Werror=format-security)
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wsuggest-override)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wlogical-op)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wconversion)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wfloat-equal)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wshadow)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wsuggest-final-types)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wsuggest-final-methods)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fanalyzer)
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*linux-clang")
|
||||
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -pedantic-errors)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Weverything)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-c++98-compat-pedantic)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-global-constructors)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-padded)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-float-equal)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-undefined-reinterpret-cast)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-deprecated)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-switch-enum)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-keyword-macro)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-old-style-cast)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-used-but-marked-unused)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-weak-vtables)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-shadow)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-double-promotion)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-conversion)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-documentation-unknown-command)
|
||||
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-unused-macros)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000
|
||||
|
||||
if( DEFINED ENV{QSK_LOCAL_CMAKE_RULES} )
|
||||
|
||||
# When not working with the Qt/Creator it is often more convenient
|
||||
# to include the specific options of your local build, than passing
|
||||
# them all on the command line
|
||||
|
||||
set(LOCAL_RULES $ENV{QSK_LOCAL_CMAKE_RULES})
|
||||
|
||||
if(NOT "${LOCAL_RULES}" STREQUAL "")
|
||||
|
||||
if(EXISTS ${LOCAL_RULES})
|
||||
message(STATUS "Loading build options from: ${LOCAL_RULES}")
|
||||
include(${LOCAL_RULES})
|
||||
else()
|
||||
message(Warning "Loading build options from: ${LOCAL_RULES}" - Failed)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
message( STATUS "Build Type: ${CMAKE_BUILD_TYPE}" )
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_compile_definitions(ITEM_STATISTICS=1)
|
||||
endif()
|
||||
|
||||
if( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") )
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_compile_options(-O0)
|
||||
else()
|
||||
add_compile_options(-O3)
|
||||
endif()
|
||||
|
||||
add_compile_options(-ffast-math)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if ( NOT "${ECM_ENABLE_SANITIZERS}" STREQUAL "")
|
||||
|
||||
# see: https://api.kde.org/ecm/module/ECMEnableSanitizers.html
|
||||
#
|
||||
# a semicolon-separated list of sanitizers:
|
||||
# - address
|
||||
# - memory
|
||||
# - thread
|
||||
# - leak
|
||||
# - undefined
|
||||
# - fuzzer
|
||||
#
|
||||
# where “address”, “memory” and “thread” are mutually exclusive
|
||||
# f.e: set(ECM_ENABLE_SANITIZERS address;leak;undefined)
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/ECMEnableSanitizers.cmake)
|
||||
|
||||
endif()
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
macro(qsk_load_optional_build_flags)
|
||||
|
||||
if( DEFINED ENV{QSK_LOCAL_CMAKE_RULES} )
|
||||
|
||||
# When not working with the Qt/Creator it is often more convenient
|
||||
# to include the specific options of your local build, than passing
|
||||
# them all on the command line
|
||||
|
||||
set(LOCAL_RULES $ENV{QSK_LOCAL_CMAKE_RULES})
|
||||
|
||||
if(NOT "${LOCAL_RULES}" STREQUAL "")
|
||||
|
||||
if(EXISTS ${LOCAL_RULES})
|
||||
message(STATUS "Loading build options from: ${LOCAL_RULES}")
|
||||
include(${LOCAL_RULES})
|
||||
else()
|
||||
message(Warning "Loading build options from: ${LOCAL_RULES}" - Failed)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(qsk_enable_pedantic_flags)
|
||||
|
||||
if(QT_VERSION_MAJOR VERSION_EQUAL 5)
|
||||
add_compile_definitions(QT_STRICT_ITERATORS)
|
||||
endif()
|
||||
|
||||
if ( ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
|
||||
OR ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
|
||||
|
||||
add_compile_options( -pedantic)
|
||||
add_compile_options( -pedantic-errors)
|
||||
|
||||
add_compile_options( -Wformat -Werror=format-security)
|
||||
add_compile_options( -Wsuggest-override)
|
||||
|
||||
add_compile_options( -Wextra-semi )
|
||||
add_compile_options( -Winline )
|
||||
|
||||
add_compile_options( -Wmissing-declarations )
|
||||
add_compile_options( -Wredundant-decls )
|
||||
|
||||
add_compile_options( -Wnon-virtual-dtor )
|
||||
add_compile_options( -Weffc++ )
|
||||
add_compile_options( -Woverloaded-virtual )
|
||||
add_compile_options( -Wfloat-equal )
|
||||
|
||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
|
||||
|
||||
add_compile_options( -Wsuggest-attribute=pure)
|
||||
add_compile_options( -Wsuggest-attribute=const)
|
||||
add_compile_options( -Wsuggest-attribute=noreturn)
|
||||
add_compile_options( -Wsuggest-attribute=malloc)
|
||||
add_compile_options( -Wsuggest-final-types)
|
||||
add_compile_options( -Wsuggest-final-methods)
|
||||
|
||||
add_compile_options( -Wduplicated-branches )
|
||||
add_compile_options( -Wduplicated-cond )
|
||||
add_compile_options( -Wshadow=local)
|
||||
|
||||
# we have a lot of useless casts, when qreal is a double,
|
||||
# that are needed when qreal is a float.
|
||||
|
||||
# add_compile_options( -Wuseless-cast )
|
||||
|
||||
add_compile_options( -Wlogical-op)
|
||||
add_compile_options( -Wclass-memaccess )
|
||||
|
||||
elseif ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
|
||||
add_compile_options( -Weverything)
|
||||
add_compile_options( -Wno-c++98-compat)
|
||||
add_compile_options( -Wno-c++98-compat-pedantic )
|
||||
add_compile_options( -Wno-global-constructors )
|
||||
|
||||
# We have a lot of dummy destructors with the intention to
|
||||
# - a breakpoint for the debugger
|
||||
# - being able to add some debug statements without recompiling
|
||||
# - preparation for binary compatible changes
|
||||
# Needs to be reconsidered: TODO ...
|
||||
add_compile_options( -Wno-deprecated-copy-with-user-provided-dtor )
|
||||
|
||||
add_compile_options( -Wno-signed-enum-bitfield )
|
||||
add_compile_options( -Wno-padded )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(qsk_initialize_build_flags)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
|
||||
add_compile_definitions(QT_NO_KEYWORDS)
|
||||
# add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x000000)
|
||||
|
||||
if ( NOT MSVC )
|
||||
add_compile_options( -Wall -Wextra )
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(qsk_finalize_build_flags)
|
||||
|
||||
message( STATUS "Build Type: ${CMAKE_BUILD_TYPE}" )
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_compile_definitions(ITEM_STATISTICS=1)
|
||||
endif()
|
||||
|
||||
if( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") )
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_compile_options(-O0)
|
||||
else()
|
||||
add_compile_options(-O3)
|
||||
endif()
|
||||
|
||||
add_compile_options(-ffast-math)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if ( NOT "${ECM_ENABLE_SANITIZERS}" STREQUAL "")
|
||||
|
||||
# see: https://api.kde.org/ecm/module/ECMEnableSanitizers.html
|
||||
#
|
||||
# a semicolon-separated list of sanitizers:
|
||||
# - address
|
||||
# - memory
|
||||
# - thread
|
||||
# - leak
|
||||
# - undefined
|
||||
# - fuzzer
|
||||
#
|
||||
# where “address”, “memory” and “thread” are mutually exclusive
|
||||
# f.e: set(ECM_ENABLE_SANITIZERS address;leak;undefined)
|
||||
|
||||
include(ECMEnableSanitizers)
|
||||
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
macro(qsk_setup_Qt)
|
||||
|
||||
# Often users have several Qt installations on their system and
|
||||
# need to be able to explicitly the one to be used. Let's see if
|
||||
# standard cmake features are good enough or if we need to introduce
|
||||
# something sort of additional option. TODO ...
|
||||
|
||||
find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick)
|
||||
|
||||
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)
|
||||
set( Qt5WebEngineQuick_FOUND ${Qt5WebEngine_FOUND} )
|
||||
else()
|
||||
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
||||
OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick)
|
||||
endif()
|
||||
|
||||
if( NOT Qt${QT_VERSION_MAJOR}WebEngineQuick_FOUND)
|
||||
message(STATUS "No Qt/Quick WebEngine support: skipping some unimportant examples")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(qsk_setup_Hunspell)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKG_HUNSPELL QUIET hunspell)
|
||||
find_path(HUNSPELL_INCLUDE_DIRS
|
||||
NAMES hunspell.hxx
|
||||
PATH_SUFFIXES hunspell
|
||||
HINTS ${PKG_HUNSPELL_INCLUDE_DIRS})
|
||||
|
||||
find_library(HUNSPELL_LIBRARIES
|
||||
NAMES ${PKG_HUNSPELL_LIBRARIES} hunspell hunspell-1.8 hunspell-1.7 hunspell-1.6 libhunspell
|
||||
HINTS ${PKG_HUNSPELL_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HUNSPELL
|
||||
REQUIRED_VARS HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIRS
|
||||
VERSION_VAR PKG_HUNSPELL_VERSION)
|
||||
|
||||
mark_as_advanced(HUNSPELL_INCLUDE_DIRS HUNSPELL_LIBRARIES)
|
||||
|
||||
add_library(hunspell SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(hunspell PROPERTIES IMPORTED_LOCATION ${HUNSPELL_LIBRARIES})
|
||||
target_include_directories(hunspell INTERFACE ${HUNSPELL_INCLUDE_DIRS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(qsk_setup_Pinyin)
|
||||
|
||||
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()
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
############################################################################
|
||||
# QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
# Often users have several Qt installations on their system and
|
||||
# need to be able to explicitly the one to be used. Let's see if
|
||||
# standard cmake features are good enough or if we need to introduce
|
||||
# something sort of additional option. TODO ...
|
||||
|
||||
find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick)
|
||||
|
||||
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)
|
||||
set( Qt5WebEngineQuick_FOUND ${Qt5WebEngine_FOUND} )
|
||||
else()
|
||||
find_package(Qt${QT_VERSION_MAJOR} QUIET
|
||||
OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick)
|
||||
endif()
|
||||
|
||||
if( NOT Qt${QT_VERSION_MAJOR}WebEngineQuick_FOUND)
|
||||
message(STATUS "No Qt/Quick WebEngine support: skipping some unimportant examples")
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -16,7 +16,7 @@ endif()
|
|||
set(SOURCES QskInputContextGlobal.h QskInputContextPlugin.cpp)
|
||||
|
||||
if(ENABLE_PINYIN)
|
||||
include("QSkinnyOptionalPinyin")
|
||||
qsk_setup_Pinyin()
|
||||
|
||||
list(APPEND SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h
|
||||
|
|
@ -25,7 +25,7 @@ if(ENABLE_PINYIN)
|
|||
endif()
|
||||
|
||||
if(ENABLE_HUNSPELL)
|
||||
include("QSkinnyOptionalHunspell")
|
||||
qsk_setup_Hunspell()
|
||||
|
||||
list(APPEND SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
############################################################################
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/QSkinnyMacros.cmake)
|
||||
|
||||
list(APPEND HEADERS
|
||||
common/QskArcMetrics.h
|
||||
common/QskAspect.h
|
||||
|
|
|
|||
Loading…
Reference in New Issue