Apply cmake-format and clang-format

This commit is contained in:
Martchus 2020-12-20 17:56:35 +01:00
parent 746615e21e
commit d6ea2ac378
6 changed files with 45 additions and 26 deletions

View File

@ -140,7 +140,7 @@ if (NOT ANDROID_APK_TOOLCHAIN_VERSION AND NOT ANDROID_APK_TOOL_PREFIX STREQUAL "
message(STATUS "Auto-detected ANDROID_APK_TOOLCHAIN_VERSION: ${ANDROID_APK_TOOLCHAIN_VERSION}")
endif ()
# determine Android build tools version note: Assuming the build tools are installed under "${ANDROID_APK_SDK}/build-tools"
# determine Android build tools version - note: Assuming the build tools are installed under "${ANDROID_APK_SDK}/build-tools"
file(
GLOB ANDROID_APK_BUILD_TOOLS_VERSIONS
LIST_DIRECTORIES TRUE
@ -151,8 +151,8 @@ if (NOT ANDROID_APK_BUILD_TOOLS_VERSIONS)
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")
@ -203,7 +203,8 @@ 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")
@ -233,14 +234,14 @@ endfunction ()
add_android_apk_extra_libs("${META_TARGET_NAME}")
list_to_string("," "" "" "${ANDROID_APK_EXTRA_LIBS}" ANDROID_APK_EXTRA_LIBS)
# determine host architecture
# note: ANDROID_HOST_TAG is set supposed to be set by the NDK toolchain file. If not, fallback to CMake's CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG variable.
# determine host architecture - note: ANDROID_HOST_TAG is set supposed to be set by the NDK toolchain file. If not, fallback
# to CMake's CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG variable.
if (NOT ANDROID_HOST_TAG)
set(ANDROID_HOST_TAG "${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}")
endif ()
# determine Android architecture
# note: ANDROID_ABI is set supposed to be set by the NDK toolchain file. If not, fallback to CMake's CMAKE_ANDROID_ARCH_ABI variable.
# determine Android architecture - note: ANDROID_ABI is set supposed to be set by the NDK toolchain file. If not, fallback to
# CMake's CMAKE_ANDROID_ARCH_ABI variable.
if (NOT ANDROID_ABI)
set(ANDROID_ABI "${CMAKE_ANDROID_ARCH_ABI}")
endif ()

View File

@ -226,7 +226,8 @@ endif ()
# option for built-in translations
option(BUILTIN_TRANSLATIONS "enables/disables built-in translations when building applications and libraries" OFF)
option(BUILTIN_TRANSLATIONS_OF_QT "enables/disables built-in translations of Qt itself when building applications" "${BUILTIN_TRANSLATIONS}")
option(BUILTIN_TRANSLATIONS_OF_QT "enables/disables built-in translations of Qt itself when building applications"
"${BUILTIN_TRANSLATIONS}")
# determine relevant Qt translation files
set(QT_TRANSLATION_FILES)
@ -241,9 +242,13 @@ if (CMAKE_FIND_ROOT_PATH)
"${ROOT_PATH}/${CMAKE_INSTALL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations")
endforeach ()
endif ()
list(APPEND QT_TRANSLATION_SEARCH_PATHS "${CMAKE_INSTALL_FULL_DATAROOTDIR}/qt/translations"
"${CMAKE_INSTALL_FULL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations" "/usr/${CMAKE_INSTALL_DATAROOTDIR}/qt/translations"
"/usr/${CMAKE_INSTALL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations")
list(
APPEND
QT_TRANSLATION_SEARCH_PATHS
"${CMAKE_INSTALL_FULL_DATAROOTDIR}/qt/translations"
"${CMAKE_INSTALL_FULL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations"
"/usr/${CMAKE_INSTALL_DATAROOTDIR}/qt/translations"
"/usr/${CMAKE_INSTALL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations")
list(REMOVE_DUPLICATES QT_TRANSLATION_SEARCH_PATHS)
set(QT_TRANSLATIONS_FOUND NO)
foreach (QT_TRANSLATION_PATH ${QT_TRANSLATION_SEARCH_PATHS})
@ -342,7 +347,9 @@ if (ENABLE_QT_TRANSLATIONS AND TS_FILES)
endif ()
# add install target for translations
if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS AND NOT BUILTIN_TRANSLATIONS)
if (NOT META_NO_INSTALL_TARGETS
AND ENABLE_INSTALL_TARGETS
AND NOT BUILTIN_TRANSLATIONS)
install(
FILES ${QM_FILES}
DESTINATION "${META_DATA_DIR}/translations"

View File

@ -15,7 +15,7 @@ include(3rdParty)
if (NOT META_QT_VERSION)
if (META_QT5_VERSION)
# use deprecated META_QT5_VERSION variable (for compatibility)
set (META_QT_VERSION "${META_QT5_VERSION}")
set(META_QT_VERSION "${META_QT5_VERSION}")
else ()
# require Qt 5.6 or higher by default
set(META_QT_VERSION 5.6)
@ -92,7 +92,9 @@ macro (use_qt_module)
if (NOT TARGET "${PLUGIN_TARGET}")
find_package("${ARGS_PREFIX}${ARGS_MODULE}" "${META_QT_VERSION}" REQUIRED)
endif ()
if (NOT TARGET "${PLUGIN_TARGET}" AND PLUGIN MATCHES "Svg.*" AND ARGS_MODULE STREQUAL "Svg")
if (NOT TARGET "${PLUGIN_TARGET}"
AND PLUGIN MATCHES "Svg.*"
AND ARGS_MODULE STREQUAL "Svg")
# look for Svg plugins within the Gui module's directory as well
find_package("${ARGS_PREFIX}Gui" "${META_QT_VERSION}" REQUIRED)
set(PLUGIN_CONFIG "${${ARGS_PREFIX}Gui_DIR}/${ARGS_PREFIX}Q${PLUGIN}PluginConfig.cmake")
@ -101,7 +103,9 @@ macro (use_qt_module)
endif ()
endif ()
if (NOT TARGET "${PLUGIN_TARGET}")
message(FATAL_ERROR "The ${ARGS_PREFIX}${ARGS_MODULE} package does not provide the target ${ARGS_PREFIX}::Q${PLUGIN}Plugin.")
message(
FATAL_ERROR
"The ${ARGS_PREFIX}${ARGS_MODULE} package does not provide the target ${ARGS_PREFIX}::Q${PLUGIN}Plugin.")
endif ()
if ("${PLUGIN_TARGET}" IN_LIST "${ARGS_LIBRARIES_VARIABLE}")
continue()
@ -175,23 +179,28 @@ function (query_qmake_variable_path QMAKE_VARIABLE)
if (EXISTS "${VARIABLE_VALUE}")
get_filename_component(VARIABLE_VALUE "${VARIABLE_VALUE}" REALPATH)
message(STATUS "Qt variable ${QMAKE_VARIABLE} resolved to path: ${VARIABLE_VALUE}")
set("${QMAKE_VARIABLE}" "${VARIABLE_VALUE}" PARENT_SCOPE)
set("${QMAKE_VARIABLE}"
"${VARIABLE_VALUE}"
PARENT_SCOPE)
return()
endif ()
# assume VARIABLE_VALUE is relative within CMAKE_FIND_ROOT_PATH, e.g. QT_INSTALL_TRANSLATIONS might be
# set to "share/qt6/translations"
# assume VARIABLE_VALUE is relative within CMAKE_FIND_ROOT_PATH, e.g. QT_INSTALL_TRANSLATIONS might be set to
# "share/qt6/translations"
foreach (ROOT_PATH ${CMAKE_FIND_ROOT_PATH} "")
foreach (PREFIX_PATH ${CMAKE_PREFIX_PATH} "")
string(JOIN "/" FULL_PATH ${ROOT_PATH} ${PREFIX_PATH} ${VARIABLE_VALUE})
if (EXISTS "${FULL_PATH}")
set("${QMAKE_VARIABLE}" "${FULL_PATH}" PARENT_SCOPE)
set("${QMAKE_VARIABLE}"
"${FULL_PATH}"
PARENT_SCOPE)
message(STATUS "Qt variable ${QMAKE_VARIABLE} resolved to path: ${FULL_PATH}")
return()
else ()
list(APPEND CHECKED_PATHS "${FULL_PATH}")
endif ()
endforeach()
endforeach ()
endforeach ()
message(WARNING "Unable to resolve Qt variable ${QMAKE_VARIABLE} to an existing path, was checking for: ${CHECKED_PATHS}")
message(
WARNING "Unable to resolve Qt variable ${QMAKE_VARIABLE} to an existing path, was checking for: ${CHECKED_PATHS}")
endfunction ()

View File

@ -62,7 +62,7 @@ inline StringView midRef(const QString &str, int pos, int n = -1)
/*!
* \brief Splits \a str into QStringViews, QStringRefs or QStrings depending on the Qt version.
*/
template <class... SplitArgs> inline auto splitRef(const QString &str, SplitArgs &&... args)
template <class... SplitArgs> inline auto splitRef(const QString &str, SplitArgs &&...args)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QStringView(str).split(std::forward<SplitArgs>(args)...);

View File

@ -115,7 +115,9 @@ inline NotificationImage::NotificationImage(const QImage &image)
, height(image.height())
, rowstride(image.bytesPerLine())
, hasAlpha(image.hasAlphaChannel())
, channels(image.isGrayscale() ? 1 : hasAlpha ? 4 : 3)
, channels(image.isGrayscale() ? 1
: hasAlpha ? 4
: 3)
, bitsPerSample(image.depth() / channels)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
, data(reinterpret_cast<const char *>(image.bits()), static_cast<int>(image.sizeInBytes()))

View File

@ -83,10 +83,10 @@ QtConfigArguments::QtConfigArguments()
m_platformThemeArg.setPreDefinedCompletionValues("kde gnome "
#if QT_VERSION_MAJOR == 5
"qt5ct"
#elif QT_VERSION_MAJOR == 6
#elif QT_VERSION_MAJOR == 6
"qt6ct"
#endif
);
);
m_platformThemeArg.setEnvironmentVariable("QT_QPA_PLATFORMTHEME");
m_sceneGraphRenderLoopArg.setRequiredValueCount(1);
m_sceneGraphRenderLoopArg.setCombinable(true);