[qml] Tidy up cmake bits, credit to contributor

This commit is contained in:
Adriaan de Groot 2024-02-04 22:26:03 +01:00
parent 25f9eaf523
commit 4e065b1ba9
5 changed files with 57 additions and 92 deletions

View File

@ -10,9 +10,12 @@ the history of the 3.2 series (2018-05 - 2022-08).
# 3.3.2 (unreleased)
This release contains contributions from (alphabetically by first name):
- nobody, yet!
- Adriaan de Groot
- Jonathan Riddell
## Core ##
- Slideshow support code (QML) now ported to Qt and made available
as two separate directories of support-code. (thanks Jon)
## Modules ##

View File

@ -14,13 +14,7 @@ include(CalamaresAddTranslations)
add_subdirectory(libcalamares)
add_subdirectory(libcalamaresui)
if(WITH_QT6)
# all things qml
add_subdirectory(qml/calamares-qt6)
else()
# all things qml
add_subdirectory(qml/calamares-qt5)
endif()
add_subdirectory(qml)
# application
add_subdirectory(calamares)

50
src/qml/CMakeLists.txt Normal file
View File

@ -0,0 +1,50 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
# Install "slideshows" and other QML-sources for Calamares.
#
# In practice, in the central source repositoy, this means
# just-install-the-slideshow-example. For alternative slideshows,
# see the approach in the calamares-extensions repository.
function(calamares_install_qml)
# Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir,
# and install them into share/calamares/qml/calamares
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${qml_subdir} "*")
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
if(
IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}"
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir"
)
set(QML_DIR share/calamares/qml)
set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY})
# We glob all the files inside the subdirectory, and we make sure they are
# synced with the bindir structure and installed.
file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*")
foreach(QML_MODULE_FILE ${QML_MODULE_FILES})
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE})
configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}
DESTINATION ${QML_MODULE_DESTINATION}
)
endif()
endforeach()
message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}")
endif()
endforeach()
message("")
endfunction()
if(WITH_QT6)
add_subdirectory(calamares-qt6)
else()
add_subdirectory(calamares-qt5)
endif()

View File

@ -1,42 +1 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
# Install "slideshows" and other QML-sources for Calamares.
#
# In practice, in the central source repositoy, this means
# just-install-the-slideshow-example. For alternative slideshows,
# see the approach in the calamares-extensions repository.
# Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir,
# and install them into share/calamares/qml/calamares
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
if(
IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}"
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir"
)
set(QML_DIR share/calamares/qml)
set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY})
# We glob all the files inside the subdirectory, and we make sure they are
# synced with the bindir structure and installed.
file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*")
foreach(QML_MODULE_FILE ${QML_MODULE_FILES})
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE})
configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}
DESTINATION ${QML_MODULE_DESTINATION}
)
endif()
endforeach()
message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}")
endif()
endforeach()
message("")
calamares_install_qml()

View File

@ -1,42 +1 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
# Install "slideshows" and other QML-sources for Calamares.
#
# In practice, in the central source repositoy, this means
# just-install-the-slideshow-example. For alternative slideshows,
# see the approach in the calamares-extensions repository.
# Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir,
# and install them into share/calamares/qml/calamares
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
if(
IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}"
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir"
)
set(QML_DIR share/calamares/qml)
set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY})
# We glob all the files inside the subdirectory, and we make sure they are
# synced with the bindir structure and installed.
file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*")
foreach(QML_MODULE_FILE ${QML_MODULE_FILES})
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE})
configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}
DESTINATION ${QML_MODULE_DESTINATION}
)
endif()
endforeach()
message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}")
endif()
endforeach()
message("")
calamares_install_qml()