aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-07-03 15:45:41 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-07-05 18:00:46 +0200
commit36b253eebdf5169709475a8e9b4726f3d19a771b (patch)
tree3b3ee2f62e5b1b34e3f64ed56e3c9508db9b76c5 /tools
parenta056cb9595ea4a41c93f4c912719f9523b943d3b (diff)
Prepare Qt5QuickCompiler.cmake.in for Qt6
Increment all the version numbers. Replace qtquick_compiler_add_resources with a warning and a call to qt6_add_resources. Task-number: QTBUG-85190 Change-Id: Ifed5449ab4d6312a57add870eee13175872146db Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlcachegen/.prev_CMakeLists.txt9
-rw-r--r--tools/qmlcachegen/CMakeLists.txt9
-rw-r--r--tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in86
-rw-r--r--tools/qmlcachegen/Qt6QuickCompilerConfig.cmake.in4
-rw-r--r--tools/qmlcachegen/qmlcachegen.pro6
5 files changed, 17 insertions, 97 deletions
diff --git a/tools/qmlcachegen/.prev_CMakeLists.txt b/tools/qmlcachegen/.prev_CMakeLists.txt
index afae63737a..d21161d202 100644
--- a/tools/qmlcachegen/.prev_CMakeLists.txt
+++ b/tools/qmlcachegen/.prev_CMakeLists.txt
@@ -4,7 +4,8 @@
## qmlcachegen Tool:
#####################################################################
-qt_add_tool(qmlcachegen
+qt_get_tool_target_name(target_name qmlcachegen)
+qt_add_tool(${target_name}
TARGET_DESCRIPTION "QML Cache Generator"
SOURCES
../shared/resourcefilemapper.cpp ../shared/resourcefilemapper.h
@@ -28,9 +29,9 @@ qt_add_tool(qmlcachegen
# build_integration.files = "qmlcache.prf" "qtquickcompiler.prf"
# build_integration.path = "$$[QT_HOST_DATA]/mkspecs/features"
# cmake_build_integration.files = "$$cmake_config_file.output"
-# cmake_build_integration.path = "$$[QT_INSTALL_LIBS]/cmake/Qt5QuickCompiler"
-# cmake_config_file.input = "$$PWD/Qt5QuickCompilerConfig.cmake.in"
-# cmake_config_file.output = "$$MODULE_BASE_OUTDIR/lib/cmake/Qt5QuickCompiler/Qt5QuickCompilerConfig.cmake"
+# cmake_build_integration.path = "$$[QT_INSTALL_LIBS]/cmake/Qt6QuickCompiler"
+# cmake_config_file.input = "$$PWD/Qt6QuickCompilerConfig.cmake.in"
+# cmake_config_file.output = "$$MODULE_BASE_OUTDIR/lib/cmake/Qt6QuickCompiler/Qt6QuickCompilerConfig.cmake"
## Scopes:
#####################################################################
diff --git a/tools/qmlcachegen/CMakeLists.txt b/tools/qmlcachegen/CMakeLists.txt
index d2c109d002..8bc705d3a8 100644
--- a/tools/qmlcachegen/CMakeLists.txt
+++ b/tools/qmlcachegen/CMakeLists.txt
@@ -4,7 +4,8 @@
## qmlcachegen Tool:
#####################################################################
-qt_add_tool(qmlcachegen
+qt_get_tool_target_name(target_name qmlcachegen)
+qt_add_tool(${target_name}
TARGET_DESCRIPTION "QML Cache Generator"
TOOLS_TARGET Qml # special case
SOURCES
@@ -29,9 +30,9 @@ qt_add_tool(qmlcachegen
# build_integration.files = "qmlcache.prf" "qtquickcompiler.prf"
# build_integration.path = "$$[QT_HOST_DATA]/mkspecs/features"
# cmake_build_integration.files = "$$cmake_config_file.output"
-# cmake_build_integration.path = "$$[QT_INSTALL_LIBS]/cmake/Qt5QuickCompiler"
-# cmake_config_file.input = "$$PWD/Qt5QuickCompilerConfig.cmake.in"
-# cmake_config_file.output = "$$MODULE_BASE_OUTDIR/lib/cmake/Qt5QuickCompiler/Qt5QuickCompilerConfig.cmake"
+# cmake_build_integration.path = "$$[QT_INSTALL_LIBS]/cmake/Qt6QuickCompiler"
+# cmake_config_file.input = "$$PWD/Qt6QuickCompilerConfig.cmake.in"
+# cmake_config_file.output = "$$MODULE_BASE_OUTDIR/lib/cmake/Qt6QuickCompiler/Qt6QuickCompilerConfig.cmake"
## Scopes:
#####################################################################
diff --git a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
deleted file mode 100644
index be2113b258..0000000000
--- a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
+++ /dev/null
@@ -1,86 +0,0 @@
-include(CMakeParseArguments)
-
-function(QTQUICK_COMPILER_DETERMINE_OUTPUT_FILENAME outvariable filename)
- file(RELATIVE_PATH relpath ${CMAKE_CURRENT_SOURCE_DIR} ${filename})
- string(REPLACE \".qml\" \"_qml\" relpath ${relpath})
- string(REPLACE \".js\" \"_js\" relpath ${relpath})
- string(REPLACE \".mjs\" \"_mjs\" relpath ${relpath})
- string(REPLACE \"/\" \"_\" relpath ${relpath})
- set(${outvariable} ${CMAKE_CURRENT_BINARY_DIR}/${relpath}.cpp PARENT_SCOPE)
-endfunction()
-
-function(QTQUICK_COMPILER_ADD_RESOURCES outfiles)
- set(options)
- set(oneValueArgs)
- set(multiValueArgs OPTIONS)
-
- cmake_parse_arguments(_RCC \"${options}\" \"${oneValueArgs}\" \"${multiValueArgs}\" ${ARGN})
-
- find_package(Qt5 COMPONENTS Qml Core)
-
-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
- set(compiler_path \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmlcachegen$$CMAKE_BIN_SUFFIX\")
-!!ELSE
- set(compiler_path \"$${CMAKE_BIN_DIR}qmlcachegen$$CMAKE_BIN_SUFFIX\")
-!!ENDIF
- if(NOT EXISTS \"${compiler_path}\" )
- message(FATAL_ERROR \"The package \\\"Qt5QuickCompilerConfig\\\" references the file
- \\\"${compiler_path}\\\"
-but this file does not exist. Possible reasons include:
-* The file was deleted, renamed, or moved to another location.
-* An install or uninstall procedure did not complete successfully.
-* The installation package was faulty and contained
- \\\"${CMAKE_CURRENT_LIST_FILE}\\\"
-but not all the files it references.
-\")
- endif()
-
- get_target_property(rcc_path ${Qt5Core_RCC_EXECUTABLE} IMPORTED_LOCATION)
-
- set(rcc_files ${_RCC_UNPARSED_ARGUMENTS})
- set(rcc_options ${_RCC_OPTIONS})
- set(filtered_rcc_files)
- set(compiler_output)
- set(rcc_files_with_compilation_units)
- set(loader_flags)
-
- foreach(_resource ${rcc_files})
- get_filename_component(resource_base ${_resource} NAME_WE)
- set(new_resource_file ${CMAKE_CURRENT_BINARY_DIR}/${resource_base}_qmlcache.qrc)
-
- get_filename_component(input_resource ${_resource} ABSOLUTE)
-
- execute_process(COMMAND ${compiler_path} --filter-resource-file ${input_resource} -o ${new_resource_file} OUTPUT_VARIABLE remaining_files)
- list(APPEND filtered_rcc_files ${new_resource_file})
- list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\")
-
- set(rcc_file_with_compilation_units)
-
- execute_process(COMMAND ${rcc_path} -list \"${input_resource}\" OUTPUT_VARIABLE rcc_contents)
- if (NOT rcc_contents STREQUAL \"\")
- string(REGEX REPLACE \"[\r\n]+\" \";\" rcc_contents ${rcc_contents})
- foreach(it ${rcc_contents})
- get_filename_component(extension ${it} EXT)
- if(extension STREQUAL \".qml\" OR extension STREQUAL \".js\" OR extension STREQUAL \".ui.qml\" OR extension STREQUAL \".mjs\")
- qtquick_compiler_determine_output_filename(output_file ${it})
- add_custom_command(OUTPUT ${output_file} COMMAND ${compiler_path} ARGS --resource=${input_resource} ${it} -o ${output_file} DEPENDS ${it})
- list(APPEND compiler_output ${output_file})
- set(rcc_file_with_compilation_units ${input_resource})
- endif()
- endforeach()
- endif()
-
- if(rcc_file_with_compilation_units)
- list(APPEND rcc_files_with_compilation_units ${rcc_file_with_compilation_units})
- endif()
- endforeach()
-
- if(rcc_files_with_compilation_units)
- set(loader_source ${CMAKE_CURRENT_BINARY_DIR}/qmlcache_loader.cpp)
- add_custom_command(OUTPUT ${loader_source} COMMAND ${compiler_path} ARGS ${loader_flags} ${rcc_files_with_compilation_units} -o ${loader_source} DEPENDS ${rcc_files_with_compilation_units})
- list(APPEND compiler_output ${loader_source})
- endif()
-
- qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${options})
- set(${outfiles} ${output_resources} ${compiler_output} PARENT_SCOPE)
-endfunction()
diff --git a/tools/qmlcachegen/Qt6QuickCompilerConfig.cmake.in b/tools/qmlcachegen/Qt6QuickCompilerConfig.cmake.in
new file mode 100644
index 0000000000..fe19af78cb
--- /dev/null
+++ b/tools/qmlcachegen/Qt6QuickCompilerConfig.cmake.in
@@ -0,0 +1,4 @@
+function(QTQUICK_COMPILER_ADD_RESOURCES)
+ message(WARNING "Use qt6_add_resources instead of qtquick_compiler_add_resources."
+ "QML and JavaScript files are automatically compiled then.")
+endfunction()
diff --git a/tools/qmlcachegen/qmlcachegen.pro b/tools/qmlcachegen/qmlcachegen.pro
index d6e4812e3f..d02746cff7 100644
--- a/tools/qmlcachegen/qmlcachegen.pro
+++ b/tools/qmlcachegen/qmlcachegen.pro
@@ -32,12 +32,12 @@ contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
load(qt_build_paths)
equals(QMAKE_HOST.os, Windows): CMAKE_BIN_SUFFIX = ".exe"
-cmake_config_file.input = $$PWD/Qt5QuickCompilerConfig.cmake.in
-cmake_config_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5QuickCompiler/Qt5QuickCompilerConfig.cmake
+cmake_config_file.input = $$PWD/Qt6QuickCompilerConfig.cmake.in
+cmake_config_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt6QuickCompiler/Qt6QuickCompilerConfig.cmake
QMAKE_SUBSTITUTES += cmake_config_file
cmake_build_integration.files = $$cmake_config_file.output
-cmake_build_integration.path = $$[QT_INSTALL_LIBS]/cmake/Qt5QuickCompiler
+cmake_build_integration.path = $$[QT_INSTALL_LIBS]/cmake/Qt6QuickCompiler
prefix_build: INSTALLS += cmake_build_integration
else: COPIES += cmake_build_integration