summaryrefslogtreecommitdiff
path: root/build/gi-tests-msvc.mak
blob: f44b3bc0cae15e3b0404997d6b4f7237cf901c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# NMake Makefile to build The Tests for G-I

# Please do not change anything after this line

!include gi-build-common-msvc.mak

BASE_GLIB_LIBS = gio-$(GLIB_APIVERSION).lib gobject-$(GLIB_APIVERSION).lib gmodule-$(GLIB_APIVERSION).lib glib-$(GLIB_APIVERSION).lib
CFLAGS = $(CFLAGS_ADD) /I.. /W3 /we4013 /FImsvc_recommended_pragmas.h /DHAVE_CONFIG_H
LDFLAGS = /link $(LDFLAGS_ARCH) $(BASE_GLIB_LIBS)
LDFLAGS_DLL = /link $(LDFLAGS_ARCH) /DLL /out:$@ /implib:$*-$(GI_APIVERSION).lib $(BASE_GLIB_LIBS)

# Special CFLAGS for Regress test
REGRESS_CFLAGS = -DREGRESS_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f" -DREGRESS_SOME_CHAR='c'

# The test .gir's for G-I that are built
built_test_girs = 	\
	GIMarshallingTests-$(GI_APIVERSION).gir	\
	Everything-$(GI_APIVERSION).gir	\
	Offsets-$(GI_APIVERSION).gir	\
	SLetter-$(GI_APIVERSION).gir	\
	Utility-$(GI_APIVERSION).gir	\
	GtkFrob-$(GI_APIVERSION).gir	\
	GetType-$(GI_APIVERSION).gir	\
	WarnLib-$(GI_APIVERSION).gir	\
	Typedefs-$(GI_APIVERSION).gir	\
	Regress-$(GI_APIVERSION).gir	\
	Bar-$(GI_APIVERSION).gir	\
	Headeronly-$(GI_APIVERSION).gir	\
	Identfilter-$(GI_APIVERSION).gir

built_test_typelibs =	\
	GIMarshallingTests-$(GI_APIVERSION).typelib	\
	Everything-$(GI_APIVERSION).typelib	\
	Offsets-$(GI_APIVERSION).typelib	\
	SLetter-$(GI_APIVERSION).typelib	\
	Utility-$(GI_APIVERSION).typelib	\
	GtkFrob-$(GI_APIVERSION).typelib	\
	GetType-$(GI_APIVERSION).typelib	\
	WarnLib-$(GI_APIVERSION).typelib	\
	Typedefs-$(GI_APIVERSION).typelib	\
	Regress-$(GI_APIVERSION).typelib	\
	Bar-$(GI_APIVERSION).typelib	\
	Headeronly-$(GI_APIVERSION).typelib	\
	Identfilter-$(GI_APIVERSION).typelib

test_programs =	\
	gitestrepo.exe	\
	gitestthrows.exe	\
	gitypelibtest.exe	\
	gitestoffsets.exe

built_doc_tests =	\
	Regress-$(GI_APIVERSION)-C	\
	Regress-$(GI_APIVERSION)-Python	\
	Regress-$(GI_APIVERSION)-Gjs	\
	Regress-$(GI_APIVERSION)-sections.txt

!if "$(BUILD_INTROSPECTION)" == "TRUE"
all: setgirbuildnev $(built_test_girs) $(built_test_typelibs) $(test_programs) $(built_doc_tests) warn_tests_log.txt

!include gi-setenv-msvc.mak

# Rules for building the test DLLs
gimarshallingtests.dll: ..\tests\gimarshallingtests.c
	$(CC) $(CFLAGS) ..\tests\gimarshallingtests.c $(LDFLAGS_DLL)
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2

everything.dll: everything.c everything.h
	$(CC) $(CFLAGS) /I..\tests everything.c $(LDFLAGS_DLL)
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2

offsets.dll: ..\tests\offsets\offsets.c
	$(CC) $(CFLAGS) /I..\tests /I..\tests\offsets ..\tests\offsets\offsets.c $(LDFLAGS_DLL)
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2

sletter.dll utility.dll gtkfrob.dll gettype.dll warnlib.dll typedefs.dll:
	$(CC) $(CFLAGS) /I..\tests ..\tests\scanner\$*.c $(LDFLAGS_DLL)
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2

regress.dll:
	$(CC) $(CFLAGS) /I..\tests	\
	$(REGRESS_CFLAGS)	\
	..\tests\scanner\regress.c	\
	..\tests\scanner\annotation.c	\
	..\tests\scanner\foo.c	\
	..\tests\scanner\drawable.c	\
	$(LDFLAGS_DLL) cairo-gobject.lib cairo.lib
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2

# Rules for test programs
gitestrepo.exe gitestthrows.exe gitypelibtest.exe:
	$(CC) $(CFLAGS) /I..\girepository ..\tests\repository\$*.c $(LDFLAGS) girepository-$(GI_APIVERSION).lib
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1

barapp.exe:
	$(CC) $(CFLAGS) /I..\girepository -I..\tests ..\tests\scanner\$*.c $(LDFLAGS) girepository-$(GI_APIVERSION).lib
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1

gitestoffsets.exe: gitestoffsets.c
	$(CC) $(CFLAGS) /I..\girepository /I..\tests\offsets /I..\tests $*.c $(LDFLAGS) girepository-$(GI_APIVERSION).lib
	@-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1
	@set GI_TYPELIB_PATH=.
	@-$@ offsets.compiled offsets.introspected
	@-fc offsets.compiled offsets.introspected > gitestoffsets.log

# Rules for building the .gir's
GIMarshallingTests-$(GI_APIVERSION).gir: gimarshallingtests.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate	\
	--namespace=GIMarshallingTests --symbol-prefix=gi_marshalling_tests --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..	\
	--add-include-path=. --include=Gio-$(GLIB_APIVERSION)	\
	--library=$* --output=$@	\
	--c-include="tests/gimarshallingtests.h"	\
	..\tests\gimarshallingtests.h ..\tests\gimarshallingtests.c

Everything-$(GI_APIVERSION).gir: everything.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate	\
	--namespace=Everything --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I.. -I..\tests	\
	--add-include-path=. --include=Gio-$(GLIB_APIVERSION)	\
	--library=$* --output=$@	\
	everything.h everything.c

Offsets-$(GI_APIVERSION).gir: offsets.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate	\
	--namespace=Offsets --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I.. -I..\tests\offsets -I..\tests	\
	--pkg=gobject-$(GLIB_APIVERSION) --add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--library=$* --output=$@	\
	..\tests\offsets\offsets.h ..\tests\offsets\offsets.c

SLetter-$(GI_APIVERSION).gir: sletter.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=SLetter --nsversion=$(GI_APIVERSION) \
	--no-libtool -I..\tests -I..	\
	--add-include-path=. --include=Gio-$(GLIB_APIVERSION)	\
	--identifier-prefix=S --c-include="sletter.h" --warn-error	\
	--library=$* --output=$@	\
	..\tests\scanner\sletter.h ..\tests\scanner\sletter.c

Utility-$(GI_APIVERSION).gir: utility.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=Utility --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I.. --pkg=gobject-$(GLIB_APIVERSION)	\
	--add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--c-include="utility.h" --warn-error	\
	--library=$* --output=$@ \
	..\tests\scanner\utility.h ..\tests\scanner\utility.c

GtkFrob-$(GI_APIVERSION).gir: gtkfrob.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=GtkFrob --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I.. --pkg=gobject-$(GLIB_APIVERSION)	\
	--add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--identifier-prefix=Gtk --symbol-prefix=gtk_frob --warn-error	\
	--library=$* --output=$@ \
	..\tests\scanner\gtkfrob.h ..\tests\scanner\gtkfrob.c

GetType-$(GI_APIVERSION).gir: gettype.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=GetType --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I.. --pkg=gobject-$(GLIB_APIVERSION)	\
	--add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--c-include="gettype.h" --identifier-prefix=GetType --symbol-prefix=gettype	\
	--library=$* --output=$@ \
	..\tests\scanner\gettype.h ..\tests\scanner\gettype.c

Typedefs-$(GI_APIVERSION).gir: typedefs.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=Typedefs --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I.. --pkg=gobject-$(GLIB_APIVERSION)	\
	--add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--c-include="typedefs.h" --identifier-prefix=Typedefs --symbol-prefix=typedefs	\
	--library=$* --output=$@ \
	..\tests\scanner\typedefs.h ..\tests\scanner\typedefs.c

WarnLib-$(GI_APIVERSION).gir: warnlib.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=WarnLib --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I..	\
	--add-include-path=. --include=Gio-$(GLIB_APIVERSION)	\
	--c-include="warnlib.h" --symbol-prefix=warnlib_	\
	--library=$* --output=$@ \
	..\tests\scanner\warnlib.h ..\tests\scanner\warnlib.c

Regress-$(GI_APIVERSION).gir: Utility-$(GI_APIVERSION).gir regress.dll
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all	\
	--namespace=Regress --nsversion=$(GI_APIVERSION)	\
	--no-libtool -I..\tests -I..	\
	--add-include-path=. --include=Gio-$(GLIB_APIVERSION)	\
	--include=Utility-$(GI_APIVERSION) --include=cairo-$(GI_APIVERSION)	\
	--c-include="regress.h" --warn-error	\
	--library=$* --output=$@	\
	$(REGRESS_CFLAGS)	\
	..\tests\scanner\regress.c ..\tests\scanner\regress.h	\
	..\tests\scanner\annotation.c ..\tests\scanner\annotation.h	\
	..\tests\scanner\foo.c ..\tests\scanner\foo.h	\
	..\tests\scanner\drawable.c ..\tests\scanner\drawable.h

Bar-$(GI_APIVERSION).gir: Utility-$(GI_APIVERSION).gir barapp.exe
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all	\
	--namespace=Bar --nsversion=$(GI_APIVERSION)	\
	--program=barapp	\
	--no-libtool -I..\tests -I.. --pkg=gobject-$(GLIB_APIVERSION)	\
	--add-include-path=. --include=GObject-$(GLIB_APIVERSION)	\
	--accept-unprefixed	\
	--output=$@	\
	..\tests\scanner\barapp.c ..\tests\scanner\barapp.h

Headeronly-$(GI_APIVERSION).gir:
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all	\
	--warn-error --reparse-validate --namespace=Headeronly --nsversion=$(GI_APIVERSION)	\
	--header-only --output=$@ ..\tests\scanner\headeronly.h

Identfilter-$(GI_APIVERSION).gir:
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate	\
	--namespace=Identfilter --accept-unprefixed --nsversion=1.0 --header-only	\
	--identifier-filter-cmd="$(PYTHON2) ..\tests\scanner\identfilter.py"	\
	--output=$@ ..\tests\scanner\identfilter.h

# Rules for doc (Mallard) tests
Regress-$(GI_APIVERSION)-C: Regress-$(GI_APIVERSION).gir
	@-if exist $@ @rmdir /s /q $@
	$(PYTHON2) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language C .\Regress-$(GI_APIVERSION).gir -o .\$@\

Regress-$(GI_APIVERSION)-Python: Regress-$(GI_APIVERSION).gir
	@-if exist $@ @rmdir /s /q $@
	$(PYTHON2) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language Python .\Regress-$(GI_APIVERSION).gir -o .\$@\

Regress-$(GI_APIVERSION)-Gjs: Regress-$(GI_APIVERSION).gir
	@-if exist $@ @rmdir /s /q $@
	$(PYTHON2) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language Gjs .\Regress-$(GI_APIVERSION).gir -o .\$@\

Regress-$(GI_APIVERSION)-sections.txt: Regress-$(GI_APIVERSION).gir
	$(PYTHON2) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --write-sections-file .\Regress-$(GI_APIVERSION).gir -o $@

# Run warn tests
warn_tests_log.txt:
	@-echo Runinng warn tests...
	@-set TOP_BUILDDIR=..
	@-copy GObject-$(GLIB_APIVERSION).gir ..\gir
	@-copy GLib-$(GLIB_APIVERSION).gir ..\gir
	@-for %a in (..\tests\warn\*.h) do if not "%a" == "..\tests\warn\common.h" $(PYTHON2) ..\tests\warn\warningtester.py %a >> $@
	@-del ..\gir\GObject-$(GLIB_APIVERSION).gir
	@-del ..\gir\GLib-$(GLIB_APIVERSION).gir

# Rules for source code generation
everything.c everything.h:
	$(PYTHON2) $(G_IR_SCANNER_CURRENT) -I.. \
	--generate-typelib-tests=Everything,everything.h,everything.c	\
	--function-decoration=_GI_TEST_EXTERN	\
	--include-first-in-src=config.h	\
	--include-last-in-header=gitestmacros.h

gitestoffsets.c: Offsets-$(GI_APIVERSION).typelib
	$(PYTHON2) ..\tests\offsets\gen-gitestoffsets ..\tests\offsets\offsets.h > $@

# Generate .typelib's from generated .gir's
$(built_test_typelibs): $(built_test_girs)
	@-echo Compiling $*.typelib...
	@-$(G_IR_COMPILER_CURRENT) --includedir=. --debug --verbose $*.gir -o $@

!else
all: install-introspection

install-introspection:
	@-echo $(ERROR_MSG)
!endif

clean:
	@-del /f/q warn_tests_log.txt
	@-del /f/q gitestoffsets.log
	@-del /f/q Regress-$(GI_APIVERSION)-sections.txt
	@-rmdir /s /q Regress-$(GI_APIVERSION)-Gjs
	@-rmdir /s /q Regress-$(GI_APIVERSION)-Python
	@-rmdir /s /q Regress-$(GI_APIVERSION)-C
	@-for %a in ($(built_test_typelibs)) do @del %a
	@-for %a in ($(built_test_girs)) do @del %a
	@-del /f/q *.lib
	@-del /f/q *.exp
	@-del /f/q *.dll
	@-del /f/q *.exe
	@-for %a in (*.manifest) do @del /f/q %a
	@-del /f/q *.pdb
	@-del /f/q *.obj
	@-del /f/q everything.c everything.h gitestoffsets.c
	@-del offsets.compiled offsets.introspected
	@-del /f/q *.pyc