summaryrefslogtreecommitdiffstats
path: root/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
blob: e0faf5d6ee57dbdaf3a59a0b62e932664231e7f8 (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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# $Id: Makefile.kmk $
## @file
# Sub-Makefile for the Shared OpenGL Host Service.
#

#
# Copyright (C) 2008-2019 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk


#
# Target lists.
#
ifdef VBOX_WITH_MAIN
DLLS      += VBoxSharedCrOpenGL	VBoxOGLrenderspu
LIBRARIES += VBoxOGLcrserverlib	VBoxOGLcrunpacker
BLDDIRS   += \
	$(VBOX_PATH_CROGL_GENFILES)/
endif

ifdef VBOX_WITH_CR_DISPLAY_LISTS
 LIBRARIES += VBoxOGLcrdlm
 DLLS      += VBoxOGLexpandospu
endif # VBOX_WITH_CR_DISPLAY_LISTS

ifeq ($(KBUILD_TARGET),darwin)
 #
 # We have to symlink the system headers of OpenGl cause they have some
 # different directory hierarchy on Mac OS X (no /GL sub directory).
 #
 # See Config.kmk for the global variables.
 #
 INSTALLS += DarwinOpenGLHdrs
 DarwinOpenGLHdrs_INST     = $(VBOX_DARWIN_OPENGL_INST)
 DarwinOpenGLHdrs_SYMLINKS = \
 	$(foreach hdr, $(VBOX_DARWIN_OPENGL_HEADERS),\
 		$(hdr)=>$(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/$(hdr))
endif # darwin

#
# VBoxSharedCrOpenGL
#
VBoxSharedCrOpenGL_TEMPLATE = VBOXCROGLR3HOSTDLL
ifdef VBOX_WITH_XPCOM
 VBoxSharedCrOpenGL_DEFS = VBOX_WITH_XPCOM
 VBoxSharedCrOpenGL_CXXFLAGS = -Wno-non-virtual-dtor -fshort-wchar $(VBOX_GCC_std)
endif
VBoxSharedCrOpenGL_INTERMEDIATES = \
	$(TEMPLATE_VBOXMAINEXE_INTERMEDIATES)
VBoxSharedCrOpenGL_INCS = $(VBOX_GRAPHICS_INCS)
VBoxSharedCrOpenGL_INCS.win = \
	$(VBOX_PATH_SDK)/bindings/mscom/include
ifdef VBOX_WITH_XPCOM
VBoxSharedCrOpenGL_INCS += \
 	$(VBOX_XPCOM_INCS)
endif
VBoxSharedCrOpenGL_SOURCES = \
	crserver/crservice.cpp
VBoxSharedCrOpenGL_SOURCES.win = \
	crserver/VBoxSharedCrOpenGL.rc
VBoxSharedCrOpenGL_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxSharedCrOpenGL.dylib
VBoxSharedCrOpenGL_LIBS = \
	$(PATH_STAGE_LIB)/VBoxOGLcrserverlib$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLcrunpacker$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLhostcrpacker$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
	$(VBOX_LIB_OGL_HOSTCRUTIL) \
	$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
	$(LIB_RUNTIME) \
	$(LIB_VMM)
VBoxSharedCrOpenGL_LIBS.darwin = \
	$(LIB_REM)
ifeq ($(KBUILD_TARGET),win)
 VBoxSharedCrOpenGL_LIBS += \
	$(PATH_OBJ)/VBoxOGLrenderspu/VBoxOGLrenderspu$(VBOX_SUFF_LIB)
else
 VBoxSharedCrOpenGL_LIBS += \
	$(PATH_STAGE_BIN)/VBoxOGLrenderspu$(VBOX_SUFF_DLL)
endif
ifdef VBOX_WITH_XPCOM
 VBoxSharedCrOpenGL_LIBS += \
	$(LIB_XPCOM)
endif
ifdef VBOX_WITH_CRHGSMI
VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
endif
ifdef VBOX_WITH_CR_DISPLAY_LISTS
VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)
endif

#
# VBoxOGLcrserverlib
#
VBoxOGLcrserverlib_TEMPLATE = VBOXCROGLR3HOSTLIB
VBoxOGLcrserverlib_INCS  = \
	. \
	crserverlib \
	$(VBOX_GRAPHICS_INCS)
VBoxOGLcrserverlib_INTERMEDIATES = \
	$(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h \
	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h \
        $(VBOX_PATH_CROGL_GENFILES)/cr_opcodes.h \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h

ifdef VBOX_WITH_CR_DISPLAY_LISTS
VBoxOGLcrserverlib_INTERMEDIATES += $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h
endif

VBoxOGLcrserverlib_SOURCES := \
	crserverlib/server_main.c \
	crserverlib/server_boundsinfo.c \
	crserverlib/server_bufferobject.c \
	crserverlib/server_clear.c \
	crserverlib/server_clip.c \
	crserverlib/server_config.c \
	crserverlib/server_context.c \
	crserverlib/server_gentextures.c \
	crserverlib/server_getmap.c \
	crserverlib/server_getstring.c \
	crserverlib/server_getpointer.c \
	crserverlib/server_getpixelmap.c \
	crserverlib/server_getteximage.c \
	crserverlib/server_lists.c \
	crserverlib/server_misc.c \
	crserverlib/server_occlude.c \
	crserverlib/server_papi.c \
	crserverlib/server_projmatrix.c \
	crserverlib/server_readpixels.c \
	crserverlib/server_stream.c \
	crserverlib/server_viewport.c \
	crserverlib/server_window.c \
	crserverlib/server_winpos.c \
	crserverlib/server_writeback.c \
	crserverlib/server_getshaders.c \
	crserverlib/server_framebuffer.c \
	crserverlib/server_glsl.c \
	crserverlib/server_muralfbo.cpp \
	crserverlib/server_texture.c \
	crserverlib/presenter/server_presenter.cpp \
	crserverlib/presenter/display_base.cpp \
	crserverlib/presenter/display_composite.cpp \
	crserverlib/presenter/window.cpp \
	crserverlib/presenter/display_window.cpp \
	crserverlib/presenter/display_window_rootvr.cpp \
	crserverlib/presenter/display_vrdp.cpp \
	crserverlib/server_rpw.cpp \
	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_get.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c
VBoxOGLcrserverlib_CLEAN = \
	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_get.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c \
	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h
ifdef VBOX_WITH_CR_DISPLAY_LISTS
VBoxOGLcrserverlib_DEFS += VBOX_WITH_CR_DISPLAY_LISTS
endif
ifdef VBOXCR_LOGFPS
VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS
endif
ifdef VBOX_WITH_CRHGSMI
VBoxOGLcrserverlib_DEFS += ifdef VBOX_WITH_CRHGSMI
endif
ifdef VBOX_WITH_CRDUMPER
VBoxOGLcrserverlib_DEFS        += VBOX_WITH_CRDUMPER
endif
ifdef VBOX_WITH_CRSERVER_DUMPER
VBoxOGLcrserverlib_DEFS        += VBOX_WITH_CRSERVER_DUMPER
endif


#
# Generate files for VBoxOGLcrserverlib
#
$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch_header.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)

$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)

