diff --git a/.gitignore b/.gitignore index e660fd9..567609b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -bin/ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9400b1f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.14) +project(wayland_test C) + +find_package(PkgConfig) + +# Server files +file(GLOB_RECURSE SERVER_SRC "src/server/*.c") +pkg_check_modules(WAYLAND_SERVER REQUIRED wayland-server) +add_executable(${PROJECT_NAME}_server ${SERVER_SRC}) +target_link_libraries(${PROJECT_NAME}_server ${WAYLAND_SERVER_LIBRARIES}) +target_include_directories(${PROJECT_NAME}_server PUBLIC ${WAYLAND_SERVER_INCLUDE_DIRS}) +target_compile_options(${PROJECT_NAME}_server PUBLIC ${WAYLAND_SERVER_CFLAGS_OTHER}) + +# Client files +file(GLOB_RECURSE CLIENT_SRC "src/client/*.c") +pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client) +add_executable(${PROJECT_NAME}_client ${CLIENT_SRC}) +target_link_libraries(${PROJECT_NAME}_client ${WAYLAND_CLIENT_LIBRARIES}) +target_include_directories(${PROJECT_NAME}_client PUBLIC ${WAYLAND_CLIENT_INCLUDE_DIRS}) +target_compile_options(${PROJECT_NAME}_client PUBLIC ${WAYLAND_CLIENT_CFLAGS_OTHER}) diff --git a/flake.nix b/flake.nix index a9ab277..4c41963 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,10 @@ default = pkgs.mkShell { packages = with pkgs; [ pkg-config + cmake + ninja + + libffi imagemagick wayland-scanner wayland diff --git a/src/client.c b/src/client/main.c similarity index 77% rename from src/client.c rename to src/client/main.c index a674f1f..bd9ac65 100644 --- a/src/client.c +++ b/src/client/main.c @@ -10,6 +10,10 @@ int main(int argc, char *argv[]) } fprintf(stderr, "Connection established!\n"); + while (wl_display_dispatch(display) != -1) { + /* This space deliberately left blank */ + } + wl_display_disconnect(display); return 0; } diff --git a/src/server.c b/src/server/main.c similarity index 100% rename from src/server.c rename to src/server/main.c