xref: /aoo4110/main/solenv/gbuild/CppunitTest.mk (revision b1cdbd2c)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24
25# CppunitTest class
26
27# in non-product builds, ensure that tools-based assertions do not pop up as message box, but are routed to the shell
28DBGSV_ERROR_OUT := shell
29export DBGSV_ERROR_OUT
30
31# defined by platform
32#  gb_CppunitTest_TARGETTYPE
33#  gb_CppunitTest_get_filename
34gb_CppunitTest_CPPTESTTARGET := $(call gb_Executable_get_target,cppunittester)
35gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_CPPTESTTARGET)
36gb_CppunitTest__get_linktargetname = CppunitTest/$(call gb_CppunitTest_get_filename,$(1))
37
38.PHONY : $(call gb_CppunitTest_get_clean_target,%)
39$(call gb_CppunitTest_get_clean_target,%) :
40	$(call gb_Helper_abbreviate_dirs,\
41		rm -f $(call gb_CppunitTest_get_target,$*) $(call gb_CppunitTest_get_target,$*).log)
42
43.PHONY : $(call gb_CppunitTest_get_target,%)
44$(call gb_CppunitTest_get_target,%) : $(gb_CppunitTest_CPPTESTTARGET)
45	$(call gb_Output_announce,$*,$(true),CUT,2)
46	$(call gb_Helper_abbreviate_dirs_native,\
47		mkdir -p $(dir $@) && \
48		$(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) > $@.log 2>&1 || (cat $@.log && false))
49
50define gb_CppunitTest_CppunitTest
51$(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest__get_linktargetname,$(1)))
52
53endef
54
55define gb_CppunitTest__CppunitTest_impl
56$(call gb_LinkTarget_LinkTarget,$(2))
57$(call gb_LinkTarget_set_targettype,$(2),CppunitTest)
58$(call gb_LinkTarget_add_linked_libs,$(2),cppunit)
59$(call gb_CppunitTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
60$(call gb_CppunitTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
61$(call gb_CppunitTest_CppunitTest_platform,$(1),$(2),$(gb_CppunitTest_DLLDIR)/$(call gb_CppunitTest_get_libfilename,$(1)))
62$$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
63
64endef
65
66define gb_CppunitTest__forward_to_Linktarget
67gb_CppunitTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CppunitTest__get_linktargetname,$$(1)),$$(2),$$(3))
68
69endef
70
71$(eval $(foreach method,\
72	add_cobject \
73	add_cobjects \
74	add_cxxobject \
75	add_cxxobjects \
76	add_objcxxobject \
77	add_objcxxobjects \
78	add_exception_objects \
79	add_noexception_objects \
80	set_cflags \
81	set_cxxflags \
82	set_objcxxflags \
83	set_defs \
84	set_include \
85	set_ldflags \
86	set_library_path_flags \
87	add_linked_libs \
88	add_linked_static_libs \
89	add_package_headers \
90	add_sdi_headers \
91	add_precompiled_header \
92,\
93	$(call gb_CppunitTest__forward_to_Linktarget,$(method))\
94))
95
96# vim: set noet sw=4 ts=4:
97