mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 05:57:20 +00:00
autotools: correctly build canvas-related code
spice client and spice server shares code from
common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is
shared, the server code wants a canvas compiled with
SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas
compiled with SW_CANVAS_CACHE.
The initial autotools refactoring didn't take that into account,
this is now fixed by this commit. After this commit, the canvas
files from common/ are no longer compiled as part of the
libspice-common.la convenience library. Instead, there are "proxy"
canvas source files in client/ and server/ which #include the
appropriate C files after defining the relevant #define for the
binary that is being built.
To prevent misuse of the canvas c files and headers in common/,
SPICE_CANVAS_INTERNAL must be set when including the canvas headers
from common/ or when building the c files from common/ otherwise
the build will error out.
This commit is contained in:
parent
253aa0c960
commit
2db7212175
@ -77,6 +77,7 @@ spicec_SOURCES = \
|
||||
process_loop.h \
|
||||
read_write_mutex.h \
|
||||
record_channel.cpp \
|
||||
red_canvas_base.h \
|
||||
red_channel.cpp \
|
||||
red_channel.h \
|
||||
red_client.cpp \
|
||||
@ -208,7 +209,6 @@ endif
|
||||
|
||||
|
||||
INCLUDES = \
|
||||
-DSW_CANVAS_CACHE \
|
||||
-D__STDC_LIMIT_MACROS \
|
||||
-I$(top_srcdir)/client/x11 \
|
||||
-I$(top_srcdir)/common \
|
||||
|
||||
@ -31,8 +31,10 @@
|
||||
#include "red_gdi_canvas.h"
|
||||
#endif
|
||||
#include "platform.h"
|
||||
#include "sw_canvas.h"
|
||||
#include "gl_canvas.h"
|
||||
#include "red_sw_canvas.h"
|
||||
#ifdef USE_OGL
|
||||
#include "red_gl_canvas.h"
|
||||
#endif
|
||||
#include "quic.h"
|
||||
#include "mutex.h"
|
||||
#include "cmd_line_parser.h"
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "messages.h"
|
||||
#include "cache.hpp"
|
||||
#include "shared_cache.hpp"
|
||||
#include "canvas_base.h"
|
||||
#include "canvas_utils.h"
|
||||
#include "glz_decoded_image.h"
|
||||
#include "glz_decoder.h"
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include "lz_common.h"
|
||||
#include "glz_decoder_config.h"
|
||||
#include "glz_decoder_window.h"
|
||||
#include "canvas_base.h"
|
||||
#include "red_canvas_base.h"
|
||||
|
||||
class GlzDecodeHandler {
|
||||
public:
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#define _H_JPEG_DECODER
|
||||
|
||||
#include "common.h"
|
||||
#include "canvas_base.h"
|
||||
#include "red_canvas_base.h"
|
||||
|
||||
#ifdef WIN32
|
||||
/* We need some hacks to avoid warnings from the jpeg headers */
|
||||
|
||||
26
client/red_canvas_base.h
Normal file
26
client/red_canvas_base.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2011 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _H_RED_CANVAS_BASE
|
||||
#define _H_RED_CANVAS_BASE
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "canvas_base.h"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
#endif
|
||||
@ -23,6 +23,12 @@
|
||||
#include "region.h"
|
||||
#include "red_pixmap_gdi.h"
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "gdi_canvas.c"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
GDICanvas::GDICanvas(int width, int height, uint32_t format,
|
||||
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
|
||||
GlzDecoderWindow &glz_decoder_window, CSurfaces &csurfaces)
|
||||
|
||||
@ -19,7 +19,11 @@
|
||||
#define _H_GDICANVAS
|
||||
|
||||
#include "canvas.h"
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "gdi_canvas.h"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
#include "red_pixmap_gdi.h"
|
||||
|
||||
class RedPixmap;
|
||||
|
||||
@ -24,6 +24,12 @@
|
||||
#include "red_pixmap_gl.h"
|
||||
#include <GL/glx.h>
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "gl_canvas.c"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
GCanvas::GCanvas(int width, int height, uint32_t format, RedWindow *win,
|
||||
RenderType rendertype,
|
||||
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
|
||||
|
||||
@ -19,8 +19,13 @@
|
||||
#define _H_GCANVAS
|
||||
|
||||
#include "canvas.h"
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "sw_canvas.h"
|
||||
#include "gl_canvas.h"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
#include "red_pixmap_gl.h"
|
||||
#include "red_window.h"
|
||||
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
#include "region.h"
|
||||
#include "red_pixmap_sw.h"
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "sw_canvas.c"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
SCanvas::SCanvas(bool onscreen,
|
||||
int width, int height, uint32_t format, RedWindow *win,
|
||||
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
|
||||
|
||||
@ -20,7 +20,11 @@
|
||||
#define _H_CCANVAS
|
||||
|
||||
#include "canvas.h"
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_CACHE
|
||||
#include "sw_canvas.h"
|
||||
#undef SW_CANVAS_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
class RedPixmap;
|
||||
|
||||
|
||||
@ -412,10 +412,6 @@
|
||||
RelativePath="..\foreign_menu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\gdi_canvas.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\generated_demarshallers.cpp"
|
||||
>
|
||||
@ -636,10 +632,6 @@
|
||||
RelativePath="..\gui\softtexture.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\sw_canvas.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\threads.cpp"
|
||||
>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#define _H_ZLIB_DECODER
|
||||
|
||||
#include "common.h"
|
||||
#include "canvas_base.h"
|
||||
#include "red_canvas_base.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define ZLIB_WINAPI
|
||||
|
||||
@ -6,7 +6,6 @@ NULL =
|
||||
|
||||
noinst_LTLIBRARIES = libspice-common.la
|
||||
libspice_common_la_SOURCES = \
|
||||
canvas_base.h \
|
||||
canvas_utils.c \
|
||||
canvas_utils.h \
|
||||
draw.h \
|
||||
@ -34,21 +33,10 @@ libspice_common_la_SOURCES = \
|
||||
rop3.c \
|
||||
rop3.h \
|
||||
spice_common.h \
|
||||
sw_canvas.c \
|
||||
sw_canvas.h \
|
||||
$(NULL)
|
||||
|
||||
if OS_WIN32
|
||||
libspice_common_la_SOURCES += \
|
||||
gdi_canvas.h \
|
||||
gdi_canvas.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if SUPPORT_GL
|
||||
libspice_common_la_SOURCES += \
|
||||
gl_canvas.h \
|
||||
gl_canvas.c \
|
||||
gl_utils.h \
|
||||
glc.h \
|
||||
glc.c \
|
||||
@ -58,7 +46,6 @@ libspice_common_la_SOURCES += \
|
||||
endif
|
||||
|
||||
INCLUDES = \
|
||||
-DSW_CANVAS_IMAGE_CACHE \
|
||||
$(GL_CFLAGS) \
|
||||
$(PIXMAN_CFLAGS) \
|
||||
$(PROTOCOL_CFLAGS) \
|
||||
@ -69,6 +56,13 @@ INCLUDES = \
|
||||
|
||||
EXTRA_DIST = \
|
||||
canvas_base.c \
|
||||
canvas_base.h \
|
||||
gdi_canvas.c \
|
||||
gdi_canvas.h \
|
||||
gl_canvas.c \
|
||||
gl_canvas.h \
|
||||
sw_canvas.c \
|
||||
sw_canvas.h \
|
||||
lz_compress_tmpl.c \
|
||||
lz_decompress_tmpl.c \
|
||||
quic_family_tmpl.c \
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This file shouldn't be compiled directly"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
@ -19,6 +19,9 @@
|
||||
#ifndef _H_CANVAS_BASE
|
||||
#define _H_CANVAS_BASE
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This header shouldn't be included directly"
|
||||
#endif
|
||||
|
||||
#include "pixman_utils.h"
|
||||
#include "lz.h"
|
||||
|
||||
@ -16,6 +16,11 @@
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This file shouldn't be compiled directly"
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <wingdi.h>
|
||||
#include "gdi_canvas.h"
|
||||
|
||||
@ -19,6 +19,10 @@
|
||||
#ifndef _H__GDI_CANVAS
|
||||
#define _H__GDI_CANVAS
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This header shouldn't be included directly"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -16,11 +16,14 @@
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This file shouldn't be compiled directly"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gl_canvas.h"
|
||||
#include "quic.h"
|
||||
#include "rop3.h"
|
||||
#include "region.h"
|
||||
|
||||
@ -20,6 +20,10 @@
|
||||
#include "canvas_base.h"
|
||||
#include "region.h"
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This header shouldn't be included directly"
|
||||
#endif
|
||||
|
||||
#ifndef _H__GL_CANVAS
|
||||
#define _H__GL_CANVAS
|
||||
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This file shouldn't be compiled directly"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "sw_canvas.h"
|
||||
#define CANVAS_USE_PIXMAN
|
||||
|
||||
@ -19,6 +19,10 @@
|
||||
#ifndef _H__CANVAS
|
||||
#define _H__CANVAS
|
||||
|
||||
#ifndef SPICE_CANVAS_INTERNAL
|
||||
#error "This header shouldn't be included directly"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "draw.h"
|
||||
|
||||
@ -6,7 +6,6 @@ INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/common \
|
||||
-DRED_STATISTICS \
|
||||
-DSW_CANVAS_IMAGE_CACHE \
|
||||
$(Z_LIBS) \
|
||||
$(CELT051_CFLAGS) \
|
||||
$(PIXMAN_CFLAGS) \
|
||||
@ -89,6 +88,8 @@ libspice_server_la_SOURCES = \
|
||||
red_worker.h \
|
||||
reds.c \
|
||||
reds.h \
|
||||
reds_sw_canvas.c \
|
||||
reds_sw_canvas.h \
|
||||
snd_worker.c \
|
||||
snd_worker.h \
|
||||
spice-experimental.h \
|
||||
@ -105,6 +106,13 @@ libspice_server_la_SOURCES += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if SUPPORT_GL
|
||||
libspice_server_la_SOURCES += \
|
||||
reds_gl_canvas.c \
|
||||
reds_gl_canvas.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if SUPPORT_SMARTCARD
|
||||
libspice_server_la_SOURCES += \
|
||||
smartcard.c \
|
||||
|
||||
@ -28,9 +28,9 @@
|
||||
#include "spice.h"
|
||||
#include "red_worker.h"
|
||||
#include "quic.h"
|
||||
#include "sw_canvas.h"
|
||||
#include "reds_sw_canvas.h"
|
||||
#ifdef USE_OGL
|
||||
#include "gl_canvas.h"
|
||||
#include "reds_gl_canvas.h"
|
||||
#endif // USE_OGL
|
||||
#include "reds.h"
|
||||
#include "red_dispatcher.h"
|
||||
|
||||
@ -36,9 +36,9 @@
|
||||
#include "region.h"
|
||||
#include <spice/protocol.h>
|
||||
#include "red_worker.h"
|
||||
#include "sw_canvas.h"
|
||||
#include "reds_sw_canvas.h"
|
||||
#ifdef USE_OGL
|
||||
#include "gl_canvas.h"
|
||||
#include "reds_gl_canvas.h"
|
||||
#include "ogl_ctx.h"
|
||||
#endif /* USE_OGL */
|
||||
#include "quic.h"
|
||||
|
||||
24
server/reds_gl_canvas.c
Normal file
24
server/reds_gl_canvas.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2011 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "reds_gl_canvas.h"
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_IMAGE_CACHE
|
||||
#include "gl_canvas.c"
|
||||
#undef SW_CANVAS_IMAGE_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
27
server/reds_gl_canvas.h
Normal file
27
server/reds_gl_canvas.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2011 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _H_REDS_GL_CANVAS
|
||||
#define _H_REDS_GL_CANVAS
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_IMAGE_CACHE
|
||||
#include "gl_canvas.h"
|
||||
#undef SW_CANVAS_IMAGE_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
#endif
|
||||
24
server/reds_sw_canvas.c
Normal file
24
server/reds_sw_canvas.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2011 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "reds_sw_canvas.h"
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_IMAGE_CACHE
|
||||
#include "sw_canvas.c"
|
||||
#undef SW_CANVAS_IMAGE_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
26
server/reds_sw_canvas.h
Normal file
26
server/reds_sw_canvas.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2011 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _H_REDS_SW_CANVAS
|
||||
#define _H_REDS_SW_CANVAS
|
||||
|
||||
#define SPICE_CANVAS_INTERNAL
|
||||
#define SW_CANVAS_IMAGE_CACHE
|
||||
#include "sw_canvas.h"
|
||||
#undef SW_CANVAS_IMAGE_CACHE
|
||||
#undef SPICE_CANVAS_INTERNAL
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user