cmake files reorganized
This commit is contained in:
parent
5fd8535eae
commit
3fd951ab1c
|
@ -5,63 +5,44 @@ project(QSkinny
|
||||||
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
|
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
|
||||||
VERSION 999.99.9)
|
VERSION 999.99.9)
|
||||||
|
|
||||||
|
option(BUILD_QSKDLL
|
||||||
|
"Build qskinny as shared library" ON)
|
||||||
|
|
||||||
|
option(BUILD_TOOLS "Build qskinny tools" ON)
|
||||||
|
option(BUILD_EXAMPLES "Build qskinny examples" ON)
|
||||||
|
option(BUILD_PLAYGROUND "Build qskinny playground" ON)
|
||||||
|
option(BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON)
|
||||||
|
|
||||||
|
option(ENABLE_PINYIN "UNIX: Enable romanization system for standard mandarin chinese" OFF)
|
||||||
|
option(ENABLE_HUNSPELL "UNIX: Enable spell checker" OFF)
|
||||||
|
option(ENABLE_ENSURE_SKINS "Examples will load skins manually, when not finding plugins" ON)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
#set(CMAKE_FIND_DEBUG_MODE TRUE)
|
#set(CMAKE_FIND_DEBUG_MODE TRUE)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
|
||||||
|
|
||||||
if ( QT_FOUND )
|
|
||||||
message(STATUS "Found Qt ${QT_VERSION} ${_qt_cmake_dir}")
|
|
||||||
|
|
||||||
if(QT_VERSION VERSION_LESS "5.15.0")
|
|
||||||
message(FATAL_ERROR "Couldn't find any Qt >= 5.15 !")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Couldn't find any Qt package !")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Note, that modules might be found in different places.
|
|
||||||
# f.e. when having Qt installations that have only been built
|
|
||||||
# with a subset of modules
|
|
||||||
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui OpenGL Quick )
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Svg)
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
include("QskFindQt")
|
||||||
|
include("QskAutogen")
|
||||||
include("QskBuild")
|
include("QskBuild")
|
||||||
|
|
||||||
# optional package hunspell
|
|
||||||
if(NOT LINUX AND ENABLE_HUNSPELL)
|
|
||||||
message(WARNING "Feature 'hunspell' only available for UNIX!")
|
|
||||||
unset(ENABLE_HUNSPELL CACHE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# optional package pinyin
|
|
||||||
if(NOT LINUX AND ENABLE_PINYIN)
|
|
||||||
message(WARNING "Feature 'pinyin' only available for UNIX!")
|
|
||||||
unset(ENABLE_PINYIN CACHE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_HUNSPELL)
|
|
||||||
include("QSkinnyOptionalHunspell")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_PINYIN)
|
|
||||||
include("QSkinnyOptionalPinyin")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(skins)
|
add_subdirectory(skins)
|
||||||
add_subdirectory(inputcontext)
|
add_subdirectory(inputcontext)
|
||||||
add_subdirectory(qmlexport)
|
add_subdirectory(qmlexport)
|
||||||
add_subdirectory(tools)
|
|
||||||
|
if(BUILD_EXAMPLES OR BUILD_EXAMPLES)
|
||||||
add_subdirectory(support)
|
add_subdirectory(support)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_TOLLS)
|
||||||
|
add_subdirectory(tools)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_EXAMPLES)
|
if(BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_PLAYGROUND)
|
if(BUILD_PLAYGROUND)
|
||||||
add_subdirectory(playground)
|
add_subdirectory(playground)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
############################################################################
|
||||||
|
# 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")
|
|
@ -3,12 +3,6 @@
|
||||||
# This file may be used under the terms of the QSkinny License, Version 1.0
|
# 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")
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
@ -24,16 +18,6 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
|
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
|
||||||
|
|
||||||
option(BUILD_QSKDLL "Build qskinny as shared library" ON)
|
|
||||||
option(BUILD_EXAMPLES "Build qskinny examples" ON)
|
|
||||||
option(BUILD_PLAYGROUND "Build qskinny playground" ON)
|
|
||||||
option(BUILD_SVG2QVG_STANDALONE "If 'ON' application won't be linked against qskinny library" ON)
|
|
||||||
option(ENABLE_PINYIN "UNIX ONLY OPTION: Enable romanization system for standard mandarin chinese" OFF)
|
|
||||||
option(ENABLE_HUNSPELL "UNIX ONLY OPTION: Enable spell checker" OFF)
|
|
||||||
option(ENABLE_FONT_CONFIG "Enable font config for font caching" ON)
|
|
||||||
option(ENABLE_ENSURE_SKINS "Enabling fall back code, that inserts some skin factories manually when not finding skin factories as plugins" ON)
|
|
||||||
option(ENABLE_AUTOQVG "enable automatic qvg compilation" OFF)
|
|
||||||
|
|
||||||
if ("pedantic" IN_LIST CONFIG)
|
if ("pedantic" IN_LIST CONFIG)
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR VERSION_EQUAL "5")
|
if(QT_VERSION_MAJOR VERSION_EQUAL "5")
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
############################################################################
|
||||||
|
# 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 NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
||||||
|
|
||||||
|
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
|
||||||
|
# All I found was
|
||||||
|
|
||||||
|
message(STATUS "Found Qt ${QT_VERSION} ${_qt_cmake_dir}")
|
||||||
|
|
||||||
|
if(QT_VERSION VERSION_LESS "5.15.0")
|
||||||
|
message(FATAL_ERROR "Couldn't find any Qt >= 5.15 !")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find any Qt package !")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Not sure if using find_package here is a good idea.
|
||||||
|
# In situations, where the Qt installation that has been found
|
||||||
|
# above has not been built with all modules we might end up with modules
|
||||||
|
# from other Qt installations/versions. Might be better to limit
|
||||||
|
# finding packages from the same package. TODO ...
|
||||||
|
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui OpenGL Quick )
|
||||||
|
|
||||||
|
if( BUILD_TOOLS )
|
||||||
|
# needed for building the svg2qvg tool
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Svg)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# some examples need additional modules
|
||||||
|
|
||||||
|
if( BUILD_EXAMPLES OR BUILD_PLAYGROUND )
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS QuickWidgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_PLAYGROUND)
|
||||||
|
if (QT_VERSION_MAJOR VERSION_LESS 6)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WebEngine)
|
||||||
|
else()
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WebEngineCore WebEngineQuick)
|
||||||
|
endif()
|
||||||
|
endif()
|
|
@ -4,7 +4,19 @@ list(APPEND HEADERS QskInputContextGlobal.h)
|
||||||
list(APPEND SOURCES QskInputContextPlugin.cpp)
|
list(APPEND SOURCES QskInputContextPlugin.cpp)
|
||||||
list(APPEND OTHER_FILES metadata.json)
|
list(APPEND OTHER_FILES metadata.json)
|
||||||
|
|
||||||
|
if(NOT LINUX AND ENABLE_HUNSPELL)
|
||||||
|
message(WARNING "Feature 'hunspell' only available for UNIX!")
|
||||||
|
unset(ENABLE_HUNSPELL CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT LINUX AND ENABLE_PINYIN)
|
||||||
|
message(WARNING "Feature 'pinyin' only available for UNIX!")
|
||||||
|
unset(ENABLE_PINYIN CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_PINYIN)
|
if(ENABLE_PINYIN)
|
||||||
|
include("QSkinnyOptionalPinyin")
|
||||||
|
|
||||||
list(APPEND HEADERS
|
list(APPEND HEADERS
|
||||||
${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h)
|
${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h)
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
|
@ -12,6 +24,8 @@ if(ENABLE_PINYIN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_HUNSPELL)
|
if(ENABLE_HUNSPELL)
|
||||||
|
include("QSkinnyOptionalHunspell")
|
||||||
|
|
||||||
list(APPEND HEADERS
|
list(APPEND HEADERS
|
||||||
${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h)
|
${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h)
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
|
|
|
@ -19,7 +19,17 @@ else()
|
||||||
qsk_add_library(${TARGET_NAME} STATIC ${TARGET_SOURCES} ${TARGET_HEADERS})
|
qsk_add_library(${TARGET_NAME} STATIC ${TARGET_SOURCES} ${TARGET_HEADERS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_FONT_CONFIG)
|
set(HACK_FONT_CONFIG ON)
|
||||||
|
|
||||||
|
if(HACK_FONT_CONFIG)
|
||||||
|
|
||||||
|
message( STATUS "Building an dummy fontconfig enviroment for faster startups" )
|
||||||
|
|
||||||
|
# On systems where many fonts are installed we have a significant effect
|
||||||
|
# on the startup performance when building the font cache. To avoid this
|
||||||
|
# penalty we configure an empty environment
|
||||||
|
# ( this code should be moved to a cmake function TODO ...
|
||||||
|
|
||||||
set(QSK_FONTDIR ${CMAKE_CURRENT_LIST_DIR}/fonts)
|
set(QSK_FONTDIR ${CMAKE_CURRENT_LIST_DIR}/fonts)
|
||||||
set(QSK_FONTCACHEDIR ${CMAKE_CURRENT_BINARY_DIR}/fontconfig)
|
set(QSK_FONTCACHEDIR ${CMAKE_CURRENT_BINARY_DIR}/fontconfig)
|
||||||
set(QSK_FONTCONF_FILE ${QSK_FONTCACHEDIR}/fonts.conf)
|
set(QSK_FONTCONF_FILE ${QSK_FONTCACHEDIR}/fonts.conf)
|
||||||
|
|
Loading…
Reference in New Issue