Warning, /education/gcompris/cmake/rcc.cmake is written in an unsupported language. File is not indexed.
0001 #============================================================================= 0002 # SPDX-FileCopyrightText: 2016 Johnny Jazeix <jazeix@gmail.com> 0003 # 0004 # SPDX-License-Identifier: BSD-3-Clause 0005 #============================================================================= 0006 # 0007 # GCOMPRIS_ADD_RCC(resource_path <file list>) 0008 # 0009 function(GCOMPRIS_ADD_RCC resource_path) 0010 0011 set(options) 0012 set(oneValueArgs) 0013 set(multiValueArgs) 0014 cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 0015 set(rcc_files ${_RCC_UNPARSED_ARGUMENTS}) 0016 0017 get_filename_component(activity "${resource_path}" NAME) 0018 0019 if(WIN32) 0020 # (cannot create it in the build dir because rcc expect local files) 0021 # Create this QRC file 0022 set(CREATED_QRC "${CMAKE_CURRENT_SOURCE_DIR}/${activity}.qrc") 0023 else() 0024 set(CREATED_QRC "${CMAKE_CURRENT_BINARY_DIR}/${activity}.qrc") 0025 endif() 0026 0027 set(ACTIVITY_PATH "/gcompris/src/${resource_path}") 0028 file(GLOB QRC_CONTENTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${rcc_files}) 0029 file(GLOB QRC_CONTENTS_ABS ${CMAKE_CURRENT_SOURCE_DIR} ${rcc_files}) 0030 0031 file(WRITE ${CREATED_QRC} "<RCC>\n\t<qresource prefix=\"${ACTIVITY_PATH}\">") 0032 foreach(FILE ${QRC_CONTENTS}) 0033 file(APPEND ${CREATED_QRC} "\n\t\t<file>${FILE}</file>") 0034 endforeach() 0035 file(APPEND ${CREATED_QRC} "\n\t</qresource>\n</RCC>\n") 0036 list(APPEND QRC_FILES ${CREATED_QRC}) 0037 0038 set(CREATED_RCC ${GCOMPRIS_RCC_DIR}/${activity}.rcc) 0039 0040 if(WIN32) 0041 set(_RCC_COMMAND Qt5::rcc "--format-version" 2 "--binary" -o ${CREATED_RCC} ${CREATED_QRC}) 0042 else() 0043 set(_RCC_COMMAND Qt5::rcc "--format-version" 2 "--binary" -o ${CREATED_RCC} - < ${CREATED_QRC}) 0044 endif() 0045 0046 add_custom_command(OUTPUT ${CREATED_RCC} 0047 COMMAND ${_RCC_COMMAND} 0048 DEPENDS ${QRC_CONTENTS} "${out_depends}" VERBATIM 0049 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 0050 0051 if(CMAKE_HOST_APPLE) 0052 install(FILES ${CREATED_RCC} DESTINATION ${GCOMPRIS_EXECUTABLE_NAME}.app/Contents/MacOS/rcc) 0053 else() 0054 install(FILES ${CREATED_RCC} DESTINATION share/${GCOMPRIS_EXECUTABLE_NAME}/rcc) 0055 endif() 0056 0057 add_custom_target( 0058 rcc_${activity} ALL 0059 DEPENDS createShareFolders ${CREATED_RCC} ${CREATED_QRC} 0060 COMMENT "Generate ${activity} RCC" 0061 SOURCES ${QRC_CONTENTS} 0062 VERBATIM 0063 ) 0064 0065 endfunction()