Apply cmake-format
This commit is contained in:
parent
72d642c892
commit
190e58fe67
115
CMakeLists.txt
115
CMakeLists.txt
|
@ -6,7 +6,8 @@ set(META_PROJECT_VARNAME QT_UTILITIES)
|
|||
set(META_APP_NAME "Qt Utilities")
|
||||
set(META_APP_AUTHOR "Martchus")
|
||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
set(META_APP_DESCRIPTION "Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
||||
set(META_APP_DESCRIPTION
|
||||
"Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
||||
set(META_VERSION_MAJOR 5)
|
||||
set(META_VERSION_MINOR 12)
|
||||
set(META_VERSION_PATCH 1)
|
||||
|
@ -24,18 +25,14 @@ set(HEADER_FILES
|
|||
models/checklistmodel.h
|
||||
resources/qtconfigarguments.h
|
||||
resources/resources.h
|
||||
resources/importplugin.h
|
||||
)
|
||||
resources/importplugin.h)
|
||||
set(SRC_FILES
|
||||
misc/dialogutils.cpp
|
||||
misc/desktoputils.cpp
|
||||
models/checklistmodel.cpp
|
||||
resources/qtconfigarguments.cpp
|
||||
resources/resources.cpp
|
||||
)
|
||||
set(RES_FILES
|
||||
resources/qtutilsicons.qrc
|
||||
)
|
||||
resources/resources.cpp)
|
||||
set(RES_FILES resources/qtutilsicons.qrc)
|
||||
|
||||
set(WIDGETS_HEADER_FILES
|
||||
aboutdialog/aboutdialog.h
|
||||
|
@ -55,8 +52,7 @@ set(WIDGETS_HEADER_FILES
|
|||
widgets/pathselection.h
|
||||
paletteeditor/paletteeditor.h
|
||||
paletteeditor/colorbutton.h
|
||||
misc/recentmenumanager.h
|
||||
)
|
||||
misc/recentmenumanager.h)
|
||||
set(WIDGETS_SRC_FILES
|
||||
aboutdialog/aboutdialog.cpp
|
||||
enterpassworddialog/enterpassworddialog.cpp
|
||||
|
@ -75,8 +71,7 @@ set(WIDGETS_SRC_FILES
|
|||
widgets/pathselection.cpp
|
||||
paletteeditor/paletteeditor.cpp
|
||||
paletteeditor/colorbutton.cpp
|
||||
misc/recentmenumanager.cpp
|
||||
)
|
||||
misc/recentmenumanager.cpp)
|
||||
set(WIDGETS_UI_FILES
|
||||
aboutdialog/aboutdialog.ui
|
||||
enterpassworddialog/enterpassworddialog.ui
|
||||
|
@ -84,8 +79,7 @@ set(WIDGETS_UI_FILES
|
|||
settingsdialog/qtappearanceoptionpage.ui
|
||||
settingsdialog/qtlanguageoptionpage.ui
|
||||
settingsdialog/qtenvoptionpage.ui
|
||||
paletteeditor/paletteeditor.ui
|
||||
)
|
||||
paletteeditor/paletteeditor.ui)
|
||||
|
||||
set(CMAKE_MODULE_FILES
|
||||
cmake/modules/AndroidApk.cmake
|
||||
|
@ -93,31 +87,21 @@ set(CMAKE_MODULE_FILES
|
|||
cmake/modules/QtGuiConfig.cmake
|
||||
cmake/modules/QtLinkage.cmake
|
||||
cmake/modules/JsProviderConfig.cmake
|
||||
cmake/modules/WebViewProviderConfig.cmake
|
||||
)
|
||||
cmake/modules/WebViewProviderConfig.cmake)
|
||||
set(CMAKE_TEMPLATE_FILES
|
||||
cmake/templates/qtconfig.h.in
|
||||
cmake/templates/webviewdefs.h.in
|
||||
cmake/templates/webviewincludes.h.in
|
||||
cmake/templates/jsdefs.h.in
|
||||
cmake/templates/jsincludes.h.in
|
||||
)
|
||||
if(ANDROID)
|
||||
list(APPEND CMAKE_MODULE_FILES
|
||||
)
|
||||
list(APPEND CMAKE_TEMPLATE_FILES
|
||||
cmake/templates/android-deployment.json.in
|
||||
)
|
||||
endif()
|
||||
cmake/templates/jsincludes.h.in)
|
||||
if (ANDROID)
|
||||
list(APPEND CMAKE_MODULE_FILES)
|
||||
list(APPEND CMAKE_TEMPLATE_FILES cmake/templates/android-deployment.json.in)
|
||||
endif ()
|
||||
|
||||
set(TS_FILES
|
||||
translations/${META_PROJECT_NAME}_de_DE.ts
|
||||
translations/${META_PROJECT_NAME}_en_US.ts
|
||||
)
|
||||
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
|
||||
|
||||
set(DOC_FILES
|
||||
README.md
|
||||
)
|
||||
set(DOC_FILES README.md)
|
||||
|
||||
set(REQUIRED_ICONS
|
||||
dialog-cancel
|
||||
|
@ -133,71 +117,58 @@ set(REQUIRED_ICONS
|
|||
system-file-manager
|
||||
system-run
|
||||
system-search
|
||||
window-close
|
||||
)
|
||||
window-close)
|
||||
|
||||
set(SCRIPT_FILES
|
||||
scripts/required_icons.sh
|
||||
)
|
||||
set(SCRIPT_FILES scripts/required_icons.sh)
|
||||
|
||||
# required to include CMake modules from own project directory
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${CMAKE_MODULE_PATH}")
|
||||
|
||||
# configure platform specific capslock detection for enterpassworddialog.cpp
|
||||
if(WIN32 OR (UNIX AND NOT APPLE AND NOT ANDROID))
|
||||
if (WIN32 OR (UNIX AND NOT APPLE AND NOT ANDROID))
|
||||
set(ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT ON)
|
||||
else()
|
||||
else ()
|
||||
set(ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT OFF)
|
||||
endif()
|
||||
endif ()
|
||||
option(CAPSLOCK_DETECTION "enables capslock detection" ${ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT})
|
||||
if(CAPSLOCK_DETECTION)
|
||||
if(WIN32)
|
||||
if (CAPSLOCK_DETECTION)
|
||||
if (WIN32)
|
||||
# WinAPI provides functions to provide capslock detection
|
||||
set(HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION ON)
|
||||
else()
|
||||
else ()
|
||||
# X11 can provide functions for capslock detection under non-Windows environments
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
if (X11_FOUND)
|
||||
list(APPEND LIBRARIES ${X11_LIBRARIES})
|
||||
set(HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION ON)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
||||
message(FATAL_ERROR "No backend for capslock detection found (WinAPI or X11 must be provided)")
|
||||
endif()
|
||||
set_property(
|
||||
SOURCE enterpassworddialog/enterpassworddialog.cpp
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION
|
||||
)
|
||||
endif()
|
||||
endif ()
|
||||
set_property(SOURCE enterpassworddialog/enterpassworddialog.cpp
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
||||
endif ()
|
||||
|
||||
# configure support for D-Bus notifications
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
set(ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT ON)
|
||||
else()
|
||||
else ()
|
||||
set(ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT OFF)
|
||||
endif()
|
||||
endif ()
|
||||
option(DBUS_NOTIFICATIONS "enables support for D-Bus notifications" ${ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT})
|
||||
set(DBUS_NOTIFICATIONS_FILE_NAME misc/dbusnotification)
|
||||
if(DBUS_NOTIFICATIONS)
|
||||
list(APPEND HEADER_FILES
|
||||
${DBUS_NOTIFICATIONS_FILE_NAME}.h
|
||||
)
|
||||
list(APPEND SRC_FILES
|
||||
${DBUS_NOTIFICATIONS_FILE_NAME}.cpp
|
||||
)
|
||||
list(APPEND DBUS_FILES
|
||||
dbus/org.freedesktop.Notifications.xml
|
||||
)
|
||||
if (DBUS_NOTIFICATIONS)
|
||||
list(APPEND HEADER_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.h)
|
||||
list(APPEND SRC_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.cpp)
|
||||
list(APPEND DBUS_FILES dbus/org.freedesktop.Notifications.xml)
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_SUPPORT_DBUS_NOTIFICATIONS)
|
||||
message(STATUS "D-Bus notifications enabled")
|
||||
else()
|
||||
list(APPEND DOC_ONLY_FILES
|
||||
${DBUS_NOTIFICATIONS_FILE_NAME}.h
|
||||
${DBUS_NOTIFICATIONS_FILE_NAME}.cpp
|
||||
)
|
||||
else ()
|
||||
list(APPEND DOC_ONLY_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.h ${DBUS_NOTIFICATIONS_FILE_NAME}.cpp)
|
||||
message(STATUS "D-Bus notifications disabled")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# find c++utilities
|
||||
find_package(c++utilities 4.13.0 REQUIRED)
|
||||
|
|
|
@ -2,37 +2,39 @@ cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
|||
|
||||
# add a target to create an Android API with the help of androiddeployqt if target platform is Android
|
||||
|
||||
if(NOT ANDROID)
|
||||
if (NOT ANDROID)
|
||||
return()
|
||||
endif()
|
||||
if(NOT BASIC_PROJECT_CONFIG_DONE OR NOT QT_CONFIGURED)
|
||||
endif ()
|
||||
if (NOT BASIC_PROJECT_CONFIG_DONE OR NOT QT_CONFIGURED)
|
||||
message(FATAL_ERROR "Before including the ApkConfig module, the AppTarget module and QtConfig module must be included.")
|
||||
endif()
|
||||
if(ANDROID_APK_CONFIGURED)
|
||||
endif ()
|
||||
if (ANDROID_APK_CONFIGURED)
|
||||
message(FATAL_ERROR "The AndroidApk module mustn't be included twice.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT EXISTS "${CMAKE_ANDROID_SDK}")
|
||||
if (NOT EXISTS "${CMAKE_ANDROID_SDK}")
|
||||
message(FATAL_ERROR "CMAKE_ANDROID_SDK must contain the path of the Android SDK.")
|
||||
endif()
|
||||
if(NOT EXISTS "${CMAKE_ANDROID_NDK}")
|
||||
endif ()
|
||||
if (NOT EXISTS "${CMAKE_ANDROID_NDK}")
|
||||
message(FATAL_ERROR "CMAKE_ANDROID_NDK must contain the path of the Android NDK.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# find "android" subdirectory in the source directory and check for AndroidManifest.xml
|
||||
set(ANDROID_APK_SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
if(NOT IS_DIRECTORY "${ANDROID_APK_SUBDIR}")
|
||||
message(FATAL_ERROR "The directory containing Android-specific files is expected to be \"${ANDROID_APK_SUBDIR}\" but doesn't exist.")
|
||||
endif()
|
||||
if (NOT IS_DIRECTORY "${ANDROID_APK_SUBDIR}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"The directory containing Android-specific files is expected to be \"${ANDROID_APK_SUBDIR}\" but doesn't exist.")
|
||||
endif ()
|
||||
set(ANDROID_APK_MANIFEST_PATH "${ANDROID_APK_SUBDIR}/AndroidManifest.xml")
|
||||
if(NOT EXISTS "${ANDROID_APK_MANIFEST_PATH}")
|
||||
if (NOT EXISTS "${ANDROID_APK_MANIFEST_PATH}")
|
||||
message(FATAL_ERROR "The Android manifest doesn't exist at \"${ANDROID_APK_SUBDIR}/AndroidManifest.xml\".")
|
||||
endif()
|
||||
endif ()
|
||||
# caveat: adding new files or removing files requires to re-run CMake manually
|
||||
file(GLOB_RECURSE ANDROID_APK_FILES
|
||||
LIST_DIRECTORIES false
|
||||
"${ANDROID_APK_SUBDIR}/*"
|
||||
)
|
||||
LIST_DIRECTORIES
|
||||
false
|
||||
"${ANDROID_APK_SUBDIR}/*")
|
||||
|
||||
# make subdirectory to store build artefacts for APK
|
||||
set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk")
|
||||
|
@ -45,105 +47,101 @@ get_filename_component(ANDROID_APK_QT_INSTALL_PREFIX "${ANDROID_APK_QT_LIBRARY_D
|
|||
|
||||
# deduce Android toolchain prefix and version from "CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX"
|
||||
message(STATUS "Android toolchain prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
|
||||
if(CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX MATCHES ".*/(.+)-")
|
||||
if (CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX MATCHES ".*/(.+)-")
|
||||
set(ANDROID_APK_TOOL_PREFIX "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
else ()
|
||||
set(ANDROID_APK_TOOL_PREFIX "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set(ANDROID_APK_TOOLCHAIN_VERSION "" CACHE STRING "toolchain version for making APK file")
|
||||
if(NOT ANDROID_APK_TOOLCHAIN_VERSION)
|
||||
if(CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX MATCHES ".*/.+-linux-android-([^/]+)/.*")
|
||||
if (NOT ANDROID_APK_TOOLCHAIN_VERSION)
|
||||
if (CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX MATCHES ".*/.+-linux-android-([^/]+)/.*")
|
||||
set(ANDROID_APK_TOOLCHAIN_VERSION "${CMAKE_MATCH_1}")
|
||||
elseif(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang.*")
|
||||
elseif (NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang.*")
|
||||
set(ANDROID_APK_TOOLCHAIN_VERSION "${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}")
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "Unable to detect the toolchain version for making the APK.")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# determine Android build tools version
|
||||
# note: Assuming the build tools are installed under "${CMAKE_ANDROID_SDK}/build-tools"
|
||||
file(GLOB ANDROID_APK_BUILD_TOOLS_VERSIONS
|
||||
LIST_DIRECTORIES TRUE
|
||||
RELATIVE "${CMAKE_ANDROID_SDK}/build-tools"
|
||||
"${CMAKE_ANDROID_SDK}/build-tools/*"
|
||||
)
|
||||
if(NOT ANDROID_APK_BUILD_TOOLS_VERSIONS)
|
||||
# determine Android build tools version note: Assuming the build tools are installed under "${CMAKE_ANDROID_SDK}/build-tools"
|
||||
file(GLOB ANDROID_APK_BUILD_TOOLS_VERSIONS LIST_DIRECTORIES TRUE
|
||||
RELATIVE "${CMAKE_ANDROID_SDK}/build-tools" "${CMAKE_ANDROID_SDK}/build-tools/*")
|
||||
if (NOT ANDROID_APK_BUILD_TOOLS_VERSIONS)
|
||||
message(FATAL_ERROR "No build-tools present under \"${CMAKE_ANDROID_SDK}/build-tools\".")
|
||||
endif()
|
||||
endif ()
|
||||
list(GET ANDROID_APK_BUILD_TOOLS_VERSIONS 0 ANDROID_APK_BUILD_TOOLS_VERSION)
|
||||
|
||||
# deduce path of C++ standard library from "CMAKE_CXX_STANDARD_LIBRARIES"
|
||||
# note: Assuming CMAKE_CXX_STANDARD_LIBRARIES contains a paths or quotes paths with flags appended.
|
||||
# deduce path of C++ standard library from "CMAKE_CXX_STANDARD_LIBRARIES" note: Assuming CMAKE_CXX_STANDARD_LIBRARIES
|
||||
# contains a paths or quotes paths with flags appended.
|
||||
set(ANDROID_APK_CXX_STANDARD_LIBRARY "" CACHE STRING "path to standard library for making APK file")
|
||||
if(NOT ANDROID_APK_CXX_STANDARD_LIBRARY)
|
||||
foreach(CMAKE_CXX_STANDARD_LIBRARY ${CMAKE_CXX_STANDARD_LIBRARIES})
|
||||
if(EXISTS "${CMAKE_CXX_STANDARD_LIBRARY}")
|
||||
if (NOT ANDROID_APK_CXX_STANDARD_LIBRARY)
|
||||
foreach (CMAKE_CXX_STANDARD_LIBRARY ${CMAKE_CXX_STANDARD_LIBRARIES})
|
||||
if (EXISTS "${CMAKE_CXX_STANDARD_LIBRARY}")
|
||||
set(ANDROID_APK_CXX_STANDARD_LIBRARY "${CMAKE_CXX_STANDARD_LIBRARY}")
|
||||
break()
|
||||
elseif(CMAKE_CXX_STANDARD_LIBRARY MATCHES "\"(.*)\".*")
|
||||
if(EXISTS "${CMAKE_MATCH_1}")
|
||||
elseif (CMAKE_CXX_STANDARD_LIBRARY MATCHES "\"(.*)\".*")
|
||||
if (EXISTS "${CMAKE_MATCH_1}")
|
||||
set(ANDROID_APK_CXX_STANDARD_LIBRARY "${CMAKE_MATCH_1}")
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
message(WARNING "${CMAKE_CXX_STANDARD_LIBRARY} from CMAKE_CXX_STANDARD_LIBRARIES does not exist.")
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT ANDROID_APK_CXX_STANDARD_LIBRARY)
|
||||
endforeach ()
|
||||
endif ()
|
||||
if (NOT ANDROID_APK_CXX_STANDARD_LIBRARY)
|
||||
message(FATAL_ERROR "CMAKE_CXX_STANDARD_LIBRARIES does not contain path to standard library.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# determine extra prefix dirs
|
||||
set(ANDROID_APK_BINARY_DIRS "${RUNTIME_LIBRARY_PATH}")
|
||||
if(NOT CMAKE_CURRENT_BINARY_DIR IN_LIST ANDROID_APK_BINARY_DIRS)
|
||||
if (NOT CMAKE_CURRENT_BINARY_DIR IN_LIST ANDROID_APK_BINARY_DIRS)
|
||||
list(APPEND ANDROID_APK_BINARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
endif ()
|
||||
set(ANDROID_APK_BINARY_DIRS_DEPENDS "")
|
||||
foreach(PATH ${ANDROID_APK_BINARY_DIRS})
|
||||
# symlink "lib" subdirectory so androiddeployqt finds the library in the runtime path
|
||||
# when specified via "extraPrefixDirs"
|
||||
foreach (PATH ${ANDROID_APK_BINARY_DIRS})
|
||||
# symlink "lib" subdirectory so androiddeployqt finds the library in the runtime path when specified via
|
||||
# "extraPrefixDirs"
|
||||
list(APPEND ANDROID_APK_BINARY_DIRS_DEPENDS "${PATH}/lib")
|
||||
add_custom_command(
|
||||
OUTPUT "${PATH}/lib"
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PATH}" "${PATH}/lib"
|
||||
)
|
||||
endforeach()
|
||||
add_custom_command(OUTPUT "${PATH}/lib"
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PATH}" "${PATH}/lib")
|
||||
endforeach ()
|
||||
include(ListToString)
|
||||
list_to_string("" "\n \"" "\"," "${ANDROID_APK_BINARY_DIRS}" ANDROID_APK_BINARY_DIRS)
|
||||
|
||||
# find dependencies
|
||||
# note: androiddeployqt seems to find only Qt libraries and plugins but misses other target_link_libraries
|
||||
# find dependencies note: androiddeployqt seems to find only Qt libraries and plugins but misses other target_link_libraries
|
||||
set(ANDROID_APK_ADDITIONAL_LIBS "" CACHE STRING "additional libraries to be bundled into the Android APK")
|
||||
set(ANDROID_APK_EXTRA_LIBS "${ANDROID_APK_ADDITIONAL_LIBS}")
|
||||
function(add_android_apk_extra_libs TARGET_NAME)
|
||||
function (add_android_apk_extra_libs TARGET_NAME)
|
||||
get_target_property(ANDROID_APK_EXTRA_LIBS_FOR_TARGET ${TARGET_NAME} LINK_LIBRARIES)
|
||||
if(NOT ANDROID_APK_EXTRA_LIBS_FOR_TARGET)
|
||||
if (NOT ANDROID_APK_EXTRA_LIBS_FOR_TARGET)
|
||||
return()
|
||||
endif()
|
||||
foreach(LIBRARY ${ANDROID_APK_EXTRA_LIBS_FOR_TARGET})
|
||||
if(TARGET "${LIBRARY}")
|
||||
endif ()
|
||||
foreach (LIBRARY ${ANDROID_APK_EXTRA_LIBS_FOR_TARGET})
|
||||
if (TARGET "${LIBRARY}")
|
||||
list(APPEND ANDROID_APK_EXTRA_LIBS "\$<TARGET_FILE:${LIBRARY}>")
|
||||
add_android_apk_extra_libs(${LIBRARY})
|
||||
elseif(EXISTS "${LIBRARY}")
|
||||
elseif (EXISTS "${LIBRARY}")
|
||||
list(APPEND ANDROID_APK_EXTRA_LIBS "${LIBRARY}")
|
||||
else()
|
||||
message(WARNING "Unable to find library \"${LIBRARY}\" required by target \"${TARGET_NAME}\". It won't be added to the APK.")
|
||||
endif()
|
||||
endforeach()
|
||||
else ()
|
||||
message(
|
||||
WARNING
|
||||
"Unable to find library \"${LIBRARY}\" required by target \"${TARGET_NAME}\". It won't be added to the APK."
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
set(ANDROID_APK_EXTRA_LIBS "${ANDROID_APK_EXTRA_LIBS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endfunction ()
|
||||
add_android_apk_extra_libs("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
list_to_string("," "" "" "${ANDROID_APK_EXTRA_LIBS}" ANDROID_APK_EXTRA_LIBS)
|
||||
|
||||
# query certain qmake variables
|
||||
foreach(QMAKE_VARIABLE QT_INSTALL_QML QT_INSTALL_PLUGINS QT_INSTALL_IMPORTS)
|
||||
foreach (QMAKE_VARIABLE QT_INSTALL_QML QT_INSTALL_PLUGINS QT_INSTALL_IMPORTS)
|
||||
query_qmake_variable(${QMAKE_VARIABLE})
|
||||
endforeach()
|
||||
endforeach ()
|
||||
|
||||
# define function to get a list of (existing) paths
|
||||
function(compose_dirs_for_android_apk)
|
||||
function (compose_dirs_for_android_apk)
|
||||
# parse arguments
|
||||
set(OPTIONAL_ARGS)
|
||||
set(ONE_VALUE_ARGS OUTPUT_VARIABLE)
|
||||
|
@ -152,161 +150,148 @@ function(compose_dirs_for_android_apk)
|
|||
|
||||
list(REMOVE_DUPLICATES ARGS_POSSIBLE_DIRS)
|
||||
unset(DIRS)
|
||||
foreach(POSSIBLE_DIR ${ARGS_POSSIBLE_DIRS})
|
||||
if(IS_DIRECTORY "${POSSIBLE_DIR}")
|
||||
foreach (POSSIBLE_DIR ${ARGS_POSSIBLE_DIRS})
|
||||
if (IS_DIRECTORY "${POSSIBLE_DIR}")
|
||||
list(APPEND DIRS "${POSSIBLE_DIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list_to_string("," "" "" "${DIRS}" DIRS)
|
||||
set("${ARGS_OUTPUT_VARIABLE}" "${DIRS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endfunction ()
|
||||
|
||||
# pick QML import paths from install prefix
|
||||
compose_dirs_for_android_apk(
|
||||
OUTPUT_VARIABLE ANDROID_APK_QML_IMPORT_DIRS
|
||||
POSSIBLE_DIRS
|
||||
"${QT_INSTALL_IMPORTS}"
|
||||
"${QT_INSTALL_QML}"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/imports"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/imports"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qml"
|
||||
)
|
||||
if(NOT ANDROID_APK_QML_IMPORT_DIRS)
|
||||
compose_dirs_for_android_apk(OUTPUT_VARIABLE
|
||||
ANDROID_APK_QML_IMPORT_DIRS
|
||||
POSSIBLE_DIRS
|
||||
"${QT_INSTALL_IMPORTS}"
|
||||
"${QT_INSTALL_QML}"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/imports"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/imports"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qml")
|
||||
if (NOT ANDROID_APK_QML_IMPORT_DIRS)
|
||||
message(WARNING "Unable to find QML import directories for making the APK.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# pick extra plugins from install prefix
|
||||
compose_dirs_for_android_apk(
|
||||
OUTPUT_VARIABLE ANDROID_APK_EXTRA_PLUGIN_DIRS
|
||||
POSSIBLE_DIRS
|
||||
"${QT_INSTALL_PLUGINS}"
|
||||
"${QT_INSTALL_QML}"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/plugins"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/plugins"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/share"
|
||||
)
|
||||
if(NOT ANDROID_APK_EXTRA_PLUGIN_DIRS)
|
||||
compose_dirs_for_android_apk(OUTPUT_VARIABLE
|
||||
ANDROID_APK_EXTRA_PLUGIN_DIRS
|
||||
POSSIBLE_DIRS
|
||||
"${QT_INSTALL_PLUGINS}"
|
||||
"${QT_INSTALL_QML}"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/plugins"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/plugins"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/share")
|
||||
if (NOT ANDROID_APK_EXTRA_PLUGIN_DIRS)
|
||||
message(WARNING "Unable to find extra plugin directories for making the APK.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# find template for deployment JSON
|
||||
find_template_file("android-deployment.json" QT_UTILITIES ANDROID_DEPLOYMENT_JSON_TEMPLATE_FILE)
|
||||
set(ANDROID_DEPLOYMENT_JSON_FILE "${CMAKE_CURRENT_BINARY_DIR}/android-deployment.json")
|
||||
configure_file(
|
||||
"${ANDROID_DEPLOYMENT_JSON_TEMPLATE_FILE}"
|
||||
"${ANDROID_DEPLOYMENT_JSON_FILE}.configured"
|
||||
)
|
||||
file(GENERATE
|
||||
OUTPUT "${ANDROID_DEPLOYMENT_JSON_FILE}"
|
||||
INPUT "${ANDROID_DEPLOYMENT_JSON_FILE}.configured"
|
||||
)
|
||||
configure_file("${ANDROID_DEPLOYMENT_JSON_TEMPLATE_FILE}" "${ANDROID_DEPLOYMENT_JSON_FILE}.configured")
|
||||
file(GENERATE OUTPUT "${ANDROID_DEPLOYMENT_JSON_FILE}" INPUT "${ANDROID_DEPLOYMENT_JSON_FILE}.configured")
|
||||
|
||||
# pass make arguments
|
||||
if (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
||||
set(MAKE_ARGUMENTS "\\$(ARGS)")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# add rules to make APK
|
||||
option(ANDROID_APK_FORCE_DEBUG "specifies whether a debug APK should be created even when building in release mode" OFF)
|
||||
if (Qt5Core_VERSION VERSION_LESS 5.12.0)
|
||||
set(ANDROID_APK_FILE_DIRECTORY "")
|
||||
else()
|
||||
if(ANDROID_APK_FORCE_DEBUG OR CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
else ()
|
||||
if (ANDROID_APK_FORCE_DEBUG OR CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(ANDROID_APK_FILE_DIRECTORY "debug/")
|
||||
else()
|
||||
else ()
|
||||
set(ANDROID_APK_FILE_DIRECTORY "release/")
|
||||
endif()
|
||||
endif()
|
||||
if(ANDROID_APK_FORCE_DEBUG OR CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
endif ()
|
||||
endif ()
|
||||
if (ANDROID_APK_FORCE_DEBUG OR CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(ANDROID_APK_FILE_PATH "${ANDROID_APK_BUILD_DIR}/build/outputs/apk/${ANDROID_APK_FILE_DIRECTORY}apk-debug.apk")
|
||||
set(ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS)
|
||||
else()
|
||||
else ()
|
||||
set(ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS --release)
|
||||
set(ANDROID_APK_KEYSTORE_URL "" CACHE STRING "keystore URL for signing the Android APK")
|
||||
set(ANDROID_APK_KEYSTORE_ALIAS "" CACHE STRING "keystore alias for signing the Android APK")
|
||||
set(ANDROID_APK_KEYSTORE_PASSWORD "" CACHE STRING "keystore password for signing the Android APK")
|
||||
set(ANDROID_APK_KEYSTORE_KEY_PASSWORD "" CACHE STRING "keystore key password for signing the Android APK")
|
||||
|
||||
if(ANDROID_APK_KEYSTORE_URL AND ANDROID_APK_KEYSTORE_ALIAS)
|
||||
set(ANDROID_APK_FILE_PATH "${ANDROID_APK_BUILD_DIR}/build/outputs/apk/${ANDROID_APK_FILE_DIRECTORY}apk-release-signed.apk")
|
||||
if (ANDROID_APK_KEYSTORE_URL AND ANDROID_APK_KEYSTORE_ALIAS)
|
||||
set(ANDROID_APK_FILE_PATH
|
||||
"${ANDROID_APK_BUILD_DIR}/build/outputs/apk/${ANDROID_APK_FILE_DIRECTORY}apk-release-signed.apk")
|
||||
list(APPEND ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS
|
||||
--sign "${ANDROID_APK_KEYSTORE_URL}" "${ANDROID_APK_KEYSTORE_ALIAS}")
|
||||
if(ANDROID_APK_KEYSTORE_PASSWORD)
|
||||
list(APPEND ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS
|
||||
--storepass "${ANDROID_APK_KEYSTORE_PASSWORD}")
|
||||
endif()
|
||||
if(ANDROID_APK_KEYSTORE_KEY_PASSWORD)
|
||||
list(APPEND ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS
|
||||
--keypass "${ANDROID_APK_KEYSTORE_KEY_PASSWORD}")
|
||||
endif()
|
||||
else()
|
||||
set(ANDROID_APK_FILE_PATH "${ANDROID_APK_BUILD_DIR}/build/outputs/apk/${ANDROID_APK_FILE_DIRECTORY}apk-release-unsigned.apk")
|
||||
--sign
|
||||
"${ANDROID_APK_KEYSTORE_URL}"
|
||||
"${ANDROID_APK_KEYSTORE_ALIAS}")
|
||||
if (ANDROID_APK_KEYSTORE_PASSWORD)
|
||||
list(APPEND ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS --storepass "${ANDROID_APK_KEYSTORE_PASSWORD}")
|
||||
endif ()
|
||||
if (ANDROID_APK_KEYSTORE_KEY_PASSWORD)
|
||||
list(APPEND ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS --keypass "${ANDROID_APK_KEYSTORE_KEY_PASSWORD}")
|
||||
endif ()
|
||||
else ()
|
||||
set(ANDROID_APK_FILE_PATH
|
||||
"${ANDROID_APK_BUILD_DIR}/build/outputs/apk/${ANDROID_APK_FILE_DIRECTORY}apk-release-unsigned.apk")
|
||||
message(WARNING "Set ANDROID_APK_KEYSTORE_URL/ANDROID_APK_KEYSTORE_ALIAS to sign Android APK release.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
endif()
|
||||
set(ANDROID_APK_BINARY_PATH "${ANDROID_APK_BUILD_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}/lib${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}.so")
|
||||
endif ()
|
||||
set(ANDROID_APK_BINARY_PATH
|
||||
"${ANDROID_APK_BUILD_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}/lib${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}.so")
|
||||
add_custom_command(OUTPUT "${ANDROID_APK_BINARY_PATH}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}>" "${ANDROID_APK_BINARY_PATH}"
|
||||
COMMENT "Preparing build dir for Android APK"
|
||||
DEPENDS "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}"
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_command(OUTPUT "${ANDROID_APK_FILE_PATH}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}>"
|
||||
"${ANDROID_APK_BINARY_PATH}"
|
||||
COMMENT "Preparing build dir for Android APK"
|
||||
DEPENDS "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}" COMMAND_EXPAND_LISTS
|
||||
VERBATIM)
|
||||
add_custom_command(
|
||||
OUTPUT "${ANDROID_APK_FILE_PATH}"
|
||||
COMMAND $<TARGET_FILE_DIR:Qt5::qmake>/androiddeployqt
|
||||
--gradle
|
||||
--input "${ANDROID_DEPLOYMENT_JSON_FILE}"
|
||||
--output "${ANDROID_APK_BUILD_DIR}"
|
||||
--deployment bundled ${MAKE_ARGUMENTS}
|
||||
--verbose
|
||||
${ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS}
|
||||
--gradle
|
||||
--input "${ANDROID_DEPLOYMENT_JSON_FILE}"
|
||||
--output "${ANDROID_APK_BUILD_DIR}"
|
||||
--deployment bundled ${MAKE_ARGUMENTS}
|
||||
--verbose ${ANDROID_APK_ADDITIONAL_ANDROIDDEPOYQT_OPTIONS}
|
||||
WORKING_DIRECTORY "${ANDROID_APK_BUILD_DIR}"
|
||||
COMMENT "Creating Android APK ${ANDROID_APK_FILE_PATH} using androiddeployqt"
|
||||
DEPENDS "${ANDROID_DEPLOYMENT_JSON_FILE};${ANDROID_APK_BINARY_PATH};${ANDROID_APK_FILES};${ANDROID_APK_BINARY_DIRS_DEPENDS}"
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM
|
||||
)
|
||||
DEPENDS
|
||||
"${ANDROID_DEPLOYMENT_JSON_FILE};${ANDROID_APK_BINARY_PATH};${ANDROID_APK_FILES};${ANDROID_APK_BINARY_DIRS_DEPENDS}"
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM)
|
||||
add_custom_target("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apk"
|
||||
COMMENT "Android APK"
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}"
|
||||
)
|
||||
if(NOT TARGET apk)
|
||||
COMMENT "Android APK"
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}")
|
||||
if (NOT TARGET apk)
|
||||
add_custom_target(apk)
|
||||
endif()
|
||||
endif ()
|
||||
add_dependencies(apk "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apk")
|
||||
|
||||
# add install target for APK
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(ANDROID_APK_FINAL_NAME "${META_ID}-debug-${META_APP_VERSION}.apk")
|
||||
else()
|
||||
else ()
|
||||
set(ANDROID_APK_FINAL_NAME "${META_ID}-${META_APP_VERSION}.apk")
|
||||
endif()
|
||||
install(
|
||||
FILES "${ANDROID_APK_FILE_PATH}"
|
||||
DESTINATION "share/apk"
|
||||
RENAME "${ANDROID_APK_FINAL_NAME}"
|
||||
COMPONENT apk
|
||||
)
|
||||
endif ()
|
||||
install(FILES "${ANDROID_APK_FILE_PATH}" DESTINATION "share/apk" RENAME "${ANDROID_APK_FINAL_NAME}" COMPONENT apk)
|
||||
add_custom_target("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_install_apk"
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=apk -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
add_dependencies("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_install_apk" "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apk")
|
||||
if(NOT TARGET install-apk)
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=apk -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
add_dependencies("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_install_apk"
|
||||
"${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apk")
|
||||
if (NOT TARGET install-apk)
|
||||
add_custom_target(install-apk)
|
||||
endif()
|
||||
endif ()
|
||||
add_dependencies(install-apk "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_install_apk")
|
||||
|
||||
# add deploy target for APK
|
||||
find_program(ADB_BIN adb)
|
||||
add_custom_target("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_deploy_apk"
|
||||
COMMAND "${ADB_BIN}" install -r "${ANDROID_APK_FILE_PATH}"
|
||||
COMMENT "Deploying Android APK"
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}"
|
||||
)
|
||||
COMMAND "${ADB_BIN}" install -r "${ANDROID_APK_FILE_PATH}"
|
||||
COMMENT "Deploying Android APK"
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}")
|
||||
|
||||
set(ANDROID_APK_CONFIGURED YES)
|
||||
|
|
|
@ -1,80 +1,75 @@
|
|||
# determines the JavaScript provider (either Qt Script or Qt Declarative)
|
||||
|
||||
if(TARGET_CONFIG_DONE)
|
||||
if (TARGET_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Can not include JsProviderConfig module when targets are already configured.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(QtLinkage)
|
||||
|
||||
set(JS_PROVIDER "auto" CACHE STRING "specifies the JavaScript provider: auto (default), qml, script or none")
|
||||
if(NOT JS_PROVIDER OR "${JS_PROVIDER}" STREQUAL "auto")
|
||||
if (NOT JS_PROVIDER OR "${JS_PROVIDER}" STREQUAL "auto")
|
||||
find_qt5_module(Script OPTIONAL)
|
||||
if(QT5_Script_FOUND)
|
||||
if (QT5_Script_FOUND)
|
||||
set(JS_PROVIDER Script)
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_SCRIPT")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "script")
|
||||
message(STATUS "No JavaScript provider explicitly specified, defaulting to Qt Script.")
|
||||
else()
|
||||
else ()
|
||||
find_qt5_module(Qml OPTIONAL)
|
||||
if(QT5_Qml_FOUND)
|
||||
if (QT5_Qml_FOUND)
|
||||
set(JS_PROVIDER Qml)
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_JSENGINE")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "declarative")
|
||||
message(STATUS "No JavaScript provider explicitly specified, defaulting to Qt QML.")
|
||||
else()
|
||||
else ()
|
||||
set(JS_PROVIDER "")
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_NO_JSENGINE")
|
||||
message(STATUS "No JavaScript provider available, features requiring JavaScript have been disabled.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(${JS_PROVIDER} STREQUAL "script")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
if (${JS_PROVIDER} STREQUAL "script")
|
||||
find_qt5_module(Script REQUIRED)
|
||||
set(JS_PROVIDER Script)
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_SCRIPT")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "script")
|
||||
message(STATUS "Using Qt Script as JavaScript provider.")
|
||||
elseif(${JS_PROVIDER} STREQUAL "qml")
|
||||
elseif (${JS_PROVIDER} STREQUAL "qml")
|
||||
find_qt5_module(Qml REQUIRED)
|
||||
set(JS_PROVIDER Qml)
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_JSENGINE")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "declarative")
|
||||
message(STATUS "Using Qt QML as JavaScript provider.")
|
||||
elseif(${JS_PROVIDER} STREQUAL "none")
|
||||
elseif (${JS_PROVIDER} STREQUAL "none")
|
||||
set(JS_PROVIDER "")
|
||||
set(JS_DEFINITION "${META_PROJECT_VARNAME_UPPER}_NO_JSENGINE")
|
||||
message(STATUS "JavaScript provider has been disabled.")
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "The specified JavaScript provider '${JS_PROVIDER}' is unknown.")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(JS_PROVIDER)
|
||||
if (JS_PROVIDER)
|
||||
use_qt5_module(${JS_PROVIDER} REQUIRED)
|
||||
|
||||
# add header files with some defines/includes to conveniently use the selected provider
|
||||
if(META_JS_SRC_DIR)
|
||||
if (META_JS_SRC_DIR)
|
||||
set(JS_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${META_JS_SRC_DIR}")
|
||||
else()
|
||||
else ()
|
||||
set(JS_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gui")
|
||||
endif()
|
||||
endif ()
|
||||
include(TemplateFinder)
|
||||
find_template_file("jsdefs.h" QT_UTILITIES JS_DEFS_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${JS_DEFS_H_TEMPLATE_FILE}"
|
||||
"${JS_HEADER_DIR}/jsdefs.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
configure_file("${JS_DEFS_H_TEMPLATE_FILE}"
|
||||
"${JS_HEADER_DIR}/jsdefs.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
find_template_file("jsincludes.h" QT_UTILITIES JS_INCLUDES_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${JS_INCLUDES_H_TEMPLATE_FILE}"
|
||||
"${JS_HEADER_DIR}/jsincludes.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
list(APPEND WIDGETS_FILES
|
||||
"${JS_HEADER_DIR}/jsdefs.h"
|
||||
"${JS_HEADER_DIR}/jsincludes.h"
|
||||
)
|
||||
endif()
|
||||
configure_file("${JS_INCLUDES_H_TEMPLATE_FILE}"
|
||||
"${JS_HEADER_DIR}/jsincludes.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
list(APPEND WIDGETS_FILES "${JS_HEADER_DIR}/jsdefs.h" "${JS_HEADER_DIR}/jsincludes.h")
|
||||
endif ()
|
||||
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${JS_DEFINITION})
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
||||
|
||||
# applies Qt specific configuration
|
||||
# for GUI applications, QtGuiAppConfig must be included before
|
||||
# this module must always be included before AppTarget/LibraryTarget
|
||||
# applies Qt specific configuration for GUI applications, QtGuiAppConfig must be included before this module must always be
|
||||
# included before AppTarget/LibraryTarget
|
||||
|
||||
# ensure generated sources are processed by AUTOMOC and AUTOUIC
|
||||
if(POLICY CMP0071)
|
||||
if (POLICY CMP0071)
|
||||
cmake_policy(SET CMP0071 NEW)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT BASIC_PROJECT_CONFIG_DONE)
|
||||
if (NOT BASIC_PROJECT_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Before including the QtConfig module, the BasicConfig module must be included.")
|
||||
endif()
|
||||
if(QT_CONFIGURED)
|
||||
endif ()
|
||||
if (QT_CONFIGURED)
|
||||
message(FATAL_ERROR "The QtConfig module can not be included when Qt usage has already been configured.")
|
||||
endif()
|
||||
if(TARGET_CONFIG_DONE)
|
||||
endif ()
|
||||
if (TARGET_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Can not include QtConfig module when targets are already configured.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# add the Core module as it is always required
|
||||
# also add additional Qt/KF modules which must have been specified before if required
|
||||
# the Gui/Widgets/Quick modules should be added by including QtGuiAppConfig
|
||||
# add the Core module as it is always required also add additional Qt/KF modules which must have been specified before if
|
||||
# required the Gui/Widgets/Quick modules should be added by including QtGuiAppConfig
|
||||
set(QT_REPOS base ${ADDITIONAL_QT_REPOS})
|
||||
set(QT_MODULES ${ADDITIONAL_QT_MODULES} Core)
|
||||
set(KF_MODULES ${ADDITIONAL_KF_MODULES})
|
||||
|
@ -32,122 +30,122 @@ set(QT_PLUGIN_DIR "" CACHE STRING "specifies the directory to install Qt plugins
|
|||
include(QtLinkage)
|
||||
|
||||
# check whether D-Bus interfaces need to be processed
|
||||
if(DBUS_FILES)
|
||||
if (DBUS_FILES)
|
||||
message(STATUS "Project has D-Bus interface declarations which will be processed.")
|
||||
# the D-Bus Qt module is required
|
||||
list(APPEND QT_MODULES DBus)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# remove duplicates
|
||||
list(REMOVE_DUPLICATES QT_REPOS)
|
||||
list(REMOVE_DUPLICATES QT_MODULES)
|
||||
if(IMPORTED_QT_MODULES)
|
||||
if (IMPORTED_QT_MODULES)
|
||||
list(REMOVE_DUPLICATES IMPORTED_QT_MODULES)
|
||||
endif()
|
||||
if(KF_MODULES)
|
||||
endif ()
|
||||
if (KF_MODULES)
|
||||
list(REMOVE_DUPLICATES KF_MODULES)
|
||||
endif()
|
||||
if(IMPORTED_KF_MODULES)
|
||||
endif ()
|
||||
if (IMPORTED_KF_MODULES)
|
||||
list(REMOVE_DUPLICATES IMPORTED_KF_MODULES)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# actually find the required Qt/KF modules
|
||||
foreach(QT_MODULE ${QT_MODULES})
|
||||
foreach (QT_MODULE ${QT_MODULES})
|
||||
# using those helpers allows using static Qt 5 build
|
||||
find_qt5_module(${QT_MODULE} REQUIRED)
|
||||
use_qt5_module(${QT_MODULE} REQUIRED)
|
||||
endforeach()
|
||||
foreach(QT_MODULE ${IMPORTED_QT_MODULES})
|
||||
if(NOT "${QT_MODULE}" IN_LIST QT_MODULES)
|
||||
endforeach ()
|
||||
foreach (QT_MODULE ${IMPORTED_QT_MODULES})
|
||||
if (NOT "${QT_MODULE}" IN_LIST QT_MODULES)
|
||||
find_qt5_module(${QT_MODULE} REQUIRED)
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(KF_MODULE ${KF_MODULES})
|
||||
endif ()
|
||||
endforeach ()
|
||||
foreach (KF_MODULE ${KF_MODULES})
|
||||
# only shared KF5 modules supported
|
||||
find_package(KF5${KF_MODULE} REQUIRED)
|
||||
set(KF5_${KF_MODULE}_DYNAMIC_LIB KF5::${KF_MODULE})
|
||||
link_against_library(KF5_${KF_MODULE} "AUTO_LINKAGE" REQUIRED)
|
||||
endforeach()
|
||||
foreach(KF_MODULE ${IMPORTED_KF_MODULES})
|
||||
if(NOT "${KF_MODULE}" IN_LIST KF_MODULES)
|
||||
endforeach ()
|
||||
foreach (KF_MODULE ${IMPORTED_KF_MODULES})
|
||||
if (NOT "${KF_MODULE}" IN_LIST KF_MODULES)
|
||||
find_package(KF5${KF_MODULE} REQUIRED)
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# built-in platform, imageformat and iconengine plugins when linking statically against Qt Gui
|
||||
# -> determine whether application target links statically against Qt Gui
|
||||
if(META_PROJECT_TYPE STREQUAL "application")
|
||||
# built-in platform, imageformat and iconengine plugins when linking statically against Qt Gui -> determine whether
|
||||
# application target links statically against Qt Gui
|
||||
if (META_PROJECT_TYPE STREQUAL "application")
|
||||
set(USING_STATIC_QT_GUI_FOR_APPLICATION NO)
|
||||
foreach(MODULE Gui Widgets Quick)
|
||||
if(QT5_${MODULE}_STATIC_LIB IN_LIST LIBRARIES OR QT5_${MODULE}_STATIC_LIB IN_LIST PRIVATE_LIBRARIES)
|
||||
foreach (MODULE Gui Widgets Quick)
|
||||
if (QT5_${MODULE}_STATIC_LIB IN_LIST LIBRARIES OR QT5_${MODULE}_STATIC_LIB IN_LIST PRIVATE_LIBRARIES)
|
||||
set(USING_STATIC_QT_GUI_FOR_APPLICATION YES)
|
||||
message(STATUS "Linking application ${META_PROJECT_NAME} against static Qt 5 plugins.")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
# -> link against plugins according to platform and configuration
|
||||
if(USING_STATIC_QT_GUI_FOR_APPLICATION)
|
||||
if(NOT USE_STATIC_QT5_Gui)
|
||||
if (USING_STATIC_QT_GUI_FOR_APPLICATION)
|
||||
if (NOT USE_STATIC_QT5_Gui)
|
||||
find_qt5_module(Gui REQUIRED)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# ensure platform integration plugins for corresponding platforms are built-in when creating a GUI application
|
||||
if(WIN32)
|
||||
if (WIN32)
|
||||
use_static_qt5_plugin(Gui WindowsIntegration ON OFF)
|
||||
elseif(APPLE)
|
||||
elseif (APPLE)
|
||||
use_static_qt5_plugin(Gui CocoaIntegration ON OFF)
|
||||
elseif(TARGET ${QT5_Gui_STATIC_PREFIX}QXcbIntegrationPlugin)
|
||||
elseif (TARGET ${QT5_Gui_STATIC_PREFIX}QXcbIntegrationPlugin)
|
||||
use_static_qt5_plugin(Gui XcbIntegration ON OFF)
|
||||
else()
|
||||
else ()
|
||||
message(WARNING "The required platform plugin for your platform is unknown an can not be linked in statically.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# ensure all available widget style plugins are built-in when creating a Qt Widgets application
|
||||
# note: required since Qt 5.10 because the styles have been "pluginized" (see commit 4f3249f)
|
||||
# ensure all available widget style plugins are built-in when creating a Qt Widgets application note: required since Qt
|
||||
# 5.10 because the styles have been "pluginized" (see commit 4f3249f)
|
||||
set(KNOWN_WIDGET_STYLE_PLUGINS WindowsVistaStyle MacStyle AndroidStyle)
|
||||
set(USED_WIDGET_STYLE_PLUGINS)
|
||||
if(QT5_Widgets_STATIC_LIB IN_LIST LIBRARIES OR QT5_Widgets_STATIC_LIB IN_LIST PRIVATE_LIBRARIES)
|
||||
foreach(WIDGET_STYLE_PLUGIN ${KNOWN_WIDGET_STYLE_PLUGINS})
|
||||
if(TARGET "${QT5_Widgets_STATIC_PREFIX}Q${WIDGET_STYLE_PLUGIN}Plugin")
|
||||
if (QT5_Widgets_STATIC_LIB IN_LIST LIBRARIES OR QT5_Widgets_STATIC_LIB IN_LIST PRIVATE_LIBRARIES)
|
||||
foreach (WIDGET_STYLE_PLUGIN ${KNOWN_WIDGET_STYLE_PLUGINS})
|
||||
if (TARGET "${QT5_Widgets_STATIC_PREFIX}Q${WIDGET_STYLE_PLUGIN}Plugin")
|
||||
use_static_qt5_plugin(Widgets "${WIDGET_STYLE_PLUGIN}" ON OFF)
|
||||
list(APPEND USED_WIDGET_STYLE_PLUGINS "${WIDGET_STYLE_PLUGIN}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# allow importing image format plugins via config.h
|
||||
include(ListToString)
|
||||
list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "Plugin)" "${USED_WIDGET_STYLE_PLUGINS}" WIDGET_STYLE_PLUGINS_ARRAY)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# ensure image format plugins (beside SVG) are built-in if configured
|
||||
if(IMAGE_FORMAT_SUPPORT)
|
||||
foreach(IMAGE_FORMAT ${IMAGE_FORMAT_SUPPORT})
|
||||
if(IMAGE_FORMAT EQUAL "Svg")
|
||||
if (IMAGE_FORMAT_SUPPORT)
|
||||
foreach (IMAGE_FORMAT ${IMAGE_FORMAT_SUPPORT})
|
||||
if (IMAGE_FORMAT EQUAL "Svg")
|
||||
# the image format plugin of the Qt Svg module is handled separately
|
||||
set(SVG_SUPPORT ON)
|
||||
list(REMOVE_ITEM IMAGE_FORMAT_SUPPORT Svg)
|
||||
else()
|
||||
else ()
|
||||
use_static_qt5_plugin(Gui "${IMAGE_FORMAT}" ON OFF)
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# allow importing image format plugins via config.h
|
||||
include(ListToString)
|
||||
list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "Plugin)" "${IMAGE_FORMAT_SUPPORT}" IMAGE_FORMAT_SUPPORT_ARRAY)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# ensure SVG plugins are built-in if configured
|
||||
if((SVG_SUPPORT OR SVG_ICON_SUPPORT) AND NOT USE_STATIC_QT5_Svg)
|
||||
if ((SVG_SUPPORT OR SVG_ICON_SUPPORT) AND NOT USE_STATIC_QT5_Svg)
|
||||
find_qt5_module(Svg REQUIRED)
|
||||
endif()
|
||||
if(SVG_SUPPORT)
|
||||
endif ()
|
||||
if (SVG_SUPPORT)
|
||||
use_static_qt5_plugin(Svg Svg ON OFF)
|
||||
endif()
|
||||
if(SVG_ICON_SUPPORT)
|
||||
endif ()
|
||||
if (SVG_ICON_SUPPORT)
|
||||
use_static_qt5_plugin(Svg SvgIcon ON OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# option for built-in translations
|
||||
option(BUILTIN_TRANSLATIONS "enables/disables built-in translations when building applications and libraries" OFF)
|
||||
|
@ -155,35 +153,32 @@ option(BUILTIN_TRANSLATIONS "enables/disables built-in translations when buildin
|
|||
# determine relevant Qt translation files
|
||||
set(QT_TRANSLATION_FILES)
|
||||
set(QT_TRANSLATION_SEARCH_PATHS)
|
||||
if(CMAKE_FIND_ROOT_PATH)
|
||||
list(APPEND QT_TRANSLATION_SEARCH_PATHS
|
||||
"${CMAKE_FIND_ROOT_PATH}/share/qt/translations"
|
||||
"${CMAKE_FIND_ROOT_PATH}/share/qt5/translations"
|
||||
)
|
||||
endif()
|
||||
if (CMAKE_FIND_ROOT_PATH)
|
||||
list(APPEND QT_TRANSLATION_SEARCH_PATHS "${CMAKE_FIND_ROOT_PATH}/share/qt/translations"
|
||||
"${CMAKE_FIND_ROOT_PATH}/share/qt5/translations")
|
||||
endif ()
|
||||
list(APPEND QT_TRANSLATION_SEARCH_PATHS
|
||||
"${CMAKE_INSTALL_PREFIX}/share/qt/translations"
|
||||
"${CMAKE_INSTALL_PREFIX}/share/qt5/translations"
|
||||
"/usr/share/qt/translations"
|
||||
"/usr/share/qt5/translations"
|
||||
)
|
||||
foreach(QT_TRANSLATION_PATH ${QT_TRANSLATION_SEARCH_PATHS})
|
||||
if(IS_DIRECTORY "${QT_TRANSLATION_PATH}")
|
||||
foreach(QT_REPO ${QT_REPOS})
|
||||
"${CMAKE_INSTALL_PREFIX}/share/qt/translations"
|
||||
"${CMAKE_INSTALL_PREFIX}/share/qt5/translations"
|
||||
"/usr/share/qt/translations"
|
||||
"/usr/share/qt5/translations")
|
||||
foreach (QT_TRANSLATION_PATH ${QT_TRANSLATION_SEARCH_PATHS})
|
||||
if (IS_DIRECTORY "${QT_TRANSLATION_PATH}")
|
||||
foreach (QT_REPO ${QT_REPOS})
|
||||
file(GLOB QT_QM_FILES "${QT_TRANSLATION_PATH}/qt${QT_REPO}_*.qm")
|
||||
if(QT_QM_FILES)
|
||||
# add files to list of built-in translations
|
||||
# but only if that configuration is enabled and if we're building the final application
|
||||
if(BUILTIN_TRANSLATIONS AND "${META_PROJECT_TYPE}" STREQUAL "application")
|
||||
if (QT_QM_FILES)
|
||||
# add files to list of built-in translations but only if that configuration is enabled and if we're building
|
||||
# the final application
|
||||
if (BUILTIN_TRANSLATIONS AND "${META_PROJECT_TYPE}" STREQUAL "application")
|
||||
file(COPY ${QT_QM_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
list(APPEND EXTERNAL_QM_FILES ${QT_QM_FILES})
|
||||
endif()
|
||||
endif ()
|
||||
list(APPEND QT_TRANSLATION_FILES "qt${QT_REPO}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# make relevant Qt translations available as array via config.h
|
||||
include(ListToString)
|
||||
|
@ -191,231 +186,275 @@ list_to_string("," " \\\n QStringLiteral(\"" "\")" "${QT_TRANSLATION_FILES}"
|
|||
|
||||
# enable lrelease and add install target for localization
|
||||
option(ENABLE_QT_TRANSLATIONS "specifies whether Qt translations should be updated/released" ON)
|
||||
if(ENABLE_QT_TRANSLATIONS AND TS_FILES)
|
||||
if (ENABLE_QT_TRANSLATIONS AND TS_FILES)
|
||||
message(STATUS "Project has translations which will be released.")
|
||||
set(APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE YES)
|
||||
|
||||
# the LinguistTools module is required
|
||||
# (but not add it to QT_MODULES because we don't link against it)
|
||||
# the LinguistTools module is required (but not add it to QT_MODULES because we don't link against it)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
|
||||
set(LUPDATE_OPTIONS "" CACHE STRING "specifies options passed to lupdate")
|
||||
|
||||
# adds the translations and a target for it
|
||||
qt5_create_translation(QM_FILES
|
||||
${HEADER_FILES} ${SRC_FILES}
|
||||
${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_UI_FILES}
|
||||
${QML_HEADER_FILES} ${QML_SRC_FILES} ${QML_RES_FILES}
|
||||
${TS_FILES}
|
||||
OPTIONS ${LUPDATE_OPTIONS}
|
||||
)
|
||||
${HEADER_FILES}
|
||||
${SRC_FILES}
|
||||
${WIDGETS_HEADER_FILES}
|
||||
${WIDGETS_SRC_FILES}
|
||||
${WIDGETS_UI_FILES}
|
||||
${QML_HEADER_FILES}
|
||||
${QML_SRC_FILES}
|
||||
${QML_RES_FILES}
|
||||
${TS_FILES}
|
||||
OPTIONS
|
||||
${LUPDATE_OPTIONS})
|
||||
add_custom_target(${META_PROJECT_NAME}_translations DEPENDS ${QM_FILES})
|
||||
if(NOT TARGET translations)
|
||||
if (NOT TARGET translations)
|
||||
add_custom_target(translations DEPENDS ${META_PROJECT_NAME}_translations)
|
||||
else()
|
||||
else ()
|
||||
add_dependencies(translations ${META_PROJECT_NAME}_translations)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# add install target for translations
|
||||
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||
install(FILES ${QM_FILES}
|
||||
DESTINATION share/${META_PROJECT_NAME}/translations
|
||||
COMPONENT localization
|
||||
)
|
||||
if(NOT TARGET install-localization)
|
||||
if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||
install(FILES ${QM_FILES} DESTINATION share/${META_PROJECT_NAME}/translations COMPONENT localization)
|
||||
if (NOT TARGET install-localization)
|
||||
set(LOCALIZATION_TARGET "install-localization")
|
||||
add_custom_target(${LOCALIZATION_TARGET}
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P
|
||||
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
add_dependencies(${LOCALIZATION_TARGET} ${META_PROJECT_NAME}_translations)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
list(APPEND APP_SPECIFIC_QT_TRANSLATION_FILES "${META_PROJECT_NAME}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# make application specific translation available as array via config.h
|
||||
# (even if this project has no translations, there might be some from dependencies)
|
||||
if(APP_SPECIFIC_QT_TRANSLATION_FILES)
|
||||
list_to_string("," " \\\n QStringLiteral(\"" "\")" "${APP_SPECIFIC_QT_TRANSLATION_FILES}" APP_SPECIFIC_QT_TRANSLATION_FILES_ARRAY)
|
||||
else()
|
||||
# make application specific translation available as array via config.h (even if this project has no translations, there
|
||||
# might be some from dependencies)
|
||||
if (APP_SPECIFIC_QT_TRANSLATION_FILES)
|
||||
list_to_string(","
|
||||
" \\\n QStringLiteral(\""
|
||||
"\")"
|
||||
"${APP_SPECIFIC_QT_TRANSLATION_FILES}"
|
||||
APP_SPECIFIC_QT_TRANSLATION_FILES_ARRAY)
|
||||
else ()
|
||||
set(APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE NO)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# built-in translations
|
||||
if(BUILTIN_TRANSLATIONS AND (QM_FILES OR EXTERNAL_QM_FILES))
|
||||
if (BUILTIN_TRANSLATIONS AND (QM_FILES OR EXTERNAL_QM_FILES))
|
||||
# write a qrc file for the qm files and add it to the resource files
|
||||
set(TRANSLATIONS_QRC_FILE_NAME "${META_PROJECT_VARNAME_LOWER}_translations.qrc")
|
||||
set(TRANSLATIONS_QRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TRANSLATIONS_QRC_FILE_NAME}")
|
||||
file(WRITE "${TRANSLATIONS_QRC_FILE}" "<RCC><qresource prefix=\"/translations\">")
|
||||
foreach(QM_FILE ${QM_FILES} ${EXTERNAL_QM_FILES})
|
||||
foreach (QM_FILE ${QM_FILES} ${EXTERNAL_QM_FILES})
|
||||
get_filename_component(QM_FILE_NAME "${QM_FILE}" NAME)
|
||||
file(APPEND "${TRANSLATIONS_QRC_FILE}" "<file>${QM_FILE_NAME}</file>")
|
||||
endforeach()
|
||||
endforeach ()
|
||||
file(APPEND "${TRANSLATIONS_QRC_FILE}" "</qresource></RCC>")
|
||||
list(APPEND RES_FILES "${TRANSLATIONS_QRC_FILE}")
|
||||
list(APPEND AUTOGEN_DEPS ${QM_FILES} ${EXTERNAL_QM_FILES})
|
||||
list(APPEND BUILTIN_TRANSLATION_FILES "${TRANSLATIONS_QRC_FILE_NAME}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# generate DBus interfaces
|
||||
if(DBUS_FILES)
|
||||
if (DBUS_FILES)
|
||||
qt5_add_dbus_interfaces(GENERATED_DBUS_FILES ${DBUS_FILES})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# add icons to be built-in
|
||||
if(REQUIRED_ICONS)
|
||||
if (REQUIRED_ICONS)
|
||||
set(BUILTIN_ICON_THEMES "" CACHE STRING "specifies icon themes to be built-in")
|
||||
option(BUILTIN_ICON_THEMES_IN_LIBRARIES "specifies whether icon themes should also be built-in when building libraries" OFF)
|
||||
if(BUILTIN_ICON_THEMES AND (BUILTIN_ICON_THEMES_IN_LIBRARIES OR (NOT "${META_PROJECT_TYPE}" STREQUAL "library")))
|
||||
option(BUILTIN_ICON_THEMES_IN_LIBRARIES "specifies whether icon themes should also be built-in when building libraries"
|
||||
OFF)
|
||||
if (BUILTIN_ICON_THEMES AND (BUILTIN_ICON_THEMES_IN_LIBRARIES OR (NOT "${META_PROJECT_TYPE}" STREQUAL "library")))
|
||||
set(ICON_THEME_FILES)
|
||||
set(ICON_SEARCH_PATHS)
|
||||
if(CMAKE_FIND_ROOT_PATH)
|
||||
if (CMAKE_FIND_ROOT_PATH)
|
||||
# find icons from the regular prefix when cross-compiling
|
||||
list(APPEND ICON_SEARCH_PATHS "${CMAKE_FIND_ROOT_PATH}/share/icons")
|
||||
endif()
|
||||
endif ()
|
||||
list(APPEND ICON_SEARCH_PATHS "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||
list(APPEND ICON_SEARCH_PATHS "/usr/share/icons")
|
||||
set(BUILTIN_ICONS_DIR "${CMAKE_CURRENT_BINARY_DIR}/icons")
|
||||
set(DEFAULT_THEME_INDEX_FILE "${BUILTIN_ICONS_DIR}/default/index.theme")
|
||||
file(REMOVE_RECURSE "${BUILTIN_ICONS_DIR}")
|
||||
file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}")
|
||||
foreach(ICON_THEME ${BUILTIN_ICON_THEMES})
|
||||
string(REGEX MATCHALL "([^:]+|[^:]+$)" ICON_THEME_PARTS "${ICON_THEME}")
|
||||
foreach (ICON_THEME ${BUILTIN_ICON_THEMES})
|
||||
string(REGEX MATCHALL
|
||||
"([^:]+|[^:]+$)"
|
||||
ICON_THEME_PARTS
|
||||
"${ICON_THEME}")
|
||||
list(LENGTH ICON_THEME_PARTS ICON_THEME_PARTS_LENGTH)
|
||||
if("${ICON_THEME_PARTS_LENGTH}" STREQUAL 2)
|
||||
if ("${ICON_THEME_PARTS_LENGTH}" STREQUAL 2)
|
||||
list(GET ICON_THEME_PARTS 0 ICON_THEME)
|
||||
list(GET ICON_THEME_PARTS 1 NEW_ICON_THEME_NAME)
|
||||
else()
|
||||
else ()
|
||||
set(NEW_ICON_THEME_NAME "${ICON_THEME}")
|
||||
endif()
|
||||
foreach(ICON_SEARCH_PATH ${ICON_SEARCH_PATHS})
|
||||
endif ()
|
||||
foreach (ICON_SEARCH_PATH ${ICON_SEARCH_PATHS})
|
||||
set(ICON_THEME_PATH "${ICON_SEARCH_PATH}/${ICON_THEME}")
|
||||
set(NEW_ICON_THEME_PATH "${ICON_SEARCH_PATH}/${ICON_THEME}")
|
||||
if(IS_DIRECTORY "${ICON_THEME_PATH}")
|
||||
message(STATUS "The specified icon theme \"${ICON_THEME}\" has been located under \"${ICON_THEME_PATH}\" and will be built-in.")
|
||||
if (IS_DIRECTORY "${ICON_THEME_PATH}")
|
||||
message(
|
||||
STATUS
|
||||
"The specified icon theme \"${ICON_THEME}\" has been located under \"${ICON_THEME_PATH}\" and will be built-in."
|
||||
)
|
||||
# find index files
|
||||
if(NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
|
||||
file(GLOB GLOBBED_ICON_THEME_INDEX_FILES LIST_DIRECTORIES false "${ICON_THEME_PATH}/index.theme" "${ICON_THEME_PATH}/icon-theme.cache")
|
||||
else()
|
||||
if (NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
|
||||
file(GLOB GLOBBED_ICON_THEME_INDEX_FILES
|
||||
LIST_DIRECTORIES
|
||||
false
|
||||
"${ICON_THEME_PATH}/index.theme"
|
||||
"${ICON_THEME_PATH}/icon-theme.cache")
|
||||
else ()
|
||||
# only index.theme required when icons are provided as fallback anyways
|
||||
file(GLOB GLOBBED_ICON_THEME_INDEX_FILES LIST_DIRECTORIES false "${ICON_THEME_PATH}/index.theme")
|
||||
endif()
|
||||
file(GLOB GLOBBED_ICON_THEME_INDEX_FILES
|
||||
LIST_DIRECTORIES
|
||||
false
|
||||
"${ICON_THEME_PATH}/index.theme")
|
||||
endif ()
|
||||
# make the first specified built-in the default theme
|
||||
if(NOT EXISTS "${DEFAULT_THEME_INDEX_FILE}")
|
||||
if (NOT EXISTS "${DEFAULT_THEME_INDEX_FILE}")
|
||||
file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}/default")
|
||||
file(WRITE "${DEFAULT_THEME_INDEX_FILE}" "[Icon Theme]\nInherits=${NEW_ICON_THEME_NAME}")
|
||||
list(APPEND ICON_THEME_FILES "<file>default/index.theme</file>")
|
||||
endif()
|
||||
endif ()
|
||||
# find required icons, except the icon theme is provided as fallback anyways
|
||||
if(NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
|
||||
if (NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
|
||||
set(GLOB_PATTERNS)
|
||||
foreach(REQUIRED_ICON ${REQUIRED_ICONS})
|
||||
foreach (REQUIRED_ICON ${REQUIRED_ICONS})
|
||||
list(APPEND GLOB_PATTERNS
|
||||
"${ICON_THEME_PATH}/${REQUIRED_ICON}"
|
||||
"${ICON_THEME_PATH}/${REQUIRED_ICON}.*"
|
||||
"${ICON_THEME_PATH}/*/${REQUIRED_ICON}"
|
||||
"${ICON_THEME_PATH}/*/${REQUIRED_ICON}.*"
|
||||
"${ICON_THEME_PATH}/${REQUIRED_ICON}"
|
||||
"${ICON_THEME_PATH}/${REQUIRED_ICON}.*"
|
||||
"${ICON_THEME_PATH}/*/${REQUIRED_ICON}"
|
||||
"${ICON_THEME_PATH}/*/${REQUIRED_ICON}.*")
|
||||
endforeach ()
|
||||
file(GLOB_RECURSE GLOBBED_ICON_THEME_FILES
|
||||
LIST_DIRECTORIES
|
||||
false
|
||||
${GLOB_PATTERNS})
|
||||
else ()
|
||||
message(
|
||||
STATUS
|
||||
"Icon files for specified theme \"${ICON_THEME}\" are skipped because these are provided as fallback anyways."
|
||||
)
|
||||
endforeach()
|
||||
file(GLOB_RECURSE GLOBBED_ICON_THEME_FILES LIST_DIRECTORIES false ${GLOB_PATTERNS})
|
||||
else()
|
||||
message(STATUS "Icon files for specified theme \"${ICON_THEME}\" are skipped because these are provided as fallback anyways.")
|
||||
set(GLOBBED_ICON_THEME_FILES)
|
||||
endif()
|
||||
endif ()
|
||||
# make temporary copy of required icons and create resource list for Qt
|
||||
foreach(ICON_THEME_FILE ${GLOBBED_ICON_THEME_INDEX_FILES} ${GLOBBED_ICON_THEME_FILES})
|
||||
foreach (ICON_THEME_FILE ${GLOBBED_ICON_THEME_INDEX_FILES} ${GLOBBED_ICON_THEME_FILES})
|
||||
# resolve symlinks
|
||||
if(IS_SYMLINK "${ICON_THEME_FILE}")
|
||||
string(REGEX REPLACE "^${ICON_SEARCH_PATH}/" "" ICON_THEME_FILE_RELATIVE_PATH "${ICON_THEME_FILE}")
|
||||
string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_RELATIVE_PATH "${ICON_THEME_FILE_RELATIVE_PATH}")
|
||||
if (IS_SYMLINK "${ICON_THEME_FILE}")
|
||||
string(REGEX
|
||||
REPLACE "^${ICON_SEARCH_PATH}/"
|
||||
""
|
||||
ICON_THEME_FILE_RELATIVE_PATH
|
||||
"${ICON_THEME_FILE}")
|
||||
string(REGEX
|
||||
REPLACE "(^[^/\\]+)"
|
||||
"${NEW_ICON_THEME_NAME}"
|
||||
NEW_ICON_THEME_FILE_RELATIVE_PATH
|
||||
"${ICON_THEME_FILE_RELATIVE_PATH}")
|
||||
set(ICON_THEME_FILE_ALIAS " alias=\"${NEW_ICON_THEME_FILE_RELATIVE_PATH}\"")
|
||||
get_filename_component(ICON_THEME_FILE "${ICON_THEME_FILE}" REALPATH)
|
||||
else()
|
||||
else ()
|
||||
unset(ICON_THEME_FILE_ALIAS)
|
||||
endif()
|
||||
string(REGEX REPLACE "^${ICON_SEARCH_PATH}/" "" ICON_THEME_FILE_RELATIVE_PATH "${ICON_THEME_FILE}")
|
||||
string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_RELATIVE_PATH "${ICON_THEME_FILE_RELATIVE_PATH}")
|
||||
endif ()
|
||||
string(REGEX
|
||||
REPLACE "^${ICON_SEARCH_PATH}/"
|
||||
""
|
||||
ICON_THEME_FILE_RELATIVE_PATH
|
||||
"${ICON_THEME_FILE}")
|
||||
string(REGEX
|
||||
REPLACE "(^[^/\\]+)"
|
||||
"${NEW_ICON_THEME_NAME}"
|
||||
NEW_ICON_THEME_FILE_RELATIVE_PATH
|
||||
"${ICON_THEME_FILE_RELATIVE_PATH}")
|
||||
get_filename_component(ICON_THEME_FILE_DIR "${ICON_THEME_FILE_RELATIVE_PATH}" DIRECTORY)
|
||||
string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_DIR "${ICON_THEME_FILE_DIR}")
|
||||
string(REGEX
|
||||
REPLACE "(^[^/\\]+)"
|
||||
"${NEW_ICON_THEME_NAME}"
|
||||
NEW_ICON_THEME_FILE_DIR
|
||||
"${ICON_THEME_FILE_DIR}")
|
||||
file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}/${NEW_ICON_THEME_FILE_DIR}")
|
||||
file(COPY "${ICON_THEME_FILE}" DESTINATION "${BUILTIN_ICONS_DIR}/${NEW_ICON_THEME_FILE_DIR}")
|
||||
list(APPEND ICON_THEME_FILES "<file${ICON_THEME_FILE_ALIAS}>${NEW_ICON_THEME_FILE_RELATIVE_PATH}</file>")
|
||||
endforeach()
|
||||
list(APPEND ICON_THEME_FILES
|
||||
"<file${ICON_THEME_FILE_ALIAS}>${NEW_ICON_THEME_FILE_RELATIVE_PATH}</file>")
|
||||
endforeach ()
|
||||
break()
|
||||
endif()
|
||||
endif ()
|
||||
unset(ICON_THEME_PATH)
|
||||
endforeach()
|
||||
if(NOT ICON_THEME_PATH)
|
||||
endforeach ()
|
||||
if (NOT ICON_THEME_PATH)
|
||||
message(FATAL_ERROR "The specified icon theme \"${ICON_THEME}\" coud not be found.")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
set(BUILTIN_ICON_THEMES_QRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/icons/${META_PROJECT_NAME}_builtinicons.qrc")
|
||||
list(REMOVE_DUPLICATES ICON_THEME_FILES)
|
||||
string(CONCAT BUILTIN_ICON_THEMES_QRC_FILE_CONTENT "<RCC><qresource prefix=\"/icons\">" ${ICON_THEME_FILES} "</qresource></RCC>")
|
||||
string(CONCAT BUILTIN_ICON_THEMES_QRC_FILE_CONTENT
|
||||
"<RCC><qresource prefix=\"/icons\">"
|
||||
${ICON_THEME_FILES}
|
||||
"</qresource></RCC>")
|
||||
file(WRITE "${BUILTIN_ICON_THEMES_QRC_FILE}" "${BUILTIN_ICON_THEMES_QRC_FILE_CONTENT}")
|
||||
list(APPEND RES_FILES "${BUILTIN_ICON_THEMES_QRC_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# export Qt resources from specified RES_FILES
|
||||
foreach(RES_FILE ${RES_FILES})
|
||||
foreach (RES_FILE ${RES_FILES})
|
||||
get_filename_component(RES_EXT ${RES_FILE} EXT)
|
||||
if(RES_EXT STREQUAL ".qrc")
|
||||
if (RES_EXT STREQUAL ".qrc")
|
||||
get_filename_component(RES_NAME ${RES_FILE} NAME_WE)
|
||||
list(APPEND QT_RESOURCES "${RES_NAME}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# export Qt resources required by static libraries the static library depends on
|
||||
if(STATIC_LIBRARIES_QT_RESOURCES)
|
||||
if (STATIC_LIBRARIES_QT_RESOURCES)
|
||||
list(REMOVE_DUPLICATES STATIC_LIBRARIES_QT_RESOURCES)
|
||||
list(APPEND QT_RESOURCES ${STATIC_LIBRARIES_QT_RESOURCES})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# enable Qt resources required by static libraries the shared library or application depends on
|
||||
if(LIBRARIES_QT_RESOURCES)
|
||||
if (LIBRARIES_QT_RESOURCES)
|
||||
list(REMOVE_DUPLICATES LIBRARIES_QT_RESOURCES)
|
||||
|
||||
# make enabling resources of static dependencies available via config.h
|
||||
unset(ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES)
|
||||
foreach(QT_RESOURCE ${LIBRARIES_QT_RESOURCES})
|
||||
set(ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES
|
||||
foreach (QT_RESOURCE ${LIBRARIES_QT_RESOURCES})
|
||||
set(
|
||||
ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES
|
||||
"${ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES} \\\n struct initializer_${QT_RESOURCE} { \\\n initializer_${QT_RESOURCE}() { Q_INIT_RESOURCE(${QT_RESOURCE}); } \\\n ~initializer_${QT_RESOURCE}() { Q_CLEANUP_RESOURCE(${QT_RESOURCE}); } \\\n } dummy_${QT_RESOURCE};"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
)
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
# prevent duplicated resources
|
||||
if(QT_RESOURCES)
|
||||
if (QT_RESOURCES)
|
||||
list(REMOVE_DUPLICATES QT_RESOURCES)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# enable moc, uic and rcc by default for all targets
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
if(WIDGETS_UI_FILES AND WIDGETS_GUI)
|
||||
if (WIDGETS_UI_FILES AND WIDGETS_GUI)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
if(INSTALL_UI_HEADER)
|
||||
if (INSTALL_UI_HEADER)
|
||||
# also add install for header files generated by uic
|
||||
foreach(UI_FILE WIDGETS_UI_FILES)
|
||||
foreach (UI_FILE WIDGETS_UI_FILES)
|
||||
get_filename_component(UI_NAME "${UI_FILE}" NAME_WE)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_${UI_NAME}.h"
|
||||
DESTINATION "include/${META_PROJECT_NAME}/ui"
|
||||
COMPONENT ui-header
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_${UI_NAME}.h"
|
||||
DESTINATION "include/${META_PROJECT_NAME}/ui"
|
||||
COMPONENT ui-header)
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# add configuration header for Qt-specific configuration
|
||||
include(TemplateFinder)
|
||||
find_template_file("qtconfig.h" QT_UTILITIES QT_CONFIG_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${QT_CONFIG_H_TEMPLATE_FILE}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/resources/qtconfig.h"
|
||||
)
|
||||
configure_file("${QT_CONFIG_H_TEMPLATE_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/resources/qtconfig.h")
|
||||
|
||||
set(QT_CONFIGURED YES)
|
||||
|
|
|
@ -1,68 +1,75 @@
|
|||
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
||||
|
||||
if(NOT BASIC_PROJECT_CONFIG_DONE)
|
||||
if (NOT BASIC_PROJECT_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Before including the QtGuiConfig module, the BasicConfig module must be included.")
|
||||
endif()
|
||||
if(QT_CONFIGURED)
|
||||
endif ()
|
||||
if (QT_CONFIGURED)
|
||||
message(FATAL_ERROR "The QtGuiConfig module can not be included when Qt usage has already been configured.")
|
||||
endif()
|
||||
if(TARGET_CONFIG_DONE)
|
||||
endif ()
|
||||
if (TARGET_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Can not include QtGuiConfig module when targets are already configured.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# enable Qt Widgets GUI
|
||||
if(WIDGETS_GUI)
|
||||
if (WIDGETS_GUI)
|
||||
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS GUI_QTWIDGETS)
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_GUI_QTWIDGETS)
|
||||
list(APPEND WIDGETS_FILES ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_RES_FILES} ${WIDGETS_UI_FILES})
|
||||
list(APPEND WIDGETS_FILES
|
||||
${WIDGETS_HEADER_FILES}
|
||||
${WIDGETS_SRC_FILES}
|
||||
${WIDGETS_RES_FILES}
|
||||
${WIDGETS_UI_FILES})
|
||||
list(APPEND ADDITIONAL_HEADER_FILES ${WIDGETS_HEADER_FILES})
|
||||
if(WIDGETS_FILES)
|
||||
if (WIDGETS_FILES)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Widgets)
|
||||
message(STATUS "Building with Qt Widgets GUI.")
|
||||
else()
|
||||
else ()
|
||||
message(STATUS "Qt Widgets GUI is not available.")
|
||||
endif()
|
||||
else()
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Building WITHOUT Qt Widgets GUI.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# enable Qt Quick GUI
|
||||
if(QUICK_GUI)
|
||||
if (QUICK_GUI)
|
||||
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS GUI_QTQUICK)
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_GUI_QTQUICK)
|
||||
list(APPEND QML_FILES ${QML_HEADER_FILES} ${QML_SRC_FILES} ${QML_RES_FILES})
|
||||
list(APPEND QML_FILES
|
||||
${QML_HEADER_FILES}
|
||||
${QML_SRC_FILES}
|
||||
${QML_RES_FILES})
|
||||
list(APPEND ADDITIONAL_HEADER_FILES ${QML_HEADER_FILES})
|
||||
if(QML_FILES)
|
||||
if (QML_FILES)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Qml Quick)
|
||||
list(APPEND ADDITIONAL_QT_REPOS "declarative")
|
||||
message(STATUS "Building with Qt Quick GUI.")
|
||||
|
||||
# enable QML debugging
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS QT_QML_DEBUG)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# enable Qt Quick Controls 2
|
||||
if(META_USE_QQC2)
|
||||
if (META_USE_QQC2)
|
||||
list(APPEND ADDITIONAL_QT_MODULES QuickControls2)
|
||||
endif()
|
||||
else()
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Qt Quick GUI is not available.")
|
||||
endif()
|
||||
else()
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Building WITHOUT Qt Quick GUI.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# do further GUI-related configuration only if at least one kind of GUI is enabled (tageditor allows building without GUI
|
||||
# so this is a valid configuration)
|
||||
if(WIDGETS_GUI OR QUICK_GUI)
|
||||
if(WIN32)
|
||||
# do further GUI-related configuration only if at least one kind of GUI is enabled (tageditor allows building without GUI so
|
||||
# this is a valid configuration)
|
||||
if (WIDGETS_GUI OR QUICK_GUI)
|
||||
if (WIN32)
|
||||
# set "GUI-type" to WIN32 to hide console under Windows
|
||||
set(GUI_TYPE WIN32)
|
||||
elseif(APPLE)
|
||||
elseif (APPLE)
|
||||
# make the GUI application a "bundle" under MacOSX
|
||||
set(GUI_TYPE MACOSX_BUNDLE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# add source files requried by both GUI variants
|
||||
list(APPEND SRC_FILES ${GUI_SRC_FILES})
|
||||
|
@ -71,9 +78,10 @@ if(WIDGETS_GUI OR QUICK_GUI)
|
|||
# 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)
|
||||
set(IMAGE_FORMAT_SUPPORT "Gif;ICO;Jpeg" CACHE STRING "specifies the image format plugins to link against (only relevant when using static Qt)")
|
||||
set(IMAGE_FORMAT_SUPPORT "Gif;ICO;Jpeg"
|
||||
CACHE STRING "specifies the image format plugins to link against (only relevant when using static Qt)")
|
||||
|
||||
if (ANDROID)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Svg)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
|
@ -3,52 +3,63 @@ cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
|||
# defines helper to link against Qt dynamically or statically
|
||||
|
||||
# prevent multiple inclusion
|
||||
if(DEFINED QT_LINKAGE_DETERMINED)
|
||||
if (DEFINED QT_LINKAGE_DETERMINED)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
set(QT_LINKAGE_DETERMINED ON)
|
||||
|
||||
include(3rdParty)
|
||||
|
||||
# by default, require Qt 5.6 or higher
|
||||
if(NOT META_QT5_VERSION)
|
||||
if (NOT META_QT5_VERSION)
|
||||
set(META_QT5_VERSION 5.6)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# determine whether to use dynamic or shared version of Qt (or both)
|
||||
set(QT_LINKAGE "AUTO_LINKAGE" CACHE STRING "specifies whether to link statically or dynamically against Qt 5")
|
||||
if(BUILD_STATIC_LIBS OR ("${QT_LINKAGE}" STREQUAL "AUTO_LINKAGE" AND ((STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application") OR (STATIC_LIBRARY_LINKAGE AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library")))) OR ("${QT_LINKAGE}" STREQUAL "STATIC"))
|
||||
if (BUILD_STATIC_LIBS
|
||||
OR ("${QT_LINKAGE}" STREQUAL "AUTO_LINKAGE"
|
||||
AND ((STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application")
|
||||
OR (STATIC_LIBRARY_LINKAGE
|
||||
AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library"))))
|
||||
OR ("${QT_LINKAGE}" STREQUAL "STATIC"))
|
||||
set(USE_STATIC_QT_BUILD ON)
|
||||
message(STATUS "Checking for static Qt 5 libraries to use in project ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
endif()
|
||||
if(("${QT_LINKAGE}" STREQUAL "AUTO_LINKAGE" AND (NOT (STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application") OR NOT (STATIC_LIBRARY_LINKAGE AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library")))) OR ("${QT_LINKAGE}" STREQUAL "SHARED"))
|
||||
message(
|
||||
STATUS "Checking for static Qt 5 libraries to use in project ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
endif ()
|
||||
if (("${QT_LINKAGE}" STREQUAL "AUTO_LINKAGE"
|
||||
AND (NOT
|
||||
(STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application")
|
||||
OR NOT
|
||||
(STATIC_LIBRARY_LINKAGE AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library"))))
|
||||
OR ("${QT_LINKAGE}" STREQUAL "SHARED"))
|
||||
set(USE_SHARED_QT_BUILD ON)
|
||||
message(STATUS "Checking for dynamic Qt 5 libraries to use in project ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
endif()
|
||||
message(
|
||||
STATUS "Checking for dynamic Qt 5 libraries to use in project ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
endif ()
|
||||
|
||||
macro(find_qt5_module MODULE REQUIRED)
|
||||
# determine whether the library is required or optional
|
||||
# FIXME: improve passing required argument
|
||||
if("${REQUIRED}" STREQUAL "OPTIONAL")
|
||||
macro (find_qt5_module MODULE REQUIRED)
|
||||
# determine whether the library is required or optional FIXME: improve passing required argument
|
||||
if ("${REQUIRED}" STREQUAL "OPTIONAL")
|
||||
unset(QT_5_${MODULE}_REQUIRED)
|
||||
elseif("${REQUIRED}" STREQUAL "REQUIRED")
|
||||
elseif ("${REQUIRED}" STREQUAL "REQUIRED")
|
||||
set(QT_5_${MODULE}_REQUIRED "REQUIRED")
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "Invalid use of link_against_library; must specify either REQUIRED or OPTIONAL.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# find static version
|
||||
if(USE_STATIC_QT_BUILD)
|
||||
# check for 'Static'-prefixed CMake module first
|
||||
# - patched mingw-w64-qt5 packages providing those files are available in my PKGBUILDs repository
|
||||
# - has the advantage that usage of dynamic and static Qt during the same build is possible
|
||||
if (USE_STATIC_QT_BUILD)
|
||||
# check for 'Static'-prefixed CMake module first - patched mingw-w64-qt5 packages providing those files are available
|
||||
# in my PKGBUILDs repository - has the advantage that usage of dynamic and static Qt during the same build is
|
||||
# possible
|
||||
find_package(StaticQt5${MODULE} ${META_QT5_VERSION})
|
||||
if(StaticQt5${MODULE}_FOUND)
|
||||
if(TARGET StaticQt5::${MODULE})
|
||||
if (StaticQt5${MODULE}_FOUND)
|
||||
if (TARGET StaticQt5::${MODULE})
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "StaticQt5::")
|
||||
else()
|
||||
else ()
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "Qt5::static::")
|
||||
endif()
|
||||
endif ()
|
||||
set(QT5_${MODULE}_STATIC_LIB "${QT5_${MODULE}_STATIC_PREFIX}${MODULE}")
|
||||
set(QT5_${MODULE}_ASSUME_STATIC OFF)
|
||||
set(QT5_${MODULE}_FOUND ON)
|
||||
|
@ -56,74 +67,91 @@ macro(find_qt5_module MODULE REQUIRED)
|
|||
set(PC_PKG_STATIC_Qt5_${MODULE} "StaticQt5${MODULE}")
|
||||
set(PC_PKG_STATIC_StaticQt5_${MODULE} "StaticQt5${MODULE}")
|
||||
set(PC_PKG_STATIC_Qt5_static_${MODULE} "StaticQt5${MODULE}")
|
||||
else()
|
||||
# consider the regular Qt package (without "Static" prefix) the static version if
|
||||
# static Qt is required and Qt package with "Static" prefix doesn't exist
|
||||
# (fallback if not using patched version of Qt mentioned above)
|
||||
else ()
|
||||
# consider the regular Qt package (without "Static" prefix) the static version if static Qt is required and Qt
|
||||
# package with "Static" prefix doesn't exist (fallback if not using patched version of Qt mentioned above)
|
||||
find_package(Qt5${MODULE} ${META_QT5_VERSION} ${QT_5_${MODULE}_REQUIRED})
|
||||
if(Qt5${MODULE}_FOUND)
|
||||
if (Qt5${MODULE}_FOUND)
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "Qt5::")
|
||||
set(QT5_${MODULE}_STATIC_LIB "${QT5_${MODULE}_STATIC_PREFIX}${MODULE}")
|
||||
set(QT5_${MODULE}_ASSUME_STATIC ON)
|
||||
set(QT5_${MODULE}_FOUND ON)
|
||||
# reverse lookup for pkg-config
|
||||
set(PC_PKG_STATIC_Qt5_${MODULE} "Qt5${MODULE}")
|
||||
message(WARNING "Building static libs and/or static Qt linkage has been enabled. Hence assuming provided Qt 5 module ${MODULE} is static.")
|
||||
endif()
|
||||
endif()
|
||||
message(
|
||||
WARNING
|
||||
"Building static libs and/or static Qt linkage has been enabled. Hence assuming provided Qt 5 module ${MODULE} is static."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# use INTERFACE_LINK_LIBRARIES_RELEASE of the imported target as general INTERFACE_LINK_LIBRARIES to get correct transitive dependencies
|
||||
# under any configuration
|
||||
if(StaticQt5${MODULE}_FOUND OR Qt5${MODULE}_FOUND)
|
||||
# use INTERFACE_LINK_LIBRARIES_RELEASE of the imported target as general INTERFACE_LINK_LIBRARIES to get correct
|
||||
# transitive dependencies under any configuration
|
||||
if (StaticQt5${MODULE}_FOUND OR Qt5${MODULE}_FOUND)
|
||||
get_target_property(QT5_${MODULE}_STATIC_LIB_DEPS "${QT5_${MODULE}_STATIC_LIB}" INTERFACE_LINK_LIBRARIES_RELEASE)
|
||||
set_target_properties("${QT5_${MODULE}_STATIC_LIB}" PROPERTIES INTERFACE_LINK_LIBRARIES "${QT5_${MODULE}_STATIC_LIB_DEPS}")
|
||||
endif()
|
||||
endif()
|
||||
set_target_properties("${QT5_${MODULE}_STATIC_LIB}"
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "${QT5_${MODULE}_STATIC_LIB_DEPS}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# find dynamic version
|
||||
if(USE_SHARED_QT_BUILD)
|
||||
if(QT5_${MODULE}_ASSUME_STATIC)
|
||||
message(FATAL_ERROR "The provided Qt 5 module ${MODULE} is assumed to be static. However, a shared version is required for building dynamic libs and/or dynamic Qt linkage.")
|
||||
endif()
|
||||
if (USE_SHARED_QT_BUILD)
|
||||
if (QT5_${MODULE}_ASSUME_STATIC)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"The provided Qt 5 module ${MODULE} is assumed to be static. However, a shared version is required for building dynamic libs and/or dynamic Qt linkage."
|
||||
)
|
||||
endif ()
|
||||
find_package(Qt5${MODULE} ${META_QT5_VERSION} ${QT_5_${MODULE}_REQUIRED})
|
||||
if(Qt5${MODULE}_FOUND)
|
||||
if (Qt5${MODULE}_FOUND)
|
||||
set(QT5_${MODULE}_DYNAMIC_LIB Qt5::${MODULE})
|
||||
set(QT5_${MODULE}_FOUND ON)
|
||||
# reverse lookup for pkg-config
|
||||
set(PC_PKG_SHARED_Qt5_${MODULE} "Qt5${MODULE}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
macro(use_qt5_module MODULE REQUIRED)
|
||||
if(${MODULE} IN_LIST META_PUBLIC_QT_MODULES)
|
||||
macro (use_qt5_module MODULE REQUIRED)
|
||||
if (${MODULE} IN_LIST META_PUBLIC_QT_MODULES)
|
||||
list(APPEND META_PUBLIC_SHARED_LIB_DEPENDS "${QT5_${MODULE}_DYNAMIC_LIB}")
|
||||
list(APPEND META_PUBLIC_STATIC_LIB_DEPENDS "${QT5_${MODULE}_STATIC_LIB}")
|
||||
endif()
|
||||
endif ()
|
||||
link_against_library("QT5_${MODULE}" "${QT_LINKAGE}" "${REQUIRED}")
|
||||
endmacro()
|
||||
endmacro ()
|
||||
|
||||
macro(use_static_qt5_plugin MODULE PLUGIN FOR_SHARED_TARGET FOR_STATIC_TARGET)
|
||||
if("${FOR_SHARED_TARGET}")
|
||||
macro (use_static_qt5_plugin MODULE PLUGIN FOR_SHARED_TARGET FOR_STATIC_TARGET)
|
||||
if ("${FOR_SHARED_TARGET}")
|
||||
list(APPEND PRIVATE_LIBRARIES "${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
message(STATUS "Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
endif()
|
||||
if("${FOR_STATIC_TARGET}")
|
||||
message(
|
||||
STATUS
|
||||
"Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin"
|
||||
)
|
||||
endif ()
|
||||
if ("${FOR_STATIC_TARGET}")
|
||||
list(APPEND PRIVATE_STATIC_LIBRARIES "${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
message(STATUS "Adding static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin to dependencies of static ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||
endif()
|
||||
endmacro()
|
||||
message(
|
||||
STATUS
|
||||
"Adding static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin to dependencies of static ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}"
|
||||
)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
macro(query_qmake_variable QMAKE_VARIABLE)
|
||||
macro (query_qmake_variable QMAKE_VARIABLE)
|
||||
get_target_property(QMAKE_BIN Qt5::qmake IMPORTED_LOCATION)
|
||||
execute_process(
|
||||
COMMAND "${QMAKE_BIN}" -query "${QMAKE_VARIABLE}"
|
||||
RESULT_VARIABLE "${QMAKE_VARIABLE}_RESULT"
|
||||
OUTPUT_VARIABLE "${QMAKE_VARIABLE}"
|
||||
)
|
||||
if(NOT "${${QMAKE_VARIABLE}_RESULT}" STREQUAL 0 OR "${${QMAKE_VARIABLE}}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unable to read qmake variable ${QMAKE_VARIABLE} via \"${QMAKE_BIN} -query ${QMAKE_VARIABLE}\"; output was \"${${QMAKE_VARIABLE}}\".")
|
||||
endif()
|
||||
string(REGEX REPLACE "\n$" "" "${QMAKE_VARIABLE}" "${${QMAKE_VARIABLE}}")
|
||||
execute_process(COMMAND "${QMAKE_BIN}" -query "${QMAKE_VARIABLE}"
|
||||
RESULT_VARIABLE "${QMAKE_VARIABLE}_RESULT"
|
||||
OUTPUT_VARIABLE "${QMAKE_VARIABLE}")
|
||||
if (NOT "${${QMAKE_VARIABLE}_RESULT}" STREQUAL 0 OR "${${QMAKE_VARIABLE}}" STREQUAL "")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unable to read qmake variable ${QMAKE_VARIABLE} via \"${QMAKE_BIN} -query ${QMAKE_VARIABLE}\"; output was \"${${QMAKE_VARIABLE}}\"."
|
||||
)
|
||||
endif ()
|
||||
string(REGEX
|
||||
REPLACE "\n$"
|
||||
""
|
||||
"${QMAKE_VARIABLE}"
|
||||
"${${QMAKE_VARIABLE}}")
|
||||
message(STATUS "qmake variable ${QMAKE_VARIABLE} is ${${QMAKE_VARIABLE}}")
|
||||
endmacro()
|
||||
endmacro ()
|
||||
|
|
|
@ -1,79 +1,74 @@
|
|||
# determines the web view provider (either Qt WebKit or Qt WebEngine)
|
||||
|
||||
if(TARGET_CONFIG_DONE)
|
||||
if (TARGET_CONFIG_DONE)
|
||||
message(FATAL_ERROR "Can not include WebViewProviderConfig module when targets are already configured.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(QtLinkage)
|
||||
|
||||
set(WEBVIEW_PROVIDER "auto" CACHE STRING "specifies the web view provider: auto (default), webkit, webengine or none")
|
||||
if(NOT WEBVIEW_PROVIDER OR "${WEBVIEW_PROVIDER}" STREQUAL "auto")
|
||||
if (NOT WEBVIEW_PROVIDER OR "${WEBVIEW_PROVIDER}" STREQUAL "auto")
|
||||
find_qt5_module(WebKitWidgets OPTIONAL)
|
||||
if(QT5_WebKitWidgets_FOUND)
|
||||
if (QT5_WebKitWidgets_FOUND)
|
||||
set(WEBVIEW_PROVIDER WebKitWidgets)
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_WEBKIT")
|
||||
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebKit.")
|
||||
else()
|
||||
else ()
|
||||
find_qt5_module(WebEngineWidgets OPTIONAL)
|
||||
if(QT5_WebEngineWidgets_FOUND)
|
||||
if (QT5_WebEngineWidgets_FOUND)
|
||||
set(WEBVIEW_PROVIDER WebEngineWidgets)
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_WEBENGINE")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "webengine")
|
||||
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebEngine.")
|
||||
else()
|
||||
else ()
|
||||
set(WEBVIEW_PROVIDER "")
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_NO_WEBVIEW")
|
||||
message(STATUS "No web view provider available, web view has been disabled.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(${WEBVIEW_PROVIDER} STREQUAL "webkit")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
if (${WEBVIEW_PROVIDER} STREQUAL "webkit")
|
||||
find_qt5_module(WebKitWidgets REQUIRED)
|
||||
set(WEBVIEW_PROVIDER WebKitWidgets)
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_WEBKIT")
|
||||
message(STATUS "Using Qt WebKit as web view provider.")
|
||||
elseif(${WEBVIEW_PROVIDER} STREQUAL "webengine")
|
||||
elseif (${WEBVIEW_PROVIDER} STREQUAL "webengine")
|
||||
find_qt5_module(WebEngineWidgets REQUIRED)
|
||||
set(WEBVIEW_PROVIDER WebEngineWidgets)
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_USE_WEBENGINE")
|
||||
list(APPEND ADDITIONAL_QT_REPOS "webengine")
|
||||
message(STATUS "Using Qt WebEngine as web view provider.")
|
||||
elseif(${WEBVIEW_PROVIDER} STREQUAL "none")
|
||||
elseif (${WEBVIEW_PROVIDER} STREQUAL "none")
|
||||
set(WEBVIEW_DEFINITION "${META_PROJECT_VARNAME_UPPER}_NO_WEBVIEW")
|
||||
set(WEBVIEW_PROVIDER "")
|
||||
message(STATUS "Web view has been disabled.")
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "The specified web view provider '${WEBVIEW_PROVIDER}' is unknown.")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(WEBVIEW_PROVIDER)
|
||||
if (WEBVIEW_PROVIDER)
|
||||
# require the selected Qt module
|
||||
use_qt5_module(${WEBVIEW_PROVIDER} REQUIRED)
|
||||
|
||||
# add header files with some defines/includes to conveniently use the selected provider
|
||||
if(META_WEBVIEW_SRC_DIR)
|
||||
if (META_WEBVIEW_SRC_DIR)
|
||||
set(WEBVIEW_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${META_WEBVIEW_SRC_DIR}")
|
||||
else()
|
||||
else ()
|
||||
set(WEBVIEW_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gui")
|
||||
endif()
|
||||
endif ()
|
||||
include(TemplateFinder)
|
||||
find_template_file("webviewdefs.h" QT_UTILITIES WEBVIEWDEFS_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${WEBVIEWDEFS_H_TEMPLATE_FILE}"
|
||||
"${WEBVIEW_HEADER_DIR}/webviewdefs.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
configure_file("${WEBVIEWDEFS_H_TEMPLATE_FILE}"
|
||||
"${WEBVIEW_HEADER_DIR}/webviewdefs.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
find_template_file("webviewincludes.h" QT_UTILITIES WEBVIEWINCLUDES_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${WEBVIEWINCLUDES_H_TEMPLATE_FILE}"
|
||||
"${WEBVIEW_HEADER_DIR}/webviewincludes.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
list(APPEND WIDGETS_FILES
|
||||
"${WEBVIEW_HEADER_DIR}/webviewdefs.h"
|
||||
"${WEBVIEW_HEADER_DIR}/webviewincludes.h"
|
||||
)
|
||||
endif()
|
||||
configure_file("${WEBVIEWINCLUDES_H_TEMPLATE_FILE}"
|
||||
"${WEBVIEW_HEADER_DIR}/webviewincludes.h" # simply add this to source to ease inclusion
|
||||
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
|
||||
)
|
||||
list(APPEND WIDGETS_FILES "${WEBVIEW_HEADER_DIR}/webviewdefs.h" "${WEBVIEW_HEADER_DIR}/webviewincludes.h")
|
||||
endif ()
|
||||
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${WEBVIEW_DEFINITION})
|
||||
|
|
Loading…
Reference in New Issue