Apply cmake-format
This commit is contained in:
parent
72d642c892
commit
190e58fe67
|
@ -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
|
||||
)
|
||||
cmake/templates/jsincludes.h.in)
|
||||
if (ANDROID)
|
||||
list(APPEND CMAKE_MODULE_FILES
|
||||
)
|
||||
list(APPEND CMAKE_TEMPLATE_FILES
|
||||
cmake/templates/android-deployment.json.in
|
||||
)
|
||||
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,12 +117,9 @@ 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}")
|
||||
|
@ -165,10 +146,9 @@ if(CAPSLOCK_DETECTION)
|
|||
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
|
||||
)
|
||||
set_property(SOURCE enterpassworddialog/enterpassworddialog.cpp
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
||||
endif ()
|
||||
|
||||
# configure support for D-Bus notifications
|
||||
|
@ -180,22 +160,13 @@ 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
|
||||
)
|
||||
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
|
||||
)
|
||||
list(APPEND DOC_ONLY_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.h ${DBUS_NOTIFICATIONS_FILE_NAME}.cpp)
|
||||
message(STATUS "D-Bus notifications disabled")
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ 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.")
|
||||
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}")
|
||||
|
@ -30,9 +32,9 @@ if(NOT EXISTS "${ANDROID_APK_MANIFEST_PATH}")
|
|||
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")
|
||||
|
@ -62,20 +64,16 @@ if(NOT ANDROID_APK_TOOLCHAIN_VERSION)
|
|||
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/*"
|
||||
)
|
||||
# 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 ()
|
||||
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})
|
||||
|
@ -102,19 +100,16 @@ if(NOT CMAKE_CURRENT_BINARY_DIR IN_LIST ANDROID_APK_BINARY_DIRS)
|
|||
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"
|
||||
# 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"
|
||||
)
|
||||
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)
|
||||
|
@ -129,7 +124,10 @@ function(add_android_apk_extra_libs TARGET_NAME)
|
|||
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.")
|
||||
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)
|
||||
|
@ -163,23 +161,22 @@ function(compose_dirs_for_android_apk)
|
|||
endfunction ()
|
||||
|
||||
# pick QML import paths from install prefix
|
||||
compose_dirs_for_android_apk(
|
||||
OUTPUT_VARIABLE 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"
|
||||
)
|
||||
"${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 ()
|
||||
|
||||
# pick extra plugins from install prefix
|
||||
compose_dirs_for_android_apk(
|
||||
OUTPUT_VARIABLE 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}"
|
||||
|
@ -187,8 +184,7 @@ compose_dirs_for_android_apk(
|
|||
"${CMAKE_INSTALL_PREFIX}/lib/plugins"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qt/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/lib/qml"
|
||||
"${CMAKE_INSTALL_PREFIX}/share"
|
||||
)
|
||||
"${CMAKE_INSTALL_PREFIX}/share")
|
||||
if (NOT ANDROID_APK_EXTRA_PLUGIN_DIRS)
|
||||
message(WARNING "Unable to find extra plugin directories for making the APK.")
|
||||
endif ()
|
||||
|
@ -196,14 +192,8 @@ 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")
|
||||
|
@ -232,49 +222,50 @@ else()
|
|||
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")
|
||||
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}")
|
||||
--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}")
|
||||
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}")
|
||||
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")
|
||||
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 ()
|
||||
set(ANDROID_APK_BINARY_PATH "${ANDROID_APK_BUILD_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}/lib${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}.so")
|
||||
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}"
|
||||
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}"
|
||||
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}
|
||||
--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}"
|
||||
DEPENDS
|
||||
"${ANDROID_DEPLOYMENT_JSON_FILE};${ANDROID_APK_BINARY_PATH};${ANDROID_APK_FILES};${ANDROID_APK_BINARY_DIRS_DEPENDS}"
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM
|
||||
)
|
||||
VERBATIM)
|
||||
add_custom_target("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apk"
|
||||
COMMENT "Android APK"
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}"
|
||||
)
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}")
|
||||
if (NOT TARGET apk)
|
||||
add_custom_target(apk)
|
||||
endif ()
|
||||
|
@ -286,16 +277,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
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
|
||||
)
|
||||
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")
|
||||
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 ()
|
||||
|
@ -306,7 +292,6 @@ 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}"
|
||||
)
|
||||
DEPENDS "${ANDROID_APK_FILE_PATH}")
|
||||
|
||||
set(ANDROID_APK_CONFIGURED YES)
|
||||
|
|
|
@ -60,21 +60,16 @@ if(JS_PROVIDER)
|
|||
endif ()
|
||||
include(TemplateFinder)
|
||||
find_template_file("jsdefs.h" QT_UTILITIES JS_DEFS_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${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
|
||||
)
|
||||
find_template_file("jsincludes.h" QT_UTILITIES JS_INCLUDES_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${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"
|
||||
)
|
||||
list(APPEND WIDGETS_FILES "${JS_HEADER_DIR}/jsdefs.h" "${JS_HEADER_DIR}/jsincludes.h")
|
||||
endif ()
|
||||
|
||||
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${JS_DEFINITION})
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
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)
|
||||
|
@ -19,9 +18,8 @@ if(TARGET_CONFIG_DONE)
|
|||
message(FATAL_ERROR "Can not include QtConfig module when targets are already configured.")
|
||||
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})
|
||||
|
@ -74,8 +72,8 @@ foreach(KF_MODULE ${IMPORTED_KF_MODULES})
|
|||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# built-in platform, imageformat and iconengine plugins when linking statically against Qt Gui
|
||||
# -> determine whether application target links statically against Qt Gui
|
||||
# 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)
|
||||
|
@ -103,8 +101,8 @@ if(USING_STATIC_QT_GUI_FOR_APPLICATION)
|
|||
message(WARNING "The required platform plugin for your platform is unknown an can not be linked in statically.")
|
||||
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)
|
||||
|
@ -156,24 +154,21 @@ option(BUILTIN_TRANSLATIONS "enables/disables built-in translations when buildin
|
|||
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"
|
||||
)
|
||||
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"
|
||||
)
|
||||
"/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
|
||||
# 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})
|
||||
|
@ -195,20 +190,24 @@ 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}
|
||||
${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}
|
||||
)
|
||||
OPTIONS
|
||||
${LUPDATE_OPTIONS})
|
||||
add_custom_target(${META_PROJECT_NAME}_translations DEPENDS ${QM_FILES})
|
||||
if (NOT TARGET translations)
|
||||
add_custom_target(translations DEPENDS ${META_PROJECT_NAME}_translations)
|
||||
|
@ -218,15 +217,12 @@ if(ENABLE_QT_TRANSLATIONS AND TS_FILES)
|
|||
|
||||
# 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
|
||||
)
|
||||
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 ()
|
||||
|
@ -234,10 +230,14 @@ if(ENABLE_QT_TRANSLATIONS AND TS_FILES)
|
|||
list(APPEND APP_SPECIFIC_QT_TRANSLATION_FILES "${META_PROJECT_NAME}")
|
||||
endif ()
|
||||
|
||||
# make application specific translation available as array via config.h
|
||||
# (even if this project has no translations, there might be some from dependencies)
|
||||
# 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)
|
||||
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 ()
|
||||
|
@ -266,7 +266,8 @@ endif()
|
|||
# add icons to be built-in
|
||||
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)
|
||||
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)
|
||||
|
@ -281,7 +282,10 @@ if(REQUIRED_ICONS)
|
|||
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}")
|
||||
string(REGEX MATCHALL
|
||||
"([^:]+|[^:]+$)"
|
||||
ICON_THEME_PARTS
|
||||
"${ICON_THEME}")
|
||||
list(LENGTH ICON_THEME_PARTS ICON_THEME_PARTS_LENGTH)
|
||||
if ("${ICON_THEME_PARTS_LENGTH}" STREQUAL 2)
|
||||
list(GET ICON_THEME_PARTS 0 ICON_THEME)
|
||||
|
@ -293,13 +297,23 @@ if(REQUIRED_ICONS)
|
|||
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.")
|
||||
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")
|
||||
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")
|
||||
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}")
|
||||
|
@ -315,32 +329,58 @@ if(REQUIRED_ICONS)
|
|||
"${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})
|
||||
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.")
|
||||
message(
|
||||
STATUS
|
||||
"Icon files for specified theme \"${ICON_THEME}\" are skipped because these are provided as fallback anyways."
|
||||
)
|
||||
set(GLOBBED_ICON_THEME_FILES)
|
||||
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})
|
||||
# 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}")
|
||||
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 ()
|
||||
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}")
|
||||
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>")
|
||||
list(APPEND ICON_THEME_FILES
|
||||
"<file${ICON_THEME_FILE_ALIAS}>${NEW_ICON_THEME_FILE_RELATIVE_PATH}</file>")
|
||||
endforeach ()
|
||||
break()
|
||||
endif ()
|
||||
|
@ -352,7 +392,10 @@ if(REQUIRED_ICONS)
|
|||
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 ()
|
||||
|
@ -380,7 +423,8 @@ if(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
|
||||
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 ()
|
||||
|
@ -401,11 +445,9 @@ if(WIDGETS_UI_FILES AND WIDGETS_GUI)
|
|||
# also add install for header files generated by uic
|
||||
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"
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_${UI_NAME}.h"
|
||||
DESTINATION "include/${META_PROJECT_NAME}/ui"
|
||||
COMPONENT ui-header
|
||||
)
|
||||
COMPONENT ui-header)
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
@ -413,9 +455,6 @@ 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)
|
||||
|
|
|
@ -14,7 +14,11 @@ endif()
|
|||
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)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Widgets)
|
||||
|
@ -30,7 +34,10 @@ endif()
|
|||
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)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Qml Quick)
|
||||
|
@ -53,8 +60,8 @@ else()
|
|||
message(STATUS "Building WITHOUT Qt Quick GUI.")
|
||||
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)
|
||||
# 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
|
||||
|
@ -71,7 +78,8 @@ 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)
|
||||
|
|
|
@ -17,18 +17,29 @@ 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}")
|
||||
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"))
|
||||
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}")
|
||||
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
|
||||
# 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")
|
||||
|
@ -39,9 +50,9 @@ macro(find_qt5_module MODULE REQUIRED)
|
|||
|
||||
# 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
|
||||
# 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})
|
||||
|
@ -57,9 +68,8 @@ macro(find_qt5_module MODULE REQUIRED)
|
|||
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)
|
||||
# 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)
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "Qt5::")
|
||||
|
@ -68,22 +78,29 @@ macro(find_qt5_module MODULE REQUIRED)
|
|||
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.")
|
||||
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
|
||||
# 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}")
|
||||
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.")
|
||||
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)
|
||||
|
@ -106,24 +123,35 @@ endmacro()
|
|||
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")
|
||||
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}")
|
||||
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)
|
||||
get_target_property(QMAKE_BIN Qt5::qmake IMPORTED_LOCATION)
|
||||
execute_process(
|
||||
COMMAND "${QMAKE_BIN}" -query "${QMAKE_VARIABLE}"
|
||||
execute_process(COMMAND "${QMAKE_BIN}" -query "${QMAKE_VARIABLE}"
|
||||
RESULT_VARIABLE "${QMAKE_VARIABLE}_RESULT"
|
||||
OUTPUT_VARIABLE "${QMAKE_VARIABLE}"
|
||||
)
|
||||
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}}\".")
|
||||
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}}")
|
||||
string(REGEX
|
||||
REPLACE "\n$"
|
||||
""
|
||||
"${QMAKE_VARIABLE}"
|
||||
"${${QMAKE_VARIABLE}}")
|
||||
message(STATUS "qmake variable ${QMAKE_VARIABLE} is ${${QMAKE_VARIABLE}}")
|
||||
endmacro ()
|
||||
|
|
|
@ -59,21 +59,16 @@ if(WEBVIEW_PROVIDER)
|
|||
endif ()
|
||||
include(TemplateFinder)
|
||||
find_template_file("webviewdefs.h" QT_UTILITIES WEBVIEWDEFS_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${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
|
||||
)
|
||||
find_template_file("webviewincludes.h" QT_UTILITIES WEBVIEWINCLUDES_H_TEMPLATE_FILE)
|
||||
configure_file(
|
||||
"${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"
|
||||
)
|
||||
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