summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-11-21 00:44:15 +0000
committersamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-11-21 00:44:15 +0000
commit1af843c88cc9080a75414f23fd33cf22db73879f (patch)
tree6c96101d6bdd8fa9c1d7f782843887e918bab28b
parent695b35791dd2ef2981c6440e5215ad1694964d3e (diff)
downloadother-1af843c88cc9080a75414f23fd33cf22db73879f.tar.gz
other-1af843c88cc9080a75414f23fd33cf22db73879f.zip
[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@1199209 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--cmake/modules/TDEMacros.cmake21
-rw-r--r--cmake/modules/tde_uic.cmake38
2 files changed, 57 insertions, 2 deletions
diff --git a/cmake/modules/TDEMacros.cmake b/cmake/modules/TDEMacros.cmake
index 0647431..156872a 100644
--- a/cmake/modules/TDEMacros.cmake
+++ b/cmake/modules/TDEMacros.cmake
@@ -1,4 +1,18 @@
#################################################
+#
+# (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
@@ -192,8 +206,11 @@ macro( tde_add_ui_files _sources )
list( APPEND ${_sources} ${_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 ${QT_UIC_EXECUTABLE} ${_ui_absolute_path} -nounload -impl ${_ui_basename}.h -o ${_ui_basename}.cpp
+ COMMAND ${CMAKE_COMMAND}
+ -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
DEPENDS ${_ui_absolute_path} )
diff --git a/cmake/modules/tde_uic.cmake b/cmake/modules/tde_uic.cmake
new file mode 100644
index 0000000..541fb9f
--- /dev/null
+++ b/cmake/modules/tde_uic.cmake
@@ -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( )