[Libreoffice] cppunit support in gbuild.....
Norbert Thiebaud
nthiebaud at gmail.com
Sun Apr 3 12:14:08 PDT 2011
Bjoern,
Here is what I got so far (see at then end)
The gbuild side of it is somewhat ok, except for the ugly hack to get
the right filename to cat in define gb_LinkTarget_add_extra_objects
There must be a proper way to do that... I just couldn't figure out
what it was ...
The result is still not working because of a visibility issue.
/bin/sh: line 1: 20330 Aborted LD_LIBRARY_PATH=$O/lib
$O/bin/cppunit/cppunittester
$W/LinkTarget/CppunitTest/libtest_sc_ucalc.so >
$W/CppunitTest/sc_ucalc.test.log 2>&1
terminate called after throwing an instance of
'CppUnit::DynamicLibraryManagerException'
what(): Symbol [cppunitTestPlugIn] not found in dynamic
libary:/lo/tb/solver/300/unxlngx6.pro/workdir/LinkTarget/CppunitTest/libtest_sc_ucalc.so
removing the hidden-visibility in platform/unxgcc.mk
are rebuilding ucalc.cxx
give me
[ build CUT ] sc_ucalc
R=/lo && S=$R/tb && O=$S/solver/300/unxlngx6.pro && W=$O/workdir &&
mkdir -p $W/CppunitTest/ && LD_LIBRARY_PATH=$O/lib
$O/bin/cppunit/cppunittester
$W/LinkTarget/CppunitTest/libtest_sc_ucalc.so >
$W/CppunitTest/sc_ucalc.test.log 2>&1 || (cat
$W/CppunitTest/sc_ucalc.test.log && false)
/bin/sh: line 1: 20265 Aborted LD_LIBRARY_PATH=$O/lib
$O/bin/cppunit/cppunittester
$W/LinkTarget/CppunitTest/libtest_sc_ucalc.so >
$W/CppunitTest/sc_ucalc.test.log 2>&1
terminate called after throwing an instance of 'CppUnit::Exception'
what(): assertion failed
- Expression: bInitUcb
- Should be able to initialize UCB
which is beyond the scope of what I'm trying to solve (and beyond my
current skill set).
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 59f6f33..9184ec5 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -98,6 +98,8 @@ $(eval $(foreach method,\
add_package_headers \
add_sdi_headers \
add_precompiled_header \
+ add_extra_object \
+ add_extra_objects \
,\
$(call gb_CppunitTest__forward_to_Linktarget,$(method))\
))
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 3c8d2f5..d95a06a 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -126,6 +126,7 @@ $(eval $(foreach method,\
add_package_headers \
add_sdi_headers \
add_precompiled_header \
+ export_objects_list \
,\
$(call gb_Library__forward_to_Linktarget,$(method))\
))
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 3572b10..fd9bad4 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -387,6 +387,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
$(call gb_LinkTarget_get_headers_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
+$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTS :=
ifeq ($(gb_FULLDEPS),$(true))
ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),)
@@ -408,6 +409,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) :
INCLUDE := $$(gb_LinkTarget_INCLUDE)
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL :=
$$(gb_LinkTarget_INCLUDE_STL)
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE :=
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME :=
+$(call gb_LinkTarget_get_dep_target,$(1)) : EXTRAOBJECTS :=
endif
endef
@@ -518,6 +520,11 @@ endif
endef
+define gb_LinkTarget_add_extra_object
+$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTS += $(2)
+
+endef
+
define gb_LinkTarget_add_cxxobject
$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
$(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
@@ -575,6 +582,27 @@ define gb_LinkTarget_add_cobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3)))
endef
+define gb_LinkTarget_export_objects_list
+$(call gb_LinkTarget_get_target,$(1)) : $(call
gb_LinkTarget_get_objects_list,$(1))
+
+$(call gb_LinkTarget_get_objects_list,$(1)):
+ echo "foobar $(1)" && \
+ RESPONSEFILE=$$(call var2file,$$(call
gb_LinkTarget_get_objects_list,$(1)),200,\
+ $$(foreach object,$$(COBJECTS),$$(call
gb_CObject_get_target,$$(object))) \
+ $$(foreach object,$$(CXXOBJECTS),$$(call
gb_CxxObject_get_target,$$(object))) \
+ $$(foreach object,$$(OBJCXXOBJECTS),$$(call
gb_ObjCxxObject_get_target,$$(object))) \
+ $$(foreach object,$$(GENCXXOBJECTS),$$(call
gb_GenCxxObject_get_target,$$(object))))
+endef
+
+define gb_LinkTarget_add_extra_objects
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+$$(eval $$(call gb_Output_info,currently known libraries are: $(sort
$(gb_Library_KNOWNLIBS)),ALL))
+$$(eval $$(call gb_Output_error,Cannot import objects
library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)).
Libraries must be registered in Repository.mk))
+endif
+$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call
gb_Library_get_target,$$(lib)))
+$(foreach lib,$(2),$(foreach obj,$(shell cat $(call
gb_LinkTarget_get_objects_list,Library/$(notdir $(call
gb_Library_get_target,$(lib))))),$(call
gb_LinkTarget_add_extra_object,$(1),$(obj))))
+endef
+
define gb_LinkTarget_add_cxxobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 23df7b1..726a223 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -65,6 +65,7 @@ gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user
gb_LinkTarget_get_external_headers_target = $(WORKDIR)/ExternalHeaders/$(1)
gb_LinkTarget_get_headers_target = $(WORKDIR)/Headers/$(1)
gb_LinkTarget_get_target = $(WORKDIR)/LinkTarget/$(1)
+gb_LinkTarget_get_objects_list = $(WORKDIR)/LinkTarget/$(1).objlist
gb_Module_get_check_target = $(WORKDIR)/Module/check/$(1)
gb_Module_get_subsequentcheck_target = $(WORKDIR)/Module/subsequentcheck/$(1)
gb_Module_get_target = $(WORKDIR)/Module/$(1)
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 5b5d76f..ec214f6 100755
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -237,6 +237,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(COBJECTS),$(call
gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call
gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call
gb_GenCxxObject_get_target,$(object))) \
+ $(EXTRAOBJECTS) \
-Wl$(COMMA)--start-group $(foreach
lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib)))
-Wl$(COMMA)--end-group \
$(patsubst lib%.so,-l%,$(foreach
lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \
-o $(1))
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 59d6617..37bceca 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -607,3 +607,5 @@ $(eval $(call gb_SdiTarget_set_include,sc/sdi/scslots,\
-I$(realpath $(SRCDIR)/sc/sdi) \
$$(INCLUDE) \
))
+
+$(eval $(call gb_Library_export_objects_list,sc))
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 6878587..186cf8f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_Module_Module,sc))
$(eval $(call gb_Module_add_targets,sc,\
AllLangResTarget_sc \
+ CppunitTest_sc_ucalc \
Library_sc \
Library_scd \
Library_scfilt \
=====================
and CppunitTest_sc_calc.mk:
$(eval $(call gb_CppunitTest_CppunitTest,sc_ucalc))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \
sc/qa/unit/ucalc \
))
$(eval $(call gb_CppunitTest_add_extra_objects,sc_ucalc,sc))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \
avmedia \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nisolang1 \
sal \
salhelper \
sb \
sfx \
sot \
svl \
svt \
svx \
svxcore \
tk \
tl \
ucbhelper \
utl \
vbahelper \
vcl \
xo \
$(gb_STDLIBS) \
))
$(eval $(call gb_CppunitTest_set_include,sc_ucalc,\
-I$(realpath $(SRCDIR)/sc/inc/pch) \
-I$(realpath $(SRCDIR)/sc/source/ui/inc) \
-I$(realpath $(SRCDIR)/sc/inc) \
$$(INCLUDE) \
-I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
More information about the LibreOffice
mailing list