aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlcachegen
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-06-26 16:23:02 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-03 07:45:21 +0000
commitb262605c806a6572f31cf9a50aab7b0e10cbc951 (patch)
tree649b5c2468bb6a7e6a745ab284e921e5f909639d /tools/qmlcachegen
parent32c33ee9abec1ef2f05233c3a613689431f6654b (diff)
Fix qtquick_compiler_add_resources when cross-compiling
Attempt to locate the qmlcachegen binary in the host bin directory if possible. Task-number: QTBUG-68724 Change-Id: If0d28408a316b3dd33f4734464e0d5fe44c9fc2c Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmlcachegen')
-rw-r--r--tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in (renamed from tools/qmlcachegen/Qt5QuickCompilerConfig.cmake)36
-rw-r--r--tools/qmlcachegen/qmlcachegen.pro16
2 files changed, 40 insertions, 12 deletions
diff --git a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
index 49ba4edde9..e4963c3a33 100644
--- a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake
+++ b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
@@ -2,9 +2,9 @@ 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 "/" "_" relpath ${relpath})
+ string(REPLACE \".qml\" \"_qml\" relpath ${relpath})
+ string(REPLACE \".js\" \"_js\" relpath ${relpath})
+ string(REPLACE \"/\" \"_\" relpath ${relpath})
set(${outvariable} ${CMAKE_CURRENT_BINARY_DIR}/${relpath}.cpp PARENT_SCOPE)
endfunction()
@@ -13,11 +13,26 @@ function(QTQUICK_COMPILER_ADD_RESOURCES outfiles)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
- cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_RCC \"${options}\" \"${oneValueArgs}\" \"${multiValueArgs}\" ${ARGN})
find_package(Qt5 COMPONENTS Qml Core)
- set(compiler_path "${_qt5Core_install_prefix}/bin/qmlcachegen")
+!!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)
@@ -37,18 +52,18 @@ function(QTQUICK_COMPILER_ADD_RESOURCES outfiles)
execute_process(COMMAND ${compiler_path} -filter-resource-file ${input_resource} -o ${new_resource_file} OUTPUT_VARIABLE remaining_files)
if(remaining_files)
list(APPEND filtered_rcc_files ${new_resource_file})
- list(APPEND loader_flags "--resource-file-mapping=${_resource}=${new_resource_file}")
+ list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\")
else()
- list(APPEND loader_flags "--resource-file-mapping=${_resource}")
+ list(APPEND loader_flags \"--resource-file-mapping=${_resource}\")
endif()
set(rcc_file_with_compilation_units)
- execute_process(COMMAND ${rcc_path} -list "${input_resource}" OUTPUT_VARIABLE rcc_contents)
- string(REGEX REPLACE "[\r\n]+" ";" rcc_contents ${rcc_contents})
+ execute_process(COMMAND ${rcc_path} -list \"${input_resource}\" OUTPUT_VARIABLE rcc_contents)
+ 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")
+ if(extension STREQUAL \".qml\" OR extension STREQUAL \".js\" OR extension STREQUAL \".ui.qml\")
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})
@@ -70,4 +85,3 @@ function(QTQUICK_COMPILER_ADD_RESOURCES outfiles)
qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${options})
set(${outfiles} ${output_resources} ${compiler_output} PARENT_SCOPE)
endfunction()
-
diff --git a/tools/qmlcachegen/qmlcachegen.pro b/tools/qmlcachegen/qmlcachegen.pro
index 391f0c3889..9662690395 100644
--- a/tools/qmlcachegen/qmlcachegen.pro
+++ b/tools/qmlcachegen/qmlcachegen.pro
@@ -14,7 +14,21 @@ build_integration.path = $$[QT_HOST_DATA]/mkspecs/features
prefix_build: INSTALLS += build_integration
else: COPIES += build_integration
-cmake_build_integration.files = Qt5QuickCompilerConfig.cmake
+load(cmake_functions)
+
+CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+ CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+ CMAKE_BIN_DIR_IS_ABSOLUTE = True
+}
+
+load(qt_build_paths)
+
+cmake_config_file.input = $$PWD/Qt5QuickCompilerConfig.cmake.in
+cmake_config_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5QuickCompiler/Qt5QuickCompilerConfig.cmake
+QMAKE_SUBSTITUTES += cmake_config_file
+
+cmake_build_integration.files = $$cmake_config_file.output
cmake_build_integration.path = $$[QT_INSTALL_LIBS]/cmake/Qt5QuickCompiler
prefix_build: INSTALLS += cmake_build_integration
else: COPIES += cmake_build_integration