$(VBOX_PATH_CROGL_GENFILES)/server_retval.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)

$(VBOX_PATH_CROGL_GENFILES)/server_get.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)

$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)


#
# VBoxOGLcrunpacker
#
VBoxOGLcrunpacker_TEMPLATE       = VBOXCROGLR3HOSTLIB
VBoxOGLcrunpacker_INCS           = \
	unpacker \
	$(VBOX_GRAPHICS_INCS)
VBoxOGLcrunpacker_INTERMEDIATES  = \
	$(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h \
	$(VBOX_PATH_CROGL_GENFILES)/cr_opcodes.h \
	$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
VBoxOGLcrunpacker_SOURCES  = \
	unpacker/unpack_arrays.c \
	unpacker/unpack_bounds.c \
	unpacker/unpack_bufferobject.c \
	unpacker/unpack_calllists.c \
	unpacker/unpack_clipplane.c \
	unpacker/unpack_context.c \
	unpacker/unpack_drawpixels.c \
	unpacker/unpack_fence.c \
	unpacker/unpack_fog.c \
	unpacker/unpack_lights.c \
	unpacker/unpack_map.c \
	unpacker/unpack_materials.c \
	unpacker/unpack_matrices.c \
	unpacker/unpack_misc.c \
	unpacker/unpack_pixelmap.c \
	unpacker/unpack_point.c \
	unpacker/unpack_program.c \
	unpacker/unpack_readpixels.c \
	unpacker/unpack_regcombiner.c \
	unpacker/unpack_stipple.c \
	unpacker/unpack_texture.c \
	unpacker/unpack_writeback.c \
	unpacker/unpack_visibleregion.c \
	unpacker/unpack_shaders.c \
	unpacker/unpack_framebuffer.c \
	$(VBOX_PATH_CROGL_GENFILES)/unpack.c
VBoxOGLcrunpacker_CLEAN = \
	$(VBOX_PATH_CROGL_GENFILES)/unpack.c \
	$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h

#
# Generate files for VBoxOGLcrunpacker.
#
$(VBOX_PATH_CROGL_GENFILES)/unpack.c: \
		$(addprefix $(PATH_SUB_CURRENT)/unpacker/, unpack.py unpacker_special) \
		$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)

$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h: \
		$(addprefix $(PATH_SUB_CURRENT)/unpacker/, unpack_extend.py unpacker_special) \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)


ifdef VBOX_WITH_CR_DISPLAY_LISTS
#
# VBoxOGLcrdlm
#

VBoxOGLcrdlm_TEMPLATE       = VBOXCROGLR3HOSTLIB
VBoxOGLcrdlm_INCS           = \
	dlm
VBoxOGLcrdlm_INTERMEDIATES  = \
	$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h

VBoxOGLcrdlm_SOURCES  = \
	dlm/dlm.c \
	dlm/dlm_arrays.c \
	dlm/dlm_state.c \
	dlm/dlm_checklist.c \
	dlm/dlm_error.c \
	dlm/dlm_lists.c \
	dlm/dlm_pointers.c \
	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c

VBoxOGLcrdlm_CLEAN = \
	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c \
	$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
#
# Generate files for VBoxOGLcrdlm.
#
$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h: \
		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_header.py) \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< header $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@

$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h: \
		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
		$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< headers $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@

$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c: \
		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
		$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< source $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@


#
# VBoxOGLexpandospu
#
VBoxOGLexpandospu_TEMPLATE       = VBOXCROGLR3HOSTDLL
VBoxOGLexpandospu_INCS           = \
	expando
VBoxOGLexpandospu_SOURCES  = \
	expando/expandospu.c \
	expando/expandospu_config.c \
	expando/expandospu_init.c \
	$(VBOX_PATH_CROGL_GENFILES)/expando.c
VBoxOGLexpandospu_CLEAN = \
	$(VBOX_PATH_CROGL_GENFILES)/expando.c
VBoxOGLexpandospu_CLEAN = \
	$(VBOX_PATH_CROGL_GENFILES)/expando.c
VBoxOGLexpandospu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLexpandospu.dylib
VBoxOGLexpandospu_LIBS = \
	$(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
	$(VBOX_LIB_OGL_HOSTCRUTIL) \
	$(LIB_RUNTIME) \
	$(LIB_VMM)
#
# Generate files for VBoxOGLexpandospu.
#
$(VBOX_PATH_CROGL_GENFILES)/expando.c: \
		$(addprefix $(PATH_SUB_CURRENT)/expando/, expando.py expando_special) \
		$(VBOX_CROGL_API_FILES) \
		| $$(dir $$@)
	$(call MSG_GENERATE,python,$@,$<)
	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) > $@
endif


