Skip to content

Instantly share code, notes, and snippets.

@wilsonsilva
Created December 16, 2024 16:29
Show Gist options
  • Save wilsonsilva/83852969bd0f33fe455ba29abb771c2c to your computer and use it in GitHub Desktop.
Save wilsonsilva/83852969bd0f33fe455ba29abb771c2c to your computer and use it in GitHub Desktop.
hello_wayland.c
#include <stdio.h>
#include <wayland-client.h>
int main(int argc, char *argv[]) {
struct wl_display *display = wl_display_connect(NULL);
if (!display) {
fprintf(stderr, "Failed to connect to Wayland display\n");
return 1;
}
printf("Hello Wayland!\n");
wl_display_disconnect(display);
return 0;
}
@wilsonsilva
Copy link
Author

CC = gcc
CFLAGS = $(shell pkg-config --cflags wayland-client cairo) -g
LDFLAGS = $(shell pkg-config --libs wayland-client cairo) -lrt

SOURCES = main.c xdg-shell-protocol.c
OBJECTS = $(SOURCES:.c=.o)
TARGET = hello_wayland

$(TARGET): $(OBJECTS)
	$(CC) -o $@ $(OBJECTS) $(LDFLAGS)

%.o: %.c
	$(CC) -c -o $@ $< $(CFLAGS)

clean:
	rm -f $(TARGET) $(OBJECTS)

@wilsonsilva
Copy link
Author

gcc -o hello_wayland main.c xdg-shell-protocol.c $(pkg-config --cflags --libs wayland-client cairo) -lrt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment