problem with compiling and linking the same file into different libraries

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Apr 8 09:30:01 PDT 2012


Hey,

I'm currently working on a unit test and bug fix for the cursor
movement in calc. There are so many corner cases that we decided that
we would benefit from writing tests for this. Since it is inside the
view part and can be easily separated from the rest of calc I decided
to write a real unit test and use mocking to break dependencies. This
works quite well and the test is simple and executed quite fast.

The problem is now that I have to compile and link the cursormove.cxx
source file into libsclo and into the unit test. Currently our build
system does not support this and I have no idea if it is possible to
add support for this.

I attached a patch that shows the problem. In
CppunitTest_sc_cursor_move.mk I use qa/unit/cursormove.cxx and
source/ui/view/cursormove.cxx. They are compiled against the header
files in qa/unit/mock. source/ui/view/cursormove.cxx is also used in
Library_sc.mk but compiled against the calc header files.

There are currently 2 related problems. First the check for duplicated
linked objects complains that cursormove.o is linked into two libs and
then David pointed out that cursormove.cxx is only compiled once with
my current approach. So one of the two makefiles uses an object file
that uses the wrong header files.

I have currently no idea how I can solve these problems. Do you have
an idea or a solution?

Regards,
Markus

The patch is based on a week old master so it might not apply cleanly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ScCursorMovement-unit-test-for-cursor-movement.patch
Type: application/octet-stream
Size: 44407 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120408/791aadf9/attachment-0001.obj>


More information about the LibreOffice mailing list