#
# VBoxOGLrenderspu
#
VBoxOGLrenderspu_TEMPLATE = VBOXCROGLR3HOSTDLL
VBoxOGLrenderspu_INTERMEDIATES = \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
	$(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
VBoxOGLrenderspu_INCS = $(VBOX_GRAPHICS_INCS)
VBoxOGLrenderspu_SOURCES = \
	render/renderspu.c \
	render/renderspu_config.c \
	render/renderspu_init.c
VBoxOGLrenderspu_SOURCES.win     = \
	render/renderspu_wgl.c \
	render/render.def \
	render/VBoxOGLrenderspu.rc
VBoxOGLrenderspu_SOURCES.linux   = render/renderspu_glx.c
VBoxOGLrenderspu_SOURCES.solaris = render/renderspu_glx.c
VBoxOGLrenderspu_SOURCES.freebsd = render/renderspu_glx.c
VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow
VBoxOGLrenderspu_SOURCES.darwin  = \
	OpenGLTest/OpenGLTestDarwin.cpp \
	render/renderspu_cocoa.c \
	render/renderspu_cocoa_helper.m
ifdef VBOX_WITH_CRHGSMI
VBoxOGLrenderspu_DEFS += VBOX_WITH_CRHGSMI
endif
ifdef VBOX_WITH_VDMA
VBoxOGLrenderspu_DEFS += VBOX_WITH_VDMA
endif
VBoxOGLrenderspu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLrenderspu.dylib -framework IOKit
VBoxOGLrenderspu_LIBS = \
	$(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
	$(VBOX_LIB_OGL_HOSTCRUTIL) \
	$(LIB_RUNTIME)
if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) # the X11 gang
 VBoxOGLrenderspu_LIBS += \
	Xmu \
	X11 \
	Xext
 VBoxOGLrenderspu_LIBPATH = \
	$(VBOX_LIBPATH_X11)
endif

LIBRARIES += VBoxOGLTest
VBoxOGLTest_TEMPLATE = VBOXR3
ifneq ($(KBUILD_TARGET),darwin)
  VBoxOGLTest_SOURCES = OpenGLTest/OpenGLTest.cpp
endif
VBoxOGLTest_SOURCES.darwin = OpenGLTest/OpenGLTestDarwin.cpp

#
# VBoxTestOGL - OpenGL support test app.
# Note! Doesn't link with VBOX_WITH_DEBUG_VCC_CRT defined because it uses Qt.
#
if (   defined(VBOX_WITH_QTGUI) \
    && (defined(VBOX_WITH_CROGL) || defined(VBOX_WITH_VIDEOHWACCEL)) \
    && !defined(VBOX_WITH_DEBUG_VCC_CRT))
 ifneq ($(KBUILD_TARGET),darwin)
  ifdef VBOX_WITH_VIDEOHWACCEL
   USES += qt5
  endif
  PROGRAMS += VBoxTestOGL
  VBoxTestOGL_TEMPLATE = $(if $(VBOX_WITH_VIDEOHWACCEL),$(if $(VBOX_WITH_HARDENING),VBOXQTGUI,VBOXQTGUIEXE),VBOXMAINEXE)
  VBoxTestOGL_SOURCES = OpenGLTest/OpenGLTestApp.cpp
  VBoxTestOGL_SOURCES.win = OpenGLTest/VBoxTestOGL.rc
  VBoxTestOGL_LIBS = \
  	$(if $(VBOX_WITH_CROGL), \
  	    $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
  	    $(VBOX_LIB_OGL_HOSTCRUTIL),) \
  	$(if $(VBOX_WITH_VIDEOHWACCEL), $(PATH_STAGE_LIB)/VBoxOGL2D$(VBOX_SUFF_LIB),) \
  	$(LIB_RUNTIME)
  VBoxTestOGL_DEFS += \
    VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\" \
    $(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \
    $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,)
  ifdef VBOX_WITH_VIDEOHWACCEL
   VBoxTestOGL_QT_MODULES   += Core Gui OpenGL Widgets
   VBoxTestOGL_LIBS.linux   += xcb
   VBoxTestOGL_LIBS.solaris += xcb
   VBoxTestOGL_LIBS.freebsd += xcb
   VBoxTestOGL_LDFLAGS.darwin += -framework OpenGL
   VBoxTestOGL_LIBS.win       += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib
   if1of ($(KBUILD_TARGET), solaris linux freebsd)
    # must come after VBoxOGL2D, therefore don't set the arch-specific LIBS variable here!
    VBoxTestOGL_LIBS += GL
   endif
  endif
  # Don't let ld strip out explicitly linked libraries even when they are not needed.
  # This was causing some dynamic library loading problems in case of indirect dependencies
  # in systems where RUNPATH instead of RPATH is utilized.
  VBoxTestOGL_LDFLAGS.linux = -Wl,--no-as-needed
  VBoxTestOGL_LDFLAGS.win = /SUBSYSTEM:windows
 endif
endif

include $(FILE_KBUILD_SUB_FOOTER)