xref: /aoo42x/main/solenv/gbuild/GoogleTest.mk (revision 6546466c)
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# GoogleTest 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
30DISABLE_SAL_DBGBOX := 1
31export DISABLE_SAL_DBGBOX
32
33# defined by platform
34#  gb_CppunitTest_TARGETTYPE
35#  gb_CppunitTest_get_filename
36gb_GoogleTest__get_linktargetname = GoogleTest/$(call gb_GoogleTest_get_filename,$(1))
37
38.PHONY : $(call gb_GoogleTest_get_clean_target,%)
39$(call gb_GoogleTest_get_clean_target,%) :
40	$(call gb_Helper_abbreviate_dirs,\
41		rm -f $(call gb_GoogleTest_get_target,$*) $(call gb_GoogleTest_get_target,$*).xml)
42
43.PHONY : $(call gb_GoogleTest_get_target,%)
44$(call gb_GoogleTest_get_target,%) :
45	$(call gb_Output_announce,$*,$(true),CUT,2)
46	$(subst gb_GoogleTest_GTESTPRECOMMAND,$(gb_GoogleTest_GTESTPRECOMMAND),\
47		$(call gb_Helper_abbreviate_dirs_native,\
48			mkdir -p $(dir $@) && \
49			gb_GoogleTest_GTESTPRECOMMAND $(call gb_LinkTarget_get_target,GoogleTest/$(call gb_GoogleTest_get_filename,$*)) \
50				--gtest_output="xml:$(call gb_GoogleTest_get_target,$*).xml"))
51
52define gb_GoogleTest_GoogleTest
53$(call gb_GoogleTest__GoogleTest_impl,$(1),$(call gb_GoogleTest__get_linktargetname,$(1)))
54
55endef
56
57define gb_GoogleTest__GoogleTest_impl
58$(call gb_LinkTarget_LinkTarget,$(2))
59$(call gb_LinkTarget_set_targettype,$(2),GoogleTest)
60$(call gb_LinkTarget_add_linked_libs,$(2),gtest)
61$(call gb_GoogleTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
62$(call gb_GoogleTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
63$(call gb_GoogleTest_GoogleTest_platform,$(1),$(2),$(call gb_LinkTarget_get_target,GoogleTest/$(call gb_GoogleTest_get_filename,$(1))))
64$$(eval $$(call gb_Module_register_target,$(call gb_GoogleTest_get_target,$(1)),$(call gb_GoogleTest_get_clean_target,$(1))))
65
66endef
67
68define gb_GoogleTest__forward_to_Linktarget
69gb_GoogleTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_GoogleTest__get_linktargetname,$$(1)),$$(2),$$(3))
70
71endef
72
73$(eval $(foreach method,\
74	add_cobject \
75	add_cobjects \
76	add_cxxobject \
77	add_cxxobjects \
78	add_objcxxobject \
79	add_objcxxobjects \
80	add_exception_objects \
81	add_noexception_objects \
82	set_cflags \
83	set_cxxflags \
84	set_objcxxflags \
85	set_defs \
86	set_include \
87	set_ldflags \
88	set_library_path_flags \
89	add_linked_libs \
90	add_linked_static_libs \
91	add_package_headers \
92	add_sdi_headers \
93	add_precompiled_header \
94,\
95	$(call gb_GoogleTest__forward_to_Linktarget,$(method))\
96))
97
98# vim: set noet sw=4 ts=4:
99