xref: /trunk/main/testtools/source/bridgetest/cli/makefile.mk (revision 9d37da743abb7db0a497688391f6e55a19f27c44)
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
24PRJ=..$/..$/..
25
26PRJNAME=testtools
27TARGET=cli_cpp_bridgetest.uno
28USE_DEFFILE=TRUE
29NO_BSYMBOLIC=TRUE
30ENABLE_EXCEPTIONS=TRUE
31LIBTARGET=NO
32
33# disable caching to avoid stale objects
34# on version changes
35CCACHE_DISABLE=TRUE
36.EXPORT : CCACHE_DISABLE
37
38# --- Settings -----------------------------------------------------
39
40.INCLUDE :  settings.mk
41DLLPRE =
42CFLAGSENABLESYMBOLS:=-Z7
43# ------------------------------------------------------------------
44
45#These tests are for Windows only
46# ...and only when the CLI binding was actually built.  This whole directory is
47# the C++/CLI half of bridgetest and follows cli_ure.  No makefile.pmk here,
48# so DISABLE_CLI comes from the environment.
49.IF "$(COM)" == "MSC" && "$(GUI)" == "WNT" && "$(DISABLE_CLI)" == ""
50
51# Which syntax, and which mixed-mode runtime, are two separate questions.
52# /clr:oldSyntax went away after VS2015, so a UCRT compiler gets plain -clr
53# and this source is C++/CLI.  msvcmrt.lib is needed either way from VS2005
54# on: it carries the managed module initializer, and without it the link
55# fails on an unresolved .cctor.
56.IF "$(CCNUMVER)" >= "001399999999" && "$(COMEX)" != "14"
57CFLAGSCXX += -clr:oldSyntax -AI $(OUT)$/bin -AI $(SOLARBINDIR)
58.ELSE
59CFLAGSCXX += -clr -AI $(OUT)$/bin -AI $(SOLARBINDIR)
60.ENDIF
61
62SHL1STDLIBS = \
63    mscoree.lib
64.IF "$(CCNUMVER)" >= "001399999999"
65SHL1STDLIBS += \
66    msvcmrt.lib
67.ENDIF
68SLOFILES= \
69    $(SLO)$/cli_cpp_bridgetest.obj
70
71SHL1OBJS = $(SLOFILES)
72
73SHL1TARGET = $(TARGET)
74
75SHL1DEF = $(MISC)$/$(SHL1TARGET).def
76DEF1NAME = $(SHL1TARGET)
77
78.ENDIF
79
80# --- Targets ------------------------------------------------------
81
82.INCLUDE :  target.mk
83
84# ...and only when the CLI binding was actually built.  This whole directory is
85# the C++/CLI half of bridgetest and follows cli_ure.  No makefile.pmk here,
86# so DISABLE_CLI comes from the environment.
87.IF "$(COM)" == "MSC" && "$(GUI)" == "WNT" && "$(DISABLE_CLI)" == ""
88
89ALLTAR : $(BIN)$/cli_bridgetest_inprocess.exe
90
91#################################################################
92
93CLI_URE = $(SOLARBINDIR)$/cli_ure.dll
94CLI_URETYPES = $(SOLARBINDIR)$/cli_uretypes.dll
95CLI_BASETYPES = $(SOLARBINDIR)$/cli_basetypes.dll
96CLI_CPPUHELPER = $(SOLARBINDIR)$/cli_cppuhelper.dll
97CLI_OOOTYPES = $(SOLARBINDIR)$/cli_oootypes.dll
98CLI_TYPES_BRIDGETEST = $(BIN)$/cli_types_bridgetest.dll
99
100CSCFLAGS = -warnaserror+
101
102# csc defaults to anycpu, so on 64-bit Windows the test exe would start as
103# a 64-bit process and then fail to load the mixed-mode assemblies, which
104# follow the C++ build and are x86.  The error is a BadImageFormatException
105# naming cli_cppuhelper, which does not sound like a bitness problem at all.
106.IF "$(CPUNAME)" == "X86_64"
107CLI_PLATFORM = x64
108.ELSE
109CLI_PLATFORM = x86
110.ENDIF
111CSCFLAGS += -platform:$(CLI_PLATFORM)
112.IF "$(CCNUMVER)" <= "001399999999"
113VBC_FLAGS = -warnaserror+
114.ELSE
115VBC_FLAGS = -nowarn:42030 -warnaserror+
116.ENDIF
117VBC_FLAGS += -platform:$(CLI_PLATFORM)
118.IF "$(debug)" != ""
119CSCFLAGS += -debug+ -checked+ -define:DEBUG -define:TRACE
120VBC_FLAGS += -debug+ -define:DEBUG=TRUE -define:TRACE=TRUE
121.ELSE
122CSCFLAGS += -optimize
123VBC_FLAGS += -optimize
124.ENDIF
125
126
127# C# ----------------------------------------------
128$(BIN)$/cli_cs_testobj.uno.dll : \
129        cli_cs_testobj.cs \
130        cli_cs_multi.cs \
131        $(CLI_BASETYPES) \
132        $(CLI_URETYPES) \
133        $(CLI_URE)
134    $(CSC) $(CSCFLAGS) -target:library -out:$@ \
135        -reference:$(CLI_TYPES_BRIDGETEST) \
136        -reference:$(CLI_URE) \
137        -reference:$(CLI_BASETYPES) \
138        -reference:$(CLI_URETYPES) \
139        cli_cs_testobj.cs cli_cs_multi.cs
140
141$(BIN)$/cli_cs_bridgetest.uno.dll : \
142        cli_cs_bridgetest.cs \
143        $(CLI_BASETYPES) \
144        $(CLI_URETYPES) \
145        $(CLI_URE)
146    $(CSC) $(CSCFLAGS) -target:library -out:$@ \
147        -reference:$(CLI_TYPES_BRIDGETEST) \
148        -reference:$(CLI_URETYPES) \
149        -reference:$(CLI_BASETYPES) \
150        -reference:$(CLI_URE) \
151        -reference:System.dll \
152        cli_cs_bridgetest.cs
153
154# Visual Basic ------------------------------------------
155$(BIN)$/cli_vb_bridgetest.uno.dll : \
156        cli_vb_bridgetest.vb \
157        $(CLI_BASETYPES) \
158        $(CLI_URETYPES) \
159        $(CLI_URE)
160    $(VBC) $(VBC_FLAGS) \
161        -target:library \
162        -out:$@ \
163        -reference:$(CLI_URETYPES) \
164        -reference:$(CLI_BASETYPES) \
165        -reference:$(CLI_URE) \
166        -reference:$(CLI_TYPES_BRIDGETEST) \
167        -reference:System.dll \
168        -reference:System.Drawing.dll \
169        -reference:System.Windows.Forms.dll \
170        cli_vb_bridgetest.vb
171
172$(BIN)$/cli_vb_testobj.uno.dll : \
173        cli_vb_testobj.vb \
174        $(CLI_BASETYPES) \
175        $(CLI_URETYPES) \
176        $(CLI_URE)
177    $(VBC) $(VBC_FLAGS) \
178        -target:library \
179        -out:$@ \
180        -reference:$(CLI_BASETYPES) \
181        -reference:$(CLI_URETYPES) \
182        -reference:$(CLI_URE) \
183        -reference:$(CLI_TYPES_BRIDGETEST) \
184        -reference:System.dll \
185        -reference:System.Drawing.dll \
186        -reference:System.Windows.Forms.dll \
187        cli_vb_testobj.vb
188
189# The stamp has to name what it copies.  Without these prerequisites a
190# rebuilt cli_uretypes.dll never reaches $(BIN), and the test then runs
191# against the stale copy -- which fails at assembly-load time, a long way
192# from the cause.
193$(MISC)$/copyassemblies.done .ERRREMOVE: \
194        $(CLI_CPPUHELPER) \
195        $(CLI_BASETYPES) \
196        $(CLI_URETYPES) \
197        $(CLI_URE) \
198        $(CLI_OOOTYPES)
199    $(GNUCOPY) $(CLI_CPPUHELPER) $(BIN)$/$(CLI_CPPUHELPER:f)
200    $(GNUCOPY) $(CLI_BASETYPES) $(BIN)$/$(CLI_BASETYPES:f)
201    $(GNUCOPY) $(CLI_URETYPES) $(BIN)$/$(CLI_URETYPES:f)
202    $(GNUCOPY) $(CLI_URE) $(BIN)$/$(CLI_URE:f)
203    $(GNUCOPY) $(CLI_OOOTYPES) $(BIN)$/$(CLI_OOOTYPES:f)
204    $(TOUCH) $@
205
206$(BIN)$/cli_bridgetest_inprocess.exe : \
207        cli_bridgetest_inprocess.cs \
208        $(BIN)$/cli_cs_bridgetest.uno.dll \
209        $(BIN)$/cli_cs_testobj.uno.dll \
210        $(BIN)$/cli_vb_bridgetest.uno.dll \
211        $(BIN)$/cli_vb_testobj.uno.dll \
212        $(BIN)$/cli_cpp_bridgetest.uno.dll \
213        $(MISC)$/copyassemblies.done \
214        $(CLI_BASETYPES) \
215        $(CLI_URETYPES) \
216        $(CLI_URE) \
217        $(CLI_CPPUHELPER)
218    $(CSC) $(CSCFLAGS) -target:exe -out:$@ \
219        -reference:$(CLI_TYPES_BRIDGETEST) \
220        -reference:$(CLI_BASETYPES) \
221        -reference:$(CLI_URETYPES) \
222        -reference:$(CLI_URE) \
223        -reference:$(CLI_CPPUHELPER) \
224        -reference:$(BIN)$/cli_cs_bridgetest.uno.dll \
225        -reference:$(BIN)$/cli_cs_testobj.uno.dll \
226        -reference:$(BIN)$/cli_vb_bridgetest.uno.dll \
227        -reference:$(BIN)$/cli_vb_testobj.uno.dll \
228        -reference:$(BIN)$/cli_cpp_bridgetest.uno.dll \
229        cli_bridgetest_inprocess.cs
230    $(GNUCOPY) cli_bridgetest_inprocess.ini $(BIN)
231
232.ENDIF
233