Commit Graph

32 Commits

Author SHA1 Message Date
Alex Neundorf 3b93e266c0 automoc: add extra check whether the header contains Q_PRIVATE_SLOT
This is again for KDE4 compatiblity. If foo.moc is included, in general
moc should run on foo.cpp. Usually this can't cause problems.
It can only cause problems if moc must run on the header, and the resulting
file must be included in the cpp file, which is the case with the
Q_PRIVATE_SLOT macro.
This makes the test added by Stephen pass.

Alex
2011-11-29 20:55:36 +01:00
Alex Neundorf bde4edb6ab automoc: add special handling for including basename_p.moc, with test
Alex
2011-11-22 22:01:13 +01:00
Alex Neundorf 74ab0f6aa4 automoc: move some code from the big parsing loop into separate functions
Alex
2011-11-22 21:35:08 +01:00
Alex Neundorf 72bb058e92 Automoc: modified handling of included .moc files
-enable the KDE4-compatiblity mode only when using Qt4
-always (except in the KDE4 compat mode) error out if a cpp-file
 contains "Q_OBJECT", but does not include filename.moc

Alex
2011-11-16 22:35:06 +01:00
Alex Neundorf e44ebd5f9b automoc: another runtime optimization
before doing the full regexp, try a simple strstr(), if this
already fails, no need to do the regexp matching.

Alex
2011-11-10 22:54:44 +01:00
Alex Neundorf 1423177828 automoc: minor optimization
Handing th std::string instead the char* to the find()
reduces the time from 17 to 15 seconds (for a 1000 times loop of a
relatively small file), which is around 10 percent.

Alex
2011-11-10 22:41:48 +01:00
Alex Neundorf f98e6151dc automoc: improved diagnostics
Error/warning messages now look like:
AUTOMOC: (error|warning): <filename>: the actual text...

Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf 81c43b4fb6 automoc: handle the case when the developer includes the wrong mocfile
There are multiple/many places in KDE where the developer includes
moc_foo.cpp, and expects moc to run on foo.cpp, instead of foo.h.
He should use foo.moc, but right now this is handled by automoc4,
so we must stay compatible. So support this too, but warn about
it.

Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf 7242822897 automoc: rework the checking for the matching header, to give better warnings
Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf d08bc32bc2 automoc: stricter checking for what file is included
foo.cpp must include foo.moc to have itself processed by moc

Alex
2011-11-10 22:11:32 +01:00
Alex Neundorf 5e8e9ad68c automoc: always run moc on the cpp file if there is a foo.moc included
This makes automoc behaves as the documentation says.
If there is a #include "foo.moc" in the source file, moc
will be executed on foo.cpp.
Before it was also executed on foo.cpp, but only if foo.cpp
contained a Q_OBJECT macro, otherwise moc was executed on
foo.h. This was confusing, and this change also shouldn't break
anything, since the headers are moc'ed anyway if they contain
a Q_OBJECT macro.

Alex
2011-10-22 21:16:39 +02:00
Alex Neundorf ea8ac9f5dc Add copyright notices
Alex
2011-10-22 19:43:34 +02:00
Alex Neundorf 56aa6ffae7 automoc:run moc on the header if the source file contains include "foo.moc"
This fixes #12533.
Before automoc did not check the header if the source file contained a
statement, now it does.
Additionally, moc is now only run on explicitely listed headers which
contain a Q_OBJECT macro.

Alex
2011-10-22 19:38:39 +02:00
Stephen Kelly 7bf2c1aa3e Create moc files in the current binary dir, not the top level. 2011-08-25 21:39:51 +02:00
David Cole 920a046015 QtAutomoc: Eliminate compiler warning 2011-08-19 14:18:11 -04:00
Alex Neundorf 71165e943e Silence warning in automoc: use long instead of int
Alex
2011-08-18 19:34:49 +02:00
Alex Neundorf 1879bcc09c Fix build: use std::ios::out|ios::trunc instead of std::ios_base::out
Alex
2011-08-18 18:53:14 +02:00
Alex Neundorf afb3edc181 Fix warnings
Alex
2011-08-17 00:49:12 +02:00
Alex Neundorf add30e9008 Fix build: non-void function must return a value
Alex
2011-08-17 00:39:21 +02:00
Alex Neundorf d045fd4ec5 Nicer progress message for the automoc target
Alex
2011-08-16 02:00:36 +02:00
Alex Neundorf c27607baf8 Refactor SetupAutomocTarget() so it can be run after creating the target
This makes it easier to move it from InitialPass() to some other
location, e.g. FinalPass() or something else.

Alex
2011-08-16 01:27:30 +02:00
Alex Neundorf 58b7fe6545 Use cout instead of printf()
Alex
2011-08-14 17:17:01 +02:00
Alex Neundorf 72caf4d178 Add the generated automoc.cpp file to the cleaned files
Alex
2011-08-14 17:06:34 +02:00
Alex Neundorf ddb517d014 Color output when running moc
Alex
2011-08-14 16:43:04 +02:00
Alex Neundorf 93032953af Initialize verbose based onb the env.var.
Alex
2011-08-14 15:58:09 +02:00
Alex Neundorf ace121534d Move code for parsing a cpp-file from the big loop to separate function
Alex
2011-08-14 15:58:09 +02:00
Alex Neundorf 735a5bb321 Fix line lengths
Alex
2011-08-14 15:58:09 +02:00
Alex Neundorf 126c6ead77 Add the cmake module required currently for automoc
Alex
2011-08-14 15:58:00 +02:00
Alex Neundorf de91feb367 Remove the need to check for .h/.cxx during buildtime
Instead it now relies on cmake time to put that information
correctly into AutomocInfo.cmake

Alex
2011-08-14 15:53:50 +02:00
Alex Neundorf d65689a3bd Add actual automoc code from automoc
It already works :-)
Needs more refactoring, e.g. using the cmake facilities to turn a string
into a vector etc.
Also still missing is the part which creates the custom target.

Alex
2011-08-14 15:53:38 +02:00
Alex Neundorf d1c0a5fce6 Start implementing skeleton for automoc in cmake
Alex
2011-08-14 15:45:13 +02:00
Alex Neundorf a65011baf1 Start work on automoc: add empty cmQtAutomoc class
Alex
2011-08-07 12:02:46 +02:00