Use CmakeLists

This commit is contained in:
Florian RICHER 2024-06-06 21:48:01 +02:00
parent 7ebc95ecdd
commit 61ed0abaed
5 changed files with 29 additions and 1 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
bin/
build/

20
CMakeLists.txt Normal file
View file

@ -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})

View file

@ -16,6 +16,10 @@
default = pkgs.mkShell {
packages = with pkgs; [
pkg-config
cmake
ninja
libffi
imagemagick
wayland-scanner
wayland

View file

@ -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;
}