diff options
author | Andy Shaw <andy.shaw@qt.io> | 2018-05-18 12:19:38 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-08-16 08:56:27 +0000 |
commit | cdccd0222bbed1954d5d7fe0da9d2308c202f3b1 (patch) | |
tree | 6dfe692118d1bb591258cfc2cfcb13b2fc0189b1 /src/corelib/Qt5CoreMacros.cmake | |
parent | 44b6757fe50b6bf581864d3da519a3ff60818fa8 (diff) |
Add support for big resources with CMake
Task-number: QTBUG-55680
Change-Id: I09570a4e959ffd0e6d378bc315b13d57baaa82e8
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Diffstat (limited to 'src/corelib/Qt5CoreMacros.cmake')
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 819b48f973..581c99ed58 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -293,6 +293,49 @@ function(QT5_ADD_RESOURCES outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +# qt5_add_big_resources(outfiles inputfile ... ) + +function(QT5_ADD_BIG_RESOURCES outfiles ) + + set(options) + set(oneValueArgs) + set(multiValueArgs OPTIONS) + + cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(rcc_files ${_RCC_UNPARSED_ARGUMENTS}) + set(rcc_options ${_RCC_OPTIONS}) + + if("${rcc_options}" MATCHES "-binary") + message(WARNING "Use qt5_add_binary_resources for binary option") + endif() + + foreach(it ${rcc_files}) + get_filename_component(outfilename ${it} NAME_WE) + get_filename_component(infile ${it} ABSOLUTE) + set(tmpoutfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}tmp.cpp) + set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.o) + + _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) + set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON) + add_custom_command(OUTPUT ${tmpoutfile} + COMMAND ${Qt5Core_RCC_EXECUTABLE} ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile} + DEPENDS ${infile} ${_rc_depends} "${out_depends}" VERBATIM) + set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOMOC ON) + set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOUIC ON) + add_custom_target(big_resources_${outfilename} ALL DEPENDS ${tmpoutfile}) + add_library(rcc_object_${outfilename} OBJECT ${tmpoutfile}) + add_dependencies(rcc_object_${outfilename} big_resources_${outfilename}) + add_custom_command(OUTPUT ${outfile} + COMMAND ${Qt5Core_RCC_EXECUTABLE} + ARGS ${rcc_options} --name ${outfilename} --pass 2 --temp $<TARGET_OBJECTS:rcc_object_${outfilename}> --output ${outfile} ${infile} + DEPENDS rcc_object_${outfilename} + VERBATIM) + list(APPEND ${outfiles} ${outfile}) + endforeach() + set(${outfiles} ${${outfiles}} PARENT_SCOPE) +endfunction() + set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) |