From 32d748e8fbfcf5a9a0405fd058af900622afbb66 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 6 Mar 2024 18:46:37 +0300 Subject: [PATCH] cmake: add the rest tools to build Signed-off-by: Alexander Golubev --- TQtMacros.cmake | 110 ++++++++++++++++++++++++++++++++ tools/maketqpf/CMakeLists.txt | 16 +++++ tools/msg2tqm/CMakeLists.txt | 14 ++++ tools/qembed/CMakeLists.txt | 12 ++++ tools/qtconfig/CMakeLists.txt | 36 +++++++++++ tools/tqtmergetr/CMakeLists.txt | 14 ++++ tools/tqvfb/CMakeLists.txt | 26 ++++++++ 7 files changed, 228 insertions(+) create mode 100644 tools/maketqpf/CMakeLists.txt create mode 100644 tools/msg2tqm/CMakeLists.txt create mode 100644 tools/qembed/CMakeLists.txt create mode 100644 tools/qtconfig/CMakeLists.txt create mode 100644 tools/tqtmergetr/CMakeLists.txt create mode 100644 tools/tqvfb/CMakeLists.txt diff --git a/TQtMacros.cmake b/TQtMacros.cmake index 9cd48750..f6f856ab 100644 --- a/TQtMacros.cmake +++ b/TQtMacros.cmake @@ -281,6 +281,116 @@ macro( tqt_automoc ) endmacro( tqt_automoc ) +################################################# +##### +##### tqt_uic_embed +##### +##### The macro embeds given list of FILES into cpp source file OUTPUT and then adds +##### sad file to the dependencies of the TARGET (if specified). Either TARGET or +##### PROJECT and OUTPUT must be specified. +##### +##### Syntax: +##### tqt_uic_embed ( +##### [[TARGET] target] +##### [OUTPUT out] +##### [PROJECT project] +##### FILES file [file ...] +##### ) +##### +##### @arg TARGET a name of the target the giles should be add as a dependencies to +##### @arg OUTPUT a fileneme the resulting cpp file will be writen to. If not +##### specified the name will be autoselected based on TARGET. +##### @arg PROJECT a suffix of a classname which will be used to access the +##### files from source code, if not specified TARGET is used. +##### @arg FILES a list of files to embed. +##### + +function(tqt_uic_embed) + unset( _target ) + unset( _project ) + unset( _output ) + unset( _files ) + unset( _directive ) + set( _var _target ) + + foreach( _arg ${ARGN} ) + + # found directive "TARGET" + if( "+${_arg}" STREQUAL "+TARGET" ) + unset( _target ) + set( _var _target ) + set( _directive 1 ) + endif( ) + + # found directive "OUTPUT" + if( "+${_arg}" STREQUAL "+OUTPUT" ) + unset( _output ) + set( _var _output ) + set( _directive 1 ) + endif( ) + + # found directive "PROJECT" + if( "+${_arg}" STREQUAL "+PROJECT" ) + unset( _project ) + set( _var _project ) + set( _directive 1 ) + endif( ) + + # found directive "FILES" + if( "+${_arg}" STREQUAL "+FILES" ) + unset( _files ) + set( _var _files ) + set( _directive 1 ) + endif( ) + + # collect data + if( _directive ) + unset( _directive ) + elseif( _var ) + list( APPEND ${_var} ${_arg} ) + endif( ) + + endforeach( ) + + # check argument sanity + if( NOT _output AND NOT _target ) + tde_message_fatal( "tqt_uic_embed() requires either TARGET or OUTPUT to be specified" ) + elseif( _target AND NOT TARGET ${_target} ) + tde_message_fatal( "The specified target does not exists." ) + elseif( NOT _files ) + tde_message_fatal( "At least one file to embed must be specified" ) + elseif( NOT TMOC_EXECUTABLE ) + tde_message_fatal( "tmoc is required but not found" ) + endif( ) + + # default for _project + if( NOT _project ) + set( _project "${_target}" ) + endif( ) + + # choose output name if not specified + if( NOT _output ) + set( _output "${CMAKE_CURRENT_BINARY_DIR}/${_target}_embedded_files.cpp" ) + endif( ) + + # sanitize output to be an absolute path + get_filename_component( _output ${_output} ABSOLUTE ) + + add_custom_command( OUTPUT "${_output}" + COMMAND "${UIC_EXECUTABLE}" + -embed "${_project}" ${_files} + -o "${_output}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating embed images for ${_project}" + ) + + if( _target ) + set_property( TARGET "${_target}" APPEND PROPERTY SOURCES ${_output} ) + endif( ) + +endfunction(tqt_uic_embed) + + ################################################# ##### ##### tqt_create_translation diff --git a/tools/maketqpf/CMakeLists.txt b/tools/maketqpf/CMakeLists.txt new file mode 100644 index 00000000..60b175b8 --- /dev/null +++ b/tools/maketqpf/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include +) + +##### maketqpf (executable) + +set( target maketqpf ) + +tde_add_executable( ${target} + SOURCES main.cpp + LINK tqt-mt-shared + DESTINATION ${BIN_INSTALL_DIR} +) +tqt_automoc( ${target} ) diff --git a/tools/msg2tqm/CMakeLists.txt b/tools/msg2tqm/CMakeLists.txt new file mode 100644 index 00000000..a33958a0 --- /dev/null +++ b/tools/msg2tqm/CMakeLists.txt @@ -0,0 +1,14 @@ +include_directories( + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include +) + +##### msg2tqm (executable) + +set( target msg2tqm ) + +tde_add_executable( ${target} + SOURCES ${target}.cpp + LINK tqt-mt-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tools/qembed/CMakeLists.txt b/tools/qembed/CMakeLists.txt new file mode 100644 index 00000000..55a47f75 --- /dev/null +++ b/tools/qembed/CMakeLists.txt @@ -0,0 +1,12 @@ +include_directories( + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include +) + +##### tqembed (executable) + +tde_add_executable( tqembed + SOURCES qembed.cpp + LINK tqt-mt-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tools/qtconfig/CMakeLists.txt b/tools/qtconfig/CMakeLists.txt new file mode 100644 index 00000000..6c4e95d9 --- /dev/null +++ b/tools/qtconfig/CMakeLists.txt @@ -0,0 +1,36 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include +) + +##### tqtconfig (executable) + +set( target tqtconfig ) + +set( ${target}_SOURCES + colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp + paletteeditoradvanced.cpp + + mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui +) + +tde_add_executable( ${target} + SOURCES ${${target}_SOURCES} + LINK tqt-mt-shared + DESTINATION ${BIN_INSTALL_DIR} + DEPENDENCIES tquic +) +tqt_automoc( ${target} ) + +tde_create_translated_desktop( + SOURCE ${target}.desktop + DESTINATION ${QT_INSTALL_SHARE}/applications +) + +install( + FILES images/appicon.png + DESTINATION ${QT_INSTALL_SHARE}/pixmaps + RENAME ${target}.png +) diff --git a/tools/tqtmergetr/CMakeLists.txt b/tools/tqtmergetr/CMakeLists.txt new file mode 100644 index 00000000..2dce428b --- /dev/null +++ b/tools/tqtmergetr/CMakeLists.txt @@ -0,0 +1,14 @@ +include_directories( + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include +) + +##### tqtmergetr (executable) + +set( target tqtmergetr ) + +tde_add_executable( ${target} + SOURCES ${target}.cpp + LINK tqt-mt-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tools/tqvfb/CMakeLists.txt b/tools/tqvfb/CMakeLists.txt new file mode 100644 index 00000000..2e8d7f1b --- /dev/null +++ b/tools/tqvfb/CMakeLists.txt @@ -0,0 +1,26 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/mkspecs/linux-g++-64 + ${CMAKE_BINARY_DIR}/include + ${PNG_INCLUDE_DIRS} +) + +##### tqvfb (executable) + +set( target tqvfb ) + +set( ${target}_SOURCES + tqvfb.cpp tqvfbview.cpp tqvfbratedlg.cpp main.cpp qanimationwriter.cpp skin.cpp + + config.ui +) + +tde_add_executable( ${target} + SOURCES ${${target}_SOURCES} + LINK tqt-mt-shared ${PNG_LIBRARIES} + DESTINATION ${BIN_INSTALL_DIR} + DEPENDENCIES tquic +) +tqt_automoc( ${target} INCLUDES gammaview.h AUTO ) +tqt_uic_embed( ${target} FILES images/logo.png )