blob: a62252783ade424109606f4b6ff1dcd2509f40d3 (
plain)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
##
# MAIN CONFIGURE
##
get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." REALPATH)
get_filename_component(WEBENGINE_ROOT_BUILD_DIR "${PROJECT_BINARY_DIR}" REALPATH)
# Note this is configure that does not belong to any module
qt_feature_module_begin(ONLY_EVALUATE_FEATURES)
# Enable printing of feature summary by forcing qt_configure_record_command
# to work in spite of ONLY_EVALUATE_FEATURES.
set(__QtFeature_only_evaluate_features OFF)
include(../configure.cmake)
qt_feature_module_end(ONLY_EVALUATE_FEATURES)
##
# SUPPORT CHECK
##
# TODO: here we should return FATAL_ERROR and ask user to define
# FEATURE_qtwebenignebuild=OFF if one wants to only build qtpdf,
# however our ci setup is not flexible enough and configure step must succeed
if(NOT ${QtWebEngine_SUPPORT})
add_custom_target(WebEngineErrorMessage ALL
${CMAKE_COMMAND} -E cmake_echo_color --red "QtWebEngine will not be built: ${QtWebEngine_ERROR}"
COMMENT "Check QtWebEngine support"
VERBATIM
)
message("-- Support check for QtWebEngine failed: ${QtWebEngine_ERROR}")
set(QT_FEATURE_qtwebengine_build OFF CACHE BOOL "Build QtWebEngine Modules" FORCE)
set(QT_FEATURE_qtwebengine_core_build OFF CACHE BOOL "Build QtWebEngineCore" FORCE)
set(QT_FEATURE_qtwebengine_widgets_build OFF CACHE BOOL "Build QtWebEngineWidgets" FORCE)
set(QT_FEATURE_qtwebengine_quick_build OFF CACHE BOOL "Build QtWebEngineQuick" FORCE)
endif()
if(NOT ${QtPdf_SUPPORT})
add_custom_target(PdfErrorMessage ALL
${CMAKE_COMMAND} -E cmake_echo_color --red "QtPdf will not be built: ${QtPdf_ERROR}"
COMMENT "Check QtPdf support"
VERBATIM
)
message("-- Support check for QtPdf failed: ${QtPdf_ERROR}")
set(QT_FEATURE_qtpdf_build OFF CACHE BOOL "Build QtPdf" FORCE)
set(QT_FEATURE_qtpdf_widgets_build OFF CACHE BOOL "Build QtPdfWidgets" FORCE)
set(QT_FEATURE_qtpdf_quick_build OFF CACHE BOOL "Build QtPdfQuick" FORCE)
endif()
if(NOT QT_FEATURE_qtwebengine_build AND NOT QT_FEATURE_qtpdf_build)
return()
endif()
# Upgrade CMake policies to the minimum supported version.
cmake_minimum_required(VERSION ${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_WEBENGINE})
##
# MODULES
##
if(QT_FEATURE_qtwebengine_core_build)
add_subdirectory(core)
add_subdirectory(process)
endif()
if(QT_FEATURE_qtwebengine_widgets_build)
add_subdirectory(webenginewidgets)
endif()
if(QT_FEATURE_qtwebengine_quick_build)
add_subdirectory(webenginequick)
endif()
if(QT_FEATURE_qtpdf_build)
add_subdirectory(pdf)
# keep log order, pdf build after webengine
if(QT_FEATURE_qtwebengine_core_build)
add_dependencies(run_pdf_NinjaReady WebEngineCore)
endif()
if(QT_FEATURE_qtwebengine_widgets_build)
add_dependencies(run_pdf_NinjaReady WebEngineWidgets)
endif()
if(QT_FEATURE_qtwebengine_quick_build)
add_dependencies(run_pdf_NinjaReady WebEngineQuick)
endif()
if(QT_FEATURE_qtpdf_widgets_build)
add_subdirectory(pdfwidgets)
endif()
if(QT_FEATURE_qtpdf_quick_build)
add_subdirectory(pdfquick)
endif()
endif()
##
# NINJA PROJECT
##
set(installDir ${PROJECT_BINARY_DIR}/install)
if(NOT Ninja_FOUND)
externalproject_add(ninja
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ninja
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ninja
INSTALL_DIR ${installDir}
PREFIX ninja
USES_TERMINAL_BUILD TRUE
EXCLUDE_FROM_ALL TRUE
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_PREFIX_PATH:PATH=<INSTALL_DIR>
)
if(QT_FEATURE_qtwebengine_core_build)
add_dependencies(run_core_NinjaReady ninja)
endif()
if(QT_FEATURE_qtpdf_build)
add_dependencies(run_pdf_NinjaReady ninja)
endif()
endif()
##
# GN PROJECT
##
if(CMAKE_CROSSCOMPILING AND NOT Gn_FOUND)
message(FATAL_ERROR "No gn found for cross-compilation")
endif()
if(NOT Gn_FOUND)
externalproject_add(gn
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/gn
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gn
INSTALL_DIR ${installDir}
PREFIX gn
USES_TERMINAL_BUILD TRUE
EXCLUDE_FROM_ALL TRUE
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_PREFIX_PATH:PATH=<INSTALL_DIR>
-DWEBENGINE_ROOT_BUILD_DIR=${PROJECT_BINARY_DIR}
)
if(QT_FEATURE_qtwebengine_core_build)
add_dependencies(run_core_GnReady gn)
endif()
if(QT_FEATURE_qtpdf_build)
add_dependencies(run_pdf_GnReady gn)
endif()
endif()
if(NOT Gn_FOUND OR Gn_EXECUTABLE MATCHES "^${installDir}")
set(INSTALL_GN 1 CACHE INTERNAL "")
endif()
##
# HOST PROJECT
##
if(CMAKE_CROSSCOMPILING AND NOT IOS AND NOT MACOS)
if(NOT Gn_FOUND)
message(FATAL_ERROR "\nHost gn not found - cross compilation not possible")
endif()
externalproject_add(hostBuild
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/host
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/host
PREFIX host
USES_TERMINAL_BUILD TRUE
EXCLUDE_FROM_ALL TRUE
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${QT_HOST_PATH}/lib/cmake/Qt6/qt.toolchain.cmake
-DWEBENGINE_ROOT_BUILD_DIR=${PROJECT_BINARY_DIR}
-DWEBENGINE_ROOT_SOURCE_DIR=${WEBENGINE_ROOT_SOURCE_DIR}
-DGN_TARGET_CPU=${TEST_architecture_arch}
-DCMAKE_C_FLAGS=
-DCMAKE_CXX_FLAGS=
-DQT_FEATURE_qtwebengine_build=${QT_FEATURE_qtwebengine_build}
-DQT_FEATURE_qtpdf_build=${QT_FEATURE_qtpdf_build}
)
if(QT_FEATURE_qtwebengine_build)
add_dependencies(run_core_GnReady hostBuild)
endif()
if(QT_FEATURE_qtpdf_build)
add_dependencies(run_pdf_GnReady hostBuild)
endif()
endif()
# install gn for cross build
if((LINUX OR MACOS) AND INSTALL_GN)
get_install_config(installConfig)
install(
PROGRAMS ${installDir}/bin/gn
CONFIGURATIONS ${installConfig}
RUNTIME DESTINATION "${INSTALL_LIBEXECDIR}"
)
if(NOT QT_WILL_INSTALL)
add_custom_target(copy-gn ALL DEPENDS
${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/gn
)
if(Gn_FOUND)
set(copyDep ${Gn_EXECUTABLE})
else()
set(copyDep gn)
endif()
add_custom_command(
OUTPUT ${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/gn
COMMAND ${CMAKE_COMMAND} -E copy ${installDir}/bin/gn
${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}
DEPENDS ${copyDep}
USES_TERMINAL
)
endif()
endif()
|