2016-10-08 19:07:28 +02:00
|
|
|
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
|
|
|
|
2019-02-06 17:32:10 +01:00
|
|
|
if (NOT BASIC_PROJECT_CONFIG_DONE)
|
2017-02-20 20:04:33 +01:00
|
|
|
message(FATAL_ERROR "Before including the QtGuiConfig module, the BasicConfig module must be included.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
if (QT_CONFIGURED)
|
2017-02-20 20:04:33 +01:00
|
|
|
message(FATAL_ERROR "The QtGuiConfig module can not be included when Qt usage has already been configured.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
if (TARGET_CONFIG_DONE)
|
2017-02-11 02:31:43 +01:00
|
|
|
message(FATAL_ERROR "Can not include QtGuiConfig module when targets are already configured.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2017-02-11 02:31:43 +01:00
|
|
|
|
2019-04-04 19:13:30 +02:00
|
|
|
if (NOT WIDGETS_GUI AND NOT QUICK_GUI)
|
|
|
|
message(STATUS "GUI is completely disabled.")
|
|
|
|
return()
|
2019-05-04 20:59:19 +02:00
|
|
|
endif ()
|
2019-04-04 19:13:30 +02:00
|
|
|
|
|
|
|
list(APPEND ADDITIONAL_QT_MODULES Gui)
|
|
|
|
|
2016-04-16 00:50:31 +02:00
|
|
|
# enable Qt Widgets GUI
|
2019-02-06 17:32:10 +01:00
|
|
|
if (WIDGETS_GUI)
|
2017-04-27 22:03:37 +02:00
|
|
|
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS GUI_QTWIDGETS)
|
|
|
|
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_GUI_QTWIDGETS)
|
2019-02-06 17:32:10 +01:00
|
|
|
list(APPEND WIDGETS_FILES
|
|
|
|
${WIDGETS_HEADER_FILES}
|
|
|
|
${WIDGETS_SRC_FILES}
|
|
|
|
${WIDGETS_RES_FILES}
|
|
|
|
${WIDGETS_UI_FILES})
|
2016-04-16 18:32:56 +02:00
|
|
|
list(APPEND ADDITIONAL_HEADER_FILES ${WIDGETS_HEADER_FILES})
|
2019-02-06 17:32:10 +01:00
|
|
|
if (WIDGETS_FILES)
|
2016-04-16 00:50:31 +02:00
|
|
|
list(APPEND ADDITIONAL_QT_MODULES Widgets)
|
|
|
|
message(STATUS "Building with Qt Widgets GUI.")
|
2019-02-06 17:32:10 +01:00
|
|
|
else ()
|
2016-04-16 00:50:31 +02:00
|
|
|
message(STATUS "Qt Widgets GUI is not available.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
else ()
|
2016-07-10 00:22:20 +02:00
|
|
|
message(STATUS "Building WITHOUT Qt Widgets GUI.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2016-04-16 00:50:31 +02:00
|
|
|
|
|
|
|
# enable Qt Quick GUI
|
2019-02-06 17:32:10 +01:00
|
|
|
if (QUICK_GUI)
|
2016-11-08 19:57:57 +01:00
|
|
|
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS GUI_QTQUICK)
|
2017-04-27 22:03:37 +02:00
|
|
|
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_GUI_QTQUICK)
|
2019-02-06 17:32:10 +01:00
|
|
|
list(APPEND QML_FILES
|
|
|
|
${QML_HEADER_FILES}
|
|
|
|
${QML_SRC_FILES}
|
|
|
|
${QML_RES_FILES})
|
2016-04-16 18:32:56 +02:00
|
|
|
list(APPEND ADDITIONAL_HEADER_FILES ${QML_HEADER_FILES})
|
2019-02-06 17:32:10 +01:00
|
|
|
if (QML_FILES)
|
2018-08-31 22:45:24 +02:00
|
|
|
list(APPEND ADDITIONAL_QT_MODULES Qml Quick)
|
2016-07-16 23:12:02 +02:00
|
|
|
list(APPEND ADDITIONAL_QT_REPOS "declarative")
|
2016-04-16 00:50:31 +02:00
|
|
|
message(STATUS "Building with Qt Quick GUI.")
|
2018-05-23 23:20:58 +02:00
|
|
|
|
|
|
|
# enable QML debugging
|
2019-02-06 17:32:10 +01:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2018-05-23 23:20:58 +02:00
|
|
|
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS QT_QML_DEBUG)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2018-06-16 13:11:18 +02:00
|
|
|
|
|
|
|
# enable Qt Quick Controls 2
|
2019-02-06 17:32:10 +01:00
|
|
|
if (META_USE_QQC2)
|
2018-06-16 13:11:18 +02:00
|
|
|
list(APPEND ADDITIONAL_QT_MODULES QuickControls2)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
else ()
|
2016-04-16 00:50:31 +02:00
|
|
|
message(STATUS "Qt Quick GUI is not available.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
else ()
|
2016-07-10 00:22:20 +02:00
|
|
|
message(STATUS "Building WITHOUT Qt Quick GUI.")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2016-04-16 00:50:31 +02:00
|
|
|
|
2019-04-04 19:13:30 +02:00
|
|
|
# set platform-specific GUI-type
|
|
|
|
if (WIN32)
|
|
|
|
# set "GUI-type" to WIN32 to hide console under Windows
|
|
|
|
set(GUI_TYPE WIN32)
|
|
|
|
elseif (APPLE)
|
|
|
|
# make the GUI application a "bundle" under MacOSX
|
|
|
|
set(GUI_TYPE MACOSX_BUNDLE)
|
|
|
|
endif ()
|
2016-07-27 18:51:25 +02:00
|
|
|
|
2019-04-04 19:13:30 +02:00
|
|
|
# add source files requried by both GUI variants
|
|
|
|
list(APPEND SRC_FILES ${GUI_SRC_FILES})
|
|
|
|
list(APPEND ADDITIONAL_HEADER_FILES ${GUI_HEADER_FILES})
|
2016-08-19 16:16:10 +02:00
|
|
|
|
2019-04-04 19:13:30 +02:00
|
|
|
# add option for enabling/disabling static Qt plugins
|
|
|
|
option(SVG_SUPPORT "whether to link against the SVG image format plugin (only relevant when using static Qt)" ON)
|
|
|
|
option(SVG_ICON_SUPPORT "whether to link against the SVG icon engine (only relevant when using static Qt)" ON)
|
2019-06-01 12:15:48 +02:00
|
|
|
set(IMAGE_FORMAT_SUPPORT
|
|
|
|
"Gif;ICO;Jpeg"
|
2019-04-04 19:13:30 +02:00
|
|
|
CACHE STRING "specifies the image format plugins to link against (only relevant when using static Qt)")
|
2018-09-15 21:59:47 +02:00
|
|
|
|
2019-04-04 19:13:30 +02:00
|
|
|
# always enable the Svg module under Android
|
|
|
|
if (ANDROID)
|
|
|
|
list(APPEND ADDITIONAL_QT_MODULES Svg)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|