[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: uic support in am_edit (was Re: ksysguard/multimetersettings.cpp)
From: Simon Hausmann <sh () caldera ! de>
Date: 2000-09-01 11:19:51
[Download RAW message or body]
On Fri, Sep 01, 2000 at 10:00:28AM +0200, Reginald Stadlbauer wrote:
> On Fri, 01 Sep 2000, Waldo Bastian wrote:
> > This file claims to be a generated file but does not include it's own "moc"
> > file.
> >
> > 1) Why is this file in CVS if it is generated?
>
> Because the kde build system still has no uic support. Or did I miss
> something? Some people said they are looking into it, but AFAIK no results
> yet. I'd do it myself if I'd know enough of autoconf and friends, but I
> don't.
>
> So until we have uic support in the make system, the generated files have to
> be checked in.
>
> I really think we should have uic support for kde 2.0, so that people who
> start using the designer for kde dialogs can easily use it. For those who
Can some am_edit/acinclude.m4.in expert please review the attached patch?
It works absolutely simple:
blah_SOURCES = bar.cpp designerstuff.ui
If the .ui file is not in the source dir, then one uses
designerstuff_DIR = /where/it/is
Just like with the IDL files. (the patch is in fact mostly copy&paste)
It works for me (tested with srcdir!=builddir) .
Corrections from the Build-System-Experts more than welcome :-)
Bye,
Simon
["uic_patch.txt" (text/plain)]
Index: acinclude.m4.in
===================================================================
RCS file: /home/kde/kde-common/admin/acinclude.m4.in,v
retrieving revision 2.12
diff -b -u -p -r2.12 acinclude.m4.in
--- acinclude.m4.in 2000/08/31 14:50:25 2.12
+++ acinclude.m4.in 2000/09/01 11:13:51
@@ -114,6 +114,18 @@ configure.
])
])
+AC_DEFUN(KDE_UIC_ERROR_MESSAGE,
+[
+ AC_MSG_ERROR([No Qt ui compiler (uic) found!
+Please check whether you installed Qt correctly.
+You need to have a running uic binary.
+configure tried to run $ac_cv_path_uic and the test didn't
+succeed. If configure shouldn't have tried this one, set
+the environment variable UIC to the right one before running
+configure.
+])
+])
+
dnl ------------------------------------------------------------------------
dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
dnl more usual places
@@ -147,6 +159,39 @@ AC_DEFUN(AC_PATH_QT_MOC,
AC_SUBST(MOC)
])
+dnl ------------------------------------------------------------------------
+dnl Find the qt ui compiler in the PATH, in $QTDIR/bin, and some
+dnl more usual places
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN(AC_PATH_QT_UIC,
+[
+ qt_uicdirs=""
+ for dir in $kde_qt_dirs; do
+ qt_uicdirs="$qt_uicdirs $dir/bin"
+ done
+ qt_uicdirs="$qt_uicdirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
+ if test ! "$ac_qt_bindir" = "NO"; then
+ qt_uicdirs="$ac_qt_bindir $qt_uicdirs"
+ fi
+
+ KDE_FIND_PATH(uic, UIC, [$qt_uicdirs], [KDE_UIC_ERROR_MESSAGE])
+
+ if test -z "$UIC"; then
+ if test -n "$ac_cv_path_uic"; then
+ output=`eval "$ac_cv_path_uic --help 2>&1 | sed -e '1q' | grep Qt"`
+ fi
+ echo "configure:__oline__: tried to call $ac_cv_path_uic --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
+ echo "configure:__oline__: uic output: $output" >&AC_FD_CC
+
+ if test -z "$output"; then
+ KDE_UIC_ERROR_MESSAGE
+ fi
+ fi
+
+ AC_SUBST(UIC)
+])
+
AC_DEFUN(KDE_1_CHECK_PATHS,
[
KDE_1_CHECK_PATH_HEADERS
@@ -958,6 +1003,7 @@ AC_SUBST(LIB_QT)
AC_DEFUN(AC_PATH_QT,
[
AC_PATH_QT_1_3
+AC_PATH_QT_UIC
])
AC_DEFUN(KDE_CHECK_FINAL,
Index: am_edit
===================================================================
RCS file: /home/kde/kde-common/admin/am_edit,v
retrieving revision 1.200
diff -b -u -p -r1.200 am_edit
--- am_edit 2000/08/12 11:47:44 1.200
+++ am_edit 2000/09/01 11:13:52
@@ -74,6 +74,7 @@ sub tag_POFILES ();
sub tag_DOCFILES ();
sub tag_LOCALINSTALL();
sub tag_IDLFILES();
+sub tag_UIFILES();
sub tag_TOPLEVEL();
sub tag_SUBDIRS();
sub tag_ICON();
@@ -223,7 +224,10 @@ sub processMakefile ($)
local %idlfiles = (); # lists the idl files used for $program
local %globalmocs = ();# list of all mocfiles (in %mocFiles format)
local $allidls = "";
+ local $alluis = "";
local $idl_output = "";# lists all idl generated files for cleantarget
+ local $ui_output = "";# lists all uic generated files for cleantarget
+ local $ui_mocs = "";# lists all moc files associated with generated uic files
local %depedmocs = ();
@@ -250,6 +254,7 @@ sub processMakefile ($)
foreach $program (@programs) {
tag_METASOURCES (); # Sorts out the moc rules
tag_IDLFILES(); # Sorts out idl rules
+ tag_UIFILES(); # Sorts out ui rules
tag_CLOSURE();
}
@@ -258,6 +263,11 @@ sub processMakefile ($)
$target_adds{"$cleantarget-am"} .= "$cleantarget-idl ";
}
+ if ($ui_output) {
+ appendLines ("$cleantarget-ui:\n\t-rm -f $ui_output\n");
+ $target_adds{"$cleantarget-am"} .= "$cleantarget-ui ";
+ }
+
if ($MakefileData =~ /\nKDE_LANG\s*=\s*(\S*)\n/) {
$kdelang = '$(KDE_LANG)'
} else {
@@ -906,6 +916,69 @@ sub tag_IDLFILES ()
}
+sub tag_UIFILES ()
+{
+ my @psources = split(/[\034\s]+/, $sources{$program});
+ my $dep_lines = "";
+ my @cppFiles = ();
+
+ foreach $source (@psources) {
+
+ if ($source =~ m/\.ui$/) {
+
+ print STDERR "adding UI file $source\n" if ($verbose);
+
+ $source =~ s/\.ui$//;
+
+ my $sourcename = $source;
+
+ my $sourcedir = '';
+ if (-f "$makefileDir/$source.ui") {
+ $sourcedir = '$(srcdir)/';
+ } else {
+ if ($MakefileData =~ /\n$source\_DIR\s*=\s*(\S+)\n/) {#
+ $sourcedir = $1;
+ $sourcedir .= "/" if ($sourcedir !~ /\/$/);
+ }
+ }
+
+ if ($allidls !~ /$sourcename/) {
+
+ $dep_lines .= "$sourcename.$cxxsuffix: $sourcedir$source.ui $source.h\n";
+ $dep_lines .= "\t\$(UIC) -tr i18n -i $source.h -o $source.$cxxsuffix $sourcedir$source.ui\n\n";
+ $dep_lines .= "$sourcename.h: $sourcedir$source.ui\n";
+ $dep_lines .= "\t\$(UIC) -o $sourcename.h $sourcedir$source.ui\n\n";
+ $dep_lines .= "$sourcename.moc.$cxxsuffix: $source.h\n";
+ $dep_lines .= "\t\$(MOC) $source.h -o $sourcename.moc.$cxxsuffix\n";
+
+ @cppFiles =
+ `grep -l "^#include *.$sourcename\.h." $cppExt 2> /dev/null`;
+ foreach $file (@cppFiles) {
+ chomp ($file);
+ $dep_lines .= "\$(srcdir)/$file: $sourcename.h\n";
+ }
+
+ $alluis .= $sourcename . " ";
+ $ui_mocs .= " " . $sourcename . ".moc." . $cxxsuffix;
+ }
+
+ if ($program =~ /_la$/) {
+ $realObjs{$program} .= " $sourcename.lo";
+ $realObjs{$program} .= " $sourcename.moc.lo";
+ } else {
+ $realObjs{$program} .= " $sourcename.\$(OBJEXT)";
+ $realObjs{$program} .= " $sourcename.\$(OBJEXT)";
+ }
+ $sources{$program} .= " $sourcename.$cxxsuffix";
+ $ui_output .= "\\\n\t$sourcename.$cxxsuffix $sourcename.h $sourcename.moc.$cxxsuffix ";
+ $dep_files .= " \$(DEPDIR)/$sourcename.P";
+ }
+ }
+ if ($dep_lines) {
+ appendLines($dep_lines);
+ }
+}
+
sub tag_ICON()
{
my $lookup = '([^\s]*)_ICON\s*=\s*([^\n]*)';
@@ -1566,6 +1639,7 @@ sub make_meta_classes ()
if exists $mhash{$mocFile.".moc.$cxxsuffix"};
}
}
+ $mocs .= $ui_mocs;
if ($mocs) {
print STDOUT "==> mocs=[".$mocs."]\n" if ($verbose);
my $sourcename = $program."_meta_unload";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic