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