|
|
|
@ -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
|
|
|
|
|