VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk@ 78457

Last change on this file since 78457 was 78457, checked in by vboxsync, 6 years ago

HostServices/SharedOpenGL: Fix library order so the linker can find all required symbols, fixes loading the OpenGL service on at least Linux (gave unresolved crUnloadOpenGL symbol errors before)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.2 KB
Line 
1# $Id: Makefile.kmk 78457 2019-05-09 11:03:50Z vboxsync $
2## @file
3# Sub-Makefile for the Shared OpenGL Host Service.
4#
5
6#
7# Copyright (C) 2008-2019 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18SUB_DEPTH = ../../../..
19include $(KBUILD_PATH)/subheader.kmk
20
21
22#
23# Target lists.
24#
25ifdef VBOX_WITH_MAIN
26DLLS += VBoxSharedCrOpenGL
27LIBRARIES += VBoxOGLcrserverlib VBoxOGLcrunpacker VBoxOGLrenderspu
28BLDDIRS += \
29 $(VBOX_PATH_CROGL_GENFILES)/
30endif
31
32ifeq ($(KBUILD_TARGET),darwin)
33 #
34 # We have to symlink the system headers of OpenGl cause they have some
35 # different directory hierarchy on Mac OS X (no /GL sub directory).
36 #
37 # See Config.kmk for the global variables.
38 #
39 INSTALLS += DarwinOpenGLHdrs
40 DarwinOpenGLHdrs_INST = $(VBOX_DARWIN_OPENGL_INST)
41 DarwinOpenGLHdrs_SYMLINKS = \
42 $(foreach hdr, $(VBOX_DARWIN_OPENGL_HEADERS),\
43 $(hdr)=>$(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/$(hdr))
44endif # darwin
45
46#
47# VBoxSharedCrOpenGL
48#
49VBoxSharedCrOpenGL_TEMPLATE = VBOXCROGLR3HOSTDLL
50ifdef VBOX_WITH_XPCOM
51 VBoxSharedCrOpenGL_DEFS = VBOX_WITH_XPCOM
52 VBoxSharedCrOpenGL_CXXFLAGS = -Wno-non-virtual-dtor -fshort-wchar $(VBOX_GCC_std)
53endif
54VBoxSharedCrOpenGL_INTERMEDIATES = \
55 $(TEMPLATE_VBOXMAINEXE_INTERMEDIATES)
56VBoxSharedCrOpenGL_INCS = $(VBOX_GRAPHICS_INCS)
57VBoxSharedCrOpenGL_INCS.win = \
58 $(VBOX_PATH_SDK)/bindings/mscom/include
59ifdef VBOX_WITH_XPCOM
60VBoxSharedCrOpenGL_INCS += \
61 $(VBOX_XPCOM_INCS)
62endif
63VBoxSharedCrOpenGL_SOURCES = \
64 crserver/crservice.cpp
65VBoxSharedCrOpenGL_SOURCES.win = \
66 crserver/VBoxSharedCrOpenGL.rc
67VBoxSharedCrOpenGL_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxSharedCrOpenGL.dylib -framework IOKit
68VBoxSharedCrOpenGL_LIBS = \
69 $(PATH_STAGE_LIB)/VBoxOGLcrserverlib$(VBOX_SUFF_LIB) \
70 $(PATH_STAGE_LIB)/VBoxOGLrenderspu$(VBOX_SUFF_LIB) \
71 $(PATH_STAGE_LIB)/VBoxOGLhosterrorspu$(VBOX_SUFF_LIB) \
72 $(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
73 $(PATH_STAGE_LIB)/VBoxOGLcrunpacker$(VBOX_SUFF_LIB) \
74 $(PATH_STAGE_LIB)/VBoxOGLhostcrpacker$(VBOX_SUFF_LIB) \
75 $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
76 $(PATH_STAGE_LIB)/VBoxOGLhostcrutil$(VBOX_SUFF_LIB) \
77 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
78 $(LIB_RUNTIME) \
79 $(LIB_VMM)
80VBoxSharedCrOpenGL_LIBS.darwin = \
81 $(LIB_REM)
82ifdef VBOX_WITH_XPCOM
83 VBoxSharedCrOpenGL_LIBS += \
84 $(LIB_XPCOM)
85endif
86if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) # the X11 gang
87 VBoxSharedCrOpenGL_LIBS += \
88 Xmu \
89 X11 \
90 Xext
91 VBoxSharedCrOpenGL_LIBPATH = \
92 $(VBOX_LIBPATH_X11)
93endif
94ifdef VBOX_WITH_CRHGSMI
95VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
96endif
97
98#
99# VBoxOGLcrserverlib
100#
101VBoxOGLcrserverlib_TEMPLATE = VBOXCROGLR3HOSTLIB
102VBoxOGLcrserverlib_INCS = \
103 . \
104 crserverlib \
105 $(VBOX_GRAPHICS_INCS)
106VBoxOGLcrserverlib_INTERMEDIATES = \
107 $(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h \
108 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h \
109 $(VBOX_PATH_CROGL_GENFILES)/cr_opcodes.h \
110 $(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
111 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
112
113VBoxOGLcrserverlib_SOURCES := \
114 crserverlib/server_main.cpp \
115 crserverlib/server_boundsinfo.cpp \
116 crserverlib/server_bufferobject.cpp \
117 crserverlib/server_clear.cpp \
118 crserverlib/server_clip.cpp \
119 crserverlib/server_config.cpp \
120 crserverlib/server_context.cpp \
121 crserverlib/server_gentextures.cpp \
122 crserverlib/server_getmap.cpp \
123 crserverlib/server_getstring.cpp \
124 crserverlib/server_getpointer.cpp \
125 crserverlib/server_getpixelmap.cpp \
126 crserverlib/server_getteximage.cpp \
127 crserverlib/server_lists.cpp \
128 crserverlib/server_misc.cpp \
129 crserverlib/server_occlude.cpp \
130 crserverlib/server_papi.cpp \
131 crserverlib/server_projmatrix.cpp \
132 crserverlib/server_readpixels.cpp \
133 crserverlib/server_stream.cpp \
134 crserverlib/server_viewport.cpp \
135 crserverlib/server_window.cpp \
136 crserverlib/server_winpos.cpp \
137 crserverlib/server_writeback.cpp \
138 crserverlib/server_getshaders.cpp \
139 crserverlib/server_framebuffer.cpp \
140 crserverlib/server_glsl.cpp \
141 crserverlib/server_muralfbo.cpp \
142 crserverlib/server_texture.cpp \
143 crserverlib/presenter/server_presenter.cpp \
144 crserverlib/presenter/display_base.cpp \
145 crserverlib/presenter/display_composite.cpp \
146 crserverlib/presenter/window.cpp \
147 crserverlib/presenter/display_window.cpp \
148 crserverlib/presenter/display_window_rootvr.cpp \
149 crserverlib/presenter/display_vrdp.cpp \
150 crserverlib/server_rpw.cpp \
151 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
152 $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
153 $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
154 $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp
155VBoxOGLcrserverlib_CLEAN = \
156 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
157 $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
158 $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
159 $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp \
160 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h
161ifdef VBOXCR_LOGFPS
162VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS
163endif
164ifdef VBOX_WITH_CRHGSMI
165VBoxOGLcrserverlib_DEFS += ifdef VBOX_WITH_CRHGSMI
166endif
167ifdef VBOX_WITH_CRDUMPER
168VBoxOGLcrserverlib_DEFS += VBOX_WITH_CRDUMPER
169endif
170ifdef VBOX_WITH_CRSERVER_DUMPER
171VBoxOGLcrserverlib_DEFS += VBOX_WITH_CRSERVER_DUMPER
172endif
173
174
175#
176# Generate files for VBoxOGLcrserverlib
177#
178$(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 $$@)
179 $(call MSG_GENERATE,python,$@,$<)
180 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
181
182$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp: $(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 $$@)
183 $(call MSG_GENERATE,python,$@,$<)
184 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
185
186$(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
187 $(call MSG_GENERATE,python,$@,$<)
188 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
189
190$(VBOX_PATH_CROGL_GENFILES)/server_get.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
191 $(call MSG_GENERATE,python,$@,$<)
192 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
193
194$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
195 $(call MSG_GENERATE,python,$@,$<)
196 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
197
198
199#
200# VBoxOGLcrunpacker
201#
202VBoxOGLcrunpacker_TEMPLATE = VBOXCROGLR3HOSTLIB
203VBoxOGLcrunpacker_INCS = \
204 unpacker \
205 $(VBOX_GRAPHICS_INCS)
206VBoxOGLcrunpacker_INTERMEDIATES = \
207 $(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h \
208 $(VBOX_PATH_CROGL_GENFILES)/cr_opcodes.h \
209 $(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h \
210 $(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
211 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
212VBoxOGLcrunpacker_SOURCES = \
213 unpacker/unpack_arrays.cpp \
214 unpacker/unpack_bounds.cpp \
215 unpacker/unpack_bufferobject.cpp \
216 unpacker/unpack_calllists.cpp \
217 unpacker/unpack_clipplane.cpp \
218 unpacker/unpack_context.cpp \
219 unpacker/unpack_drawpixels.cpp \
220 unpacker/unpack_fence.cpp \
221 unpacker/unpack_fog.cpp \
222 unpacker/unpack_lights.cpp \
223 unpacker/unpack_map.cpp \
224 unpacker/unpack_materials.cpp \
225 unpacker/unpack_matrices.cpp \
226 unpacker/unpack_misc.cpp \
227 unpacker/unpack_pixelmap.cpp \
228 unpacker/unpack_point.cpp \
229 unpacker/unpack_program.cpp \
230 unpacker/unpack_readpixels.cpp \
231 unpacker/unpack_regcombiner.cpp \
232 unpacker/unpack_stipple.cpp \
233 unpacker/unpack_texture.cpp \
234 unpacker/unpack_writeback.cpp \
235 unpacker/unpack_visibleregion.cpp \
236 unpacker/unpack_shaders.cpp \
237 unpacker/unpack_framebuffer.cpp \
238 $(VBOX_PATH_CROGL_GENFILES)/unpack.cpp
239VBoxOGLcrunpacker_CLEAN = \
240 $(VBOX_PATH_CROGL_GENFILES)/unpack.cpp \
241 $(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h
242
243#
244# Generate files for VBoxOGLcrunpacker.
245#
246$(VBOX_PATH_CROGL_GENFILES)/unpack.cpp: \
247 $(addprefix $(PATH_SUB_CURRENT)/unpacker/, unpack.py unpacker_special) \
248 $(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h \
249 $(VBOX_CROGL_API_FILES) \
250 | $$(dir $$@)
251 $(call MSG_GENERATE,python,$@,$<)
252 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
253
254$(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h: \
255 $(addprefix $(PATH_SUB_CURRENT)/unpacker/, unpack_extend.py unpacker_special) \
256 $(VBOX_CROGL_API_FILES) \
257 | $$(dir $$@)
258 $(call MSG_GENERATE,python,$@,$<)
259 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
260
261
262#
263# VBoxOGLrenderspu
264#
265VBoxOGLrenderspu_TEMPLATE = VBOXCROGLR3HOSTLIB
266VBoxOGLrenderspu_INTERMEDIATES = \
267 $(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \
268 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
269VBoxOGLrenderspu_INCS = $(VBOX_GRAPHICS_INCS)
270VBoxOGLrenderspu_SOURCES = \
271 render/renderspu.c \
272 render/renderspu_config.c \
273 render/renderspu_init.c
274VBoxOGLrenderspu_SOURCES.win = \
275 render/renderspu_wgl.c
276VBoxOGLrenderspu_SOURCES.linux = render/renderspu_glx.c
277VBoxOGLrenderspu_SOURCES.solaris = render/renderspu_glx.c
278VBoxOGLrenderspu_SOURCES.freebsd = render/renderspu_glx.c
279VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow
280VBoxOGLrenderspu_SOURCES.darwin = \
281 OpenGLTest/OpenGLTestDarwin.cpp \
282 render/renderspu_cocoa.c \
283 render/renderspu_cocoa_helper.m
284ifdef VBOX_WITH_CRHGSMI
285VBoxOGLrenderspu_DEFS += VBOX_WITH_CRHGSMI
286endif
287ifdef VBOX_WITH_VDMA
288VBoxOGLrenderspu_DEFS += VBOX_WITH_VDMA
289endif
290
291LIBRARIES += VBoxOGLTest
292VBoxOGLTest_TEMPLATE = VBOXR3NP
293ifneq ($(KBUILD_TARGET),darwin)
294 VBoxOGLTest_SOURCES = OpenGLTest/OpenGLTest.cpp
295endif
296VBoxOGLTest_SOURCES.darwin = OpenGLTest/OpenGLTestDarwin.cpp
297
298#
299# VBoxTestOGL - OpenGL support test app.
300# Note! Doesn't link with VBOX_WITH_DEBUG_VCC_CRT defined because it uses Qt.
301#
302if ( defined(VBOX_WITH_QTGUI) \
303 && (defined(VBOX_WITH_CROGL) || defined(VBOX_WITH_VIDEOHWACCEL)) \
304 && !defined(VBOX_WITH_DEBUG_VCC_CRT))
305 ifneq ($(KBUILD_TARGET),darwin)
306 ifdef VBOX_WITH_VIDEOHWACCEL
307 USES += qt5
308 endif
309 PROGRAMS += VBoxTestOGL
310 VBoxTestOGL_TEMPLATE = $(if $(VBOX_WITH_VIDEOHWACCEL),$(if $(VBOX_WITH_HARDENING),VBOXQTGUI,VBOXQTGUIEXE),VBOXMAINEXE)
311 VBoxTestOGL_INCS += $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
312 VBoxTestOGL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1
313 VBoxTestOGL_DEFS.linux = Linux=1 _GNU_SOURCE
314 VBoxTestOGL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
315 VBoxTestOGL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
316 VBoxTestOGL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
317 VBoxTestOGL_SOURCES = OpenGLTest/OpenGLTestApp.cpp
318 VBoxTestOGL_SOURCES.win = OpenGLTest/VBoxTestOGL.rc
319 VBoxTestOGL_LIBS = \
320 $(if $(VBOX_WITH_CROGL), \
321 $(PATH_STAGE_LIB)/VBoxOGLhosterrorspu$(VBOX_SUFF_LIB) \
322 $(PATH_STAGE_LIB)/VBoxOGLrenderspu$(VBOX_SUFF_LIB) \
323 $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
324 $(PATH_STAGE_LIB)/VBoxOGLhostcrutil$(VBOX_SUFF_LIB),) \
325 $(if $(VBOX_WITH_VIDEOHWACCEL), $(PATH_STAGE_LIB)/VBoxOGL2D$(VBOX_SUFF_LIB),) \
326 $(LIB_RUNTIME)
327 VBoxTestOGL_DEFS += \
328 VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\" \
329 $(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \
330 $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,)
331 ifdef VBOX_WITH_VIDEOHWACCEL
332 VBoxTestOGL_QT_MODULES += Core Gui OpenGL Widgets
333 VBoxTestOGL_LIBS.linux += xcb
334 VBoxTestOGL_LIBS.solaris += xcb
335 VBoxTestOGL_LIBS.freebsd += xcb
336 VBoxTestOGL_LDFLAGS.darwin += -framework OpenGL -framework IOKit
337 VBoxTestOGL_LIBS.win += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib
338 if1of ($(KBUILD_TARGET), solaris linux freebsd)
339 # must come after VBoxOGL2D, therefore don't set the arch-specific LIBS variable here!
340 VBoxTestOGL_LIBS += GL pthread dl
341 endif
342 endif
343 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) # the X11 gang
344 VBoxTestOGL_LIBS += \
345 Xmu \
346 X11 \
347 Xext
348 VBoxTestOGL_LIBPATH = \
349 $(VBOX_LIBPATH_X11)
350endif
351 # Don't let ld strip out explicitly linked libraries even when they are not needed.
352 # This was causing some dynamic library loading problems in case of indirect dependencies
353 # in systems where RUNPATH instead of RPATH is utilized.
354 VBoxTestOGL_LDFLAGS.linux = -Wl,--no-as-needed
355 VBoxTestOGL_LDFLAGS.win = /SUBSYSTEM:windows
356 endif
357endif
358
359include $(FILE_KBUILD_SUB_FOOTER)
360
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette