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