Generate export headers and use it in our headers

Auto tests are adjusted to link against the library instead of compiling
the source files.
This commit is contained in:
Martin Gräßlin 2014-09-17 15:10:43 +02:00
parent e763d9acc0
commit 5e54a86d5e
10 changed files with 34 additions and 120 deletions

View file

@ -9,6 +9,7 @@ set(SERVER_LIB_SRCS
)
add_library(KF5WaylandServer ${SERVER_LIB_SRCS})
generate_export_header(KF5WaylandServer BASE_NAME KWaylandServer)
add_library(KF5::WaylandServer ALIAS KF5WaylandServer)
target_link_libraries(KF5WaylandServer

View file

@ -5,17 +5,9 @@ set_source_files_properties(${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client
########################################################
set( testWaylandConnectionThread_SRCS
test_wayland_connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandConnectionThread ${testWaylandConnectionThread_SRCS})
target_link_libraries( testWaylandConnectionThread Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandConnectionThread Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandConnectionThread testWaylandConnectionThread)
ecm_mark_as_test(testWaylandConnectionThread)
@ -24,20 +16,9 @@ ecm_mark_as_test(testWaylandConnectionThread)
########################################################
set( testWaylandRegistry_SRCS
test_wayland_registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandRegistry ${testWaylandRegistry_SRCS})
add_dependencies(testWaylandRegistry wayland-client-fullscreen-shell)
target_link_libraries( testWaylandRegistry Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandRegistry Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandRegistry testWaylandRegistry)
ecm_mark_as_test(testWaylandRegistry)
@ -47,14 +28,9 @@ ecm_mark_as_test(testWaylandRegistry)
if(Wayland_VERSION VERSION_GREATER "1.4.0")
set( testWaylandFullscreenShell_SRCS
test_wayland_fullscreen_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/fullscreen_shell.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
)
add_executable(testWaylandFullscreenShell ${testWaylandFullscreenShell_SRCS})
add_dependencies(testWaylandFullscreenShell wayland-client-fullscreen-shell)
target_link_libraries( testWaylandFullscreenShell Qt5::Test Wayland::Client)
target_link_libraries( testWaylandFullscreenShell Qt5::Test KF5::WaylandClient Wayland::Client)
add_test(kwin-testWaylandFullscreenShell testWaylandFullscreenShell)
ecm_mark_as_test(testWaylandFullscreenShell)
endif()
@ -64,22 +40,9 @@ endif()
########################################################
set( testWaylandOutput_SRCS
test_wayland_output.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/fullscreen_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/output.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandOutput ${testWaylandOutput_SRCS})
add_dependencies(testWaylandOutput wayland-client-fullscreen-shell)
target_link_libraries( testWaylandOutput Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandOutput Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandOutput testWaylandOutput)
ecm_mark_as_test(testWaylandOutput)
@ -88,24 +51,9 @@ ecm_mark_as_test(testWaylandOutput)
########################################################
set( testWaylandShell_SRCS
test_wayland_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/compositor.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/fullscreen_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/surface.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandShell ${testWaylandShell_SRCS})
add_dependencies(testWaylandShell wayland-client-fullscreen-shell)
target_link_libraries( testWaylandShell Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandShell Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandShell testWaylandShell)
ecm_mark_as_test(testWaylandShell)
@ -114,25 +62,9 @@ ecm_mark_as_test(testWaylandShell)
########################################################
set( testWaylandSurface_SRCS
test_wayland_surface.cpp
${KWAYLAND_SOURCE_DIR}/src/client/buffer.cpp
${KWAYLAND_SOURCE_DIR}/src/client/compositor.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/fullscreen_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/shm_pool.cpp
${KWAYLAND_SOURCE_DIR}/src/client/surface.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandSurface ${testWaylandSurface_SRCS})
add_dependencies(testWaylandSurface wayland-client-fullscreen-shell)
target_link_libraries( testWaylandSurface Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandSurface Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandSurface testWaylandSurface)
ecm_mark_as_test(testWaylandSurface)
@ -141,27 +73,8 @@ ecm_mark_as_test(testWaylandSurface)
########################################################
set( testWaylandSeat_SRCS
test_wayland_seat.cpp
${KWAYLAND_SOURCE_DIR}/src/client/buffer.cpp
${KWAYLAND_SOURCE_DIR}/src/client/compositor.cpp
${KWAYLAND_SOURCE_DIR}/src/client/connection_thread.cpp
${KWAYLAND_SOURCE_DIR}/src/client/registry.cpp
${KWAYLAND_SOURCE_DIR}/src/client/fullscreen_shell.cpp
${KWAYLAND_SOURCE_DIR}/src/client/keyboard.cpp
${KWAYLAND_SOURCE_DIR}/src/client/pointer.cpp
${KWAYLAND_SOURCE_DIR}/src/client/seat.cpp
${KWAYLAND_SOURCE_DIR}/src/client/shm_pool.cpp
${KWAYLAND_SOURCE_DIR}/src/client/surface.cpp
${CMAKE_BINARY_DIR}/wayland_protocols/wayland-client-fullscreen-shell.c
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandSeat ${testWaylandSeat_SRCS})
add_dependencies(testWaylandSeat wayland-client-fullscreen-shell)
target_link_libraries( testWaylandSeat Qt5::Test Qt5::Gui Wayland::Client Wayland::Server)
target_link_libraries( testWaylandSeat Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
add_test(kwin-testWaylandSeat testWaylandSeat)
ecm_mark_as_test(testWaylandSeat)

View file

@ -3,16 +3,9 @@
########################################################
set( testWaylandServerDisplay_SRCS
test_display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandServerDisplay ${testWaylandServerDisplay_SRCS})
target_link_libraries( testWaylandServerDisplay Qt5::Test Qt5::Gui Wayland::Server)
target_link_libraries( testWaylandServerDisplay Qt5::Test Qt5::Gui KF5::WaylandServer Wayland::Server)
add_test(kwin-testWaylandServerDisplay testWaylandServerDisplay)
ecm_mark_as_test(testWaylandServerDisplay)
@ -21,15 +14,8 @@ ecm_mark_as_test(testWaylandServerDisplay)
########################################################
set( testWaylandServerSeat_SRCS
test_seat.cpp
${KWAYLAND_SOURCE_DIR}/src/server/buffer_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/compositor_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/display.cpp
${KWAYLAND_SOURCE_DIR}/src/server/output_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/seat_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/shell_interface.cpp
${KWAYLAND_SOURCE_DIR}/src/server/surface_interface.cpp
)
add_executable(testWaylandServerSeat ${testWaylandServerSeat_SRCS})
target_link_libraries( testWaylandServerSeat Qt5::Test Qt5::Gui Wayland::Server)
target_link_libraries( testWaylandServerSeat Qt5::Test Qt5::Gui KF5::WaylandServer Wayland::Server)
add_test(kwin-testWaylandServerSeat testWaylandServerSeat)
ecm_mark_as_test(testWaylandServerSeat)

View file

@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-server.h>
#include <kwaylandserver_export.h>
namespace KWin
{
namespace WaylandServer
@ -34,7 +36,7 @@ namespace WaylandServer
class Display;
class SurfaceInterface;
class CompositorInterface : public QObject
class KWAYLANDSERVER_EXPORT CompositorInterface : public QObject
{
Q_OBJECT
public:

View file

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QList>
#include <QObject>
#include <kwaylandserver_export.h>
struct wl_display;
struct wl_event_loop;
@ -36,7 +38,7 @@ class OutputInterface;
class SeatInterface;
class ShellInterface;
class Display : public QObject
class KWAYLANDSERVER_EXPORT Display : public QObject
{
Q_OBJECT
Q_PROPERTY(QString socketName READ socketName WRITE setSocketName NOTIFY socketNameChanged)

View file

@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QPoint>
#include <QSize>
#include <kwaylandserver_export.h>
struct wl_global;
struct wl_client;
struct wl_resource;
@ -35,7 +37,7 @@ namespace WaylandServer
class Display;
class OutputInterface : public QObject
class KWAYLANDSERVER_EXPORT OutputInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)

View file

@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-server.h>
#include <kwaylandserver_export.h>
namespace KWin
{
namespace WaylandServer
@ -36,7 +38,7 @@ class KeyboardInterface;
class PointerInterface;
class SurfaceInterface;
class SeatInterface : public QObject
class KWAYLANDSERVER_EXPORT SeatInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
@ -111,7 +113,7 @@ private:
static const struct wl_seat_interface s_interface;
};
class PointerInterface : public QObject
class KWAYLANDSERVER_EXPORT PointerInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QPoint globalPos READ globalPos WRITE setGlobalPos NOTIFY globalPosChanged)
@ -188,7 +190,7 @@ private:
static const struct wl_pointer_interface s_interface;
};
class KeyboardInterface : public QObject
class KWAYLANDSERVER_EXPORT KeyboardInterface : public QObject
{
Q_OBJECT
public:

View file

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QImage>
#include <QObject>
#include <kwaylandserver_export.h>
struct wl_resource;
struct wl_shm_buffer;
@ -33,7 +35,7 @@ namespace WaylandServer
class SurfaceInterface;
class BufferInterface : public QObject
class KWAYLANDSERVER_EXPORT BufferInterface : public QObject
{
Q_OBJECT
public:

View file

@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-server.h>
#include <kwaylandserver_export.h>
class QSize;
class QTimer;
struct wl_global;
@ -37,7 +39,7 @@ class Display;
class SurfaceInterface;
class ShellSurfaceInterface;
class ShellInterface : public QObject
class KWAYLANDSERVER_EXPORT ShellInterface : public QObject
{
Q_OBJECT
public:
@ -70,7 +72,7 @@ private:
QList<ShellSurfaceInterface*> m_surfaces;
};
class ShellSurfaceInterface : public QObject
class KWAYLANDSERVER_EXPORT ShellSurfaceInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QString title READ title NOTIFY titleChanged)

View file

@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-server.h>
#include <kwaylandserver_export.h>
namespace KWin
{
namespace WaylandServer
@ -34,7 +36,7 @@ namespace WaylandServer
class BufferInterface;
class CompositorInterface;
class SurfaceInterface : public QObject
class KWAYLANDSERVER_EXPORT SurfaceInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QRegion damage READ damage NOTIFY damaged)