[kde-common/cmake] added a special uic wrapper, for using with TDE codebase

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common/cmake@1199209 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
pull/1/head
samelian 14 years ago
parent 1c4b89d719
commit c281cef360

@ -1,3 +1,17 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
include( KDE3Macros ) # we will need this module for a while
################################################# #################################################
##### #####
##### tde_message_fatal ##### tde_message_fatal
@ -192,8 +206,11 @@ macro( tde_add_ui_files _sources )
list( APPEND ${_sources} ${_ui_basename}.cpp ) list( APPEND ${_sources} ${_ui_basename}.cpp )
add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp
COMMAND ${QT_UIC_EXECUTABLE} ${_ui_absolute_path} -nounload -o ${_ui_basename}.h COMMAND ${CMAKE_COMMAND}
COMMAND ${QT_UIC_EXECUTABLE} ${_ui_absolute_path} -nounload -impl ${_ui_basename}.h -o ${_ui_basename}.cpp -DQT_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
-DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR}
-DUI_FILE:FILEPATH=${_ui_absolute_path}
-P ${TDE_CMAKE_DIR}/tde_uic.cmake
COMMAND ${QT_MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp COMMAND ${QT_MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp
DEPENDS ${_ui_absolute_path} ) DEPENDS ${_ui_absolute_path} )

@ -0,0 +1,38 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
execute_process( COMMAND ${QT_UIC_EXECUTABLE}
-nounload -tr tr2i18n
${UI_FILE}
OUTPUT_VARIABLE _ui_h_content
ERROR_QUIET )
if( _ui_h_content )
string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
execute_process( COMMAND ${QT_UIC_EXECUTABLE}
-nounload -tr tr2i18n
-L ${TDE_QTPLUGINS_DIR}
-impl ${_ui_basename}.h
${UI_FILE}
OUTPUT_VARIABLE _ui_cpp_content
ERROR_QUIET )
if( _ui_cpp_content )
string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <klocale.h>\n\n${_ui_cpp_content}" )
endif( )
Loading…
Cancel
Save