xref: /trunk/main/solenv/gbuild/GoogleTest.mk (revision b63233d8)
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
306546466cSdamjanDISABLE_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)
60*b63233d8Sdamjan$(call gb_LinkTarget_add_defs,$(2),\
61*b63233d8Sdamjan	$(gb_GoogleTest_DEFS) \
62*b63233d8Sdamjan)
63e75d772dSDamjan Jovanovic$(call gb_LinkTarget_add_linked_libs,$(2),gtest)
64e75d772dSDamjan Jovanovic$(call gb_GoogleTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
65e75d772dSDamjan Jovanovic$(call gb_GoogleTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
66e75d772dSDamjan Jovanovic$(call gb_GoogleTest_GoogleTest_platform,$(1),$(2),$(call gb_LinkTarget_get_target,GoogleTest/$(call gb_GoogleTest_get_filename,$(1))))
67e75d772dSDamjan Jovanovic$$(eval $$(call gb_Module_register_target,$(call gb_GoogleTest_get_target,$(1)),$(call gb_GoogleTest_get_clean_target,$(1))))
68e75d772dSDamjan Jovanovic
69e75d772dSDamjan Jovanovicendef
70e75d772dSDamjan Jovanovic
71e75d772dSDamjan Jovanovicdefine gb_GoogleTest__forward_to_Linktarget
72e75d772dSDamjan Jovanovicgb_GoogleTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_GoogleTest__get_linktargetname,$$(1)),$$(2),$$(3))
73e75d772dSDamjan Jovanovic
74e75d772dSDamjan Jovanovicendef
75e75d772dSDamjan Jovanovic
76e75d772dSDamjan Jovanovic$(eval $(foreach method,\
77e75d772dSDamjan Jovanovic	add_cobject \
78e75d772dSDamjan Jovanovic	add_cobjects \
79e75d772dSDamjan Jovanovic	add_cxxobject \
80e75d772dSDamjan Jovanovic	add_cxxobjects \
81e75d772dSDamjan Jovanovic	add_objcxxobject \
82e75d772dSDamjan Jovanovic	add_objcxxobjects \
83e75d772dSDamjan Jovanovic	add_exception_objects \
84e75d772dSDamjan Jovanovic	add_noexception_objects \
85*b63233d8Sdamjan	set_yaccflags \
86*b63233d8Sdamjan	add_cflags \
87e75d772dSDamjan Jovanovic	set_cflags \
88*b63233d8Sdamjan	add_cxxflags \
89e75d772dSDamjan Jovanovic	set_cxxflags \
90*b63233d8Sdamjan	add_objcxxflags \
91e75d772dSDamjan Jovanovic	set_objcxxflags \
92*b63233d8Sdamjan	add_defs \
93e75d772dSDamjan Jovanovic	set_defs \
94e75d772dSDamjan Jovanovic	set_include \
95*b63233d8Sdamjan	add_ldflags \
96e75d772dSDamjan Jovanovic	set_ldflags \
97*b63233d8Sdamjan	add_libs \
98e75d772dSDamjan Jovanovic	set_library_path_flags \
99*b63233d8Sdamjan	add_api \
100e75d772dSDamjan Jovanovic	add_linked_libs \
101e75d772dSDamjan Jovanovic	add_linked_static_libs \
102*b63233d8Sdamjan	use_external \
103*b63233d8Sdamjan	use_externals \
104e75d772dSDamjan Jovanovic	add_package_headers \
105e75d772dSDamjan Jovanovic	add_sdi_headers \
106e75d772dSDamjan Jovanovic	add_precompiled_header \
107e75d772dSDamjan Jovanovic,\
108e75d772dSDamjan Jovanovic	$(call gb_GoogleTest__forward_to_Linktarget,$(method))\
109e75d772dSDamjan Jovanovic))
110e75d772dSDamjan Jovanovic
111e75d772dSDamjan Jovanovic# vim: set noet sw=4 ts=4:
112