diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-05 21:03:06 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-05 21:03:06 +0200 |
commit | 7cb42f4368e873e5930cf84bc2494a8e8172a046 (patch) | |
tree | ed773278240546b1b525c066b95a4e69150aabf1 /gui/Qt5Customizations.cmake | |
parent | bd08f9e698269764d9e06052470d4a699f69f951 (diff) | |
download | nextpnr-7cb42f4368e873e5930cf84bc2494a8e8172a046.tar.gz nextpnr-7cb42f4368e873e5930cf84bc2494a8e8172a046.tar.bz2 nextpnr-7cb42f4368e873e5930cf84bc2494a8e8172a046.zip |
Initial GUI work
Diffstat (limited to 'gui/Qt5Customizations.cmake')
-rw-r--r-- | gui/Qt5Customizations.cmake | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gui/Qt5Customizations.cmake b/gui/Qt5Customizations.cmake new file mode 100644 index 00000000..39d3a644 --- /dev/null +++ b/gui/Qt5Customizations.cmake @@ -0,0 +1,60 @@ +include(CMakeParseArguments) + +# qt5_wrap_ui_custom(outfiles inputfile ... ) + +function(QT5_WRAP_UI_CUSTOM outfiles ) + set(options) + set(oneValueArgs) + set(multiValueArgs OPTIONS) + + cmake_parse_arguments(_WRAP_UI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(ui_files ${_WRAP_UI_UNPARSED_ARGUMENTS}) + set(ui_options ${_WRAP_UI_OPTIONS}) + + foreach(it ${ui_files}) + get_filename_component(outfile ${it} NAME_WE) + get_filename_component(infile ${it} ABSOLUTE) + set(outfile ${CMAKE_CURRENT_BINARY_DIR}/generated/ui_${outfile}.h) + add_custom_command(OUTPUT ${outfile} + COMMAND ${Qt5Widgets_UIC_EXECUTABLE} + ARGS ${ui_options} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} VERBATIM) + list(APPEND ${outfiles} ${outfile}) + endforeach() + set(${outfiles} ${${outfiles}} PARENT_SCOPE) +endfunction() + +# qt5_add_resources_custom(outfiles inputfile ... ) + +function(QT5_ADD_RESOURCES_CUSTOM 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(outfile ${CMAKE_CURRENT_BINARY_DIR}/generated/qrc_${outfilename}.cc) + + _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) + + add_custom_command(OUTPUT ${outfile} + COMMAND ${Qt5Core_RCC_EXECUTABLE} + ARGS ${rcc_options} --name ${outfilename} --output ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} + DEPENDS ${_rc_depends} "${out_depends}" VERBATIM) + list(APPEND ${outfiles} ${outfile}) + endforeach() + set(${outfiles} ${${outfiles}} PARENT_SCOPE) +endfunction()
\ No newline at end of file |