-
-
Notifications
You must be signed in to change notification settings - Fork 294
/
CMakeLists.txt
172 lines (129 loc) · 4.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
############################################################################
# QSkinny - Copyright (C) The authors
# SPDX-License-Identifier: BSD-3-Clause
############################################################################
cmake_minimum_required(VERSION 3.16.3)
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)
option(BUILD_TOOLS "Build qskinny tools" ON)
option(BUILD_INPUTCONTEXT "Build virtual keyboard support" ON)
option(BUILD_EXAMPLES "Build qskinny examples" ON)
option(BUILD_PLAYGROUND "Build qskinny playground" ON)
# we actually want to use cmake_dependent_option - minimum cmake version ??
option( BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON )
if( NOT BUILD_TOOLS )
set( BUILD_SVG2QVG_STANDALONE OFF )
endif()
if( NOT BUILD_INPUTCONTEXT )
set( ENABLE_PINYIN OFF )
set( ENABLE_HUNSPELL OFF )
endif()
option(ENABLE_ENSURE_SKINS "Examples add skins manually, when not finding plugins" ON)
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()
macro(qsk_setup_install)
# package vars
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
set(PACKAGE_NAMESPACE Qsk::)
set(PACKAGE_LOCATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
# install paths for headers and libraries
string(TOLOWER "${PROJECT_NAME}" PACKAGE_DIR)
set(QSK_INSTALL_HEADERS ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_DIR})
set(QSK_INSTALL_LIBS ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_DIR})
endmacro()
############################################################################
# QSkinny
############################################################################
project(QSkinny
LANGUAGES C CXX
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
VERSION 0.8.0)
set(QSK_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
set(QSK_CMAKE_DIR ${QSK_SOURCE_DIR}/cmake)
qsk_setup_options()
include(GNUInstallDirs)
# loading helper macros
list(APPEND CMAKE_MODULE_PATH ${QSK_CMAKE_DIR})
include("QskConfigMacros")
include("QskFindMacros")
include("QskBuildFunctions")
qsk_setup_Qt()
qsk_setup_build()
qsk_setup_install()
add_subdirectory(src)
add_subdirectory(designsystems)
include(CMakePackageConfigHelpers)
# write QSkinnyConfigVersion.cmake file for cmake import
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}ConfigVersion.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion)
# Copy QSkinnyConfig.cmake to build dir
configure_file(${QSK_CMAKE_DIR}/${PACKAGE_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake
COPYONLY)
# install QSkinnyConfig.cmake and QSkinnyConfigVersion.cmake
# file to lib/cmake/QSkinny directory
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}ConfigVersion.cmake
DESTINATION
${PACKAGE_LOCATION}
COMPONENT
Devel)
# install cmake helper scripts
install(
FILES
${QSK_CMAKE_DIR}/scripts/QSkinnySvg2Qvg.lin.sh
${QSK_CMAKE_DIR}/scripts/QSkinnySvg2Qvg.mac.sh
${QSK_CMAKE_DIR}/scripts/QSkinnySvg2Qvg.win.bat
DESTINATION
${PACKAGE_LOCATION}/scripts
PERMISSIONS
OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
COMPONENT
Devel)
# Build other libraries
if(BUILD_QML_EXPORT)
add_subdirectory(qmlexport)
endif()
if(BUILD_INPUTCONTEXT)
add_subdirectory(inputcontext)
endif()
if(BUILD_EXAMPLES OR BUILD_PLAYGROUND)
add_subdirectory(support)
endif()
if(BUILD_TOOLS)
add_subdirectory(tools)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(BUILD_PLAYGROUND)
add_subdirectory(playground)
endif()