From 303f16d15536ca99b9e60454dba6e176bd8a6af9 Mon Sep 17 00:00:00 2001 From: PedroEdiaz Date: Tue, 29 Oct 2024 20:02:36 -0600 Subject: [PATCH] Separate Wayland and x11 --- Makefile | 15 ++++++++++----- README.md | 9 ++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3e4dcce..86ced9c 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,8 @@ help: @echo "Para compilar el proyecto a tu sistema operativo" @echo "porfavor usa uno de los siguientes comandos:" @echo " $(MAKE) windows" - @echo " $(MAKE) linux" + @echo " $(MAKE) linux-x11" + @echo " $(MAKE) linux-wayland" @echo " $(MAKE) cocoa" @echo "Para limpiar los archivos compilados se puede usar" @echo " $(MAKE) clean" @@ -48,13 +49,17 @@ glfw.dll: $(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@ -lgdi32 # LINUX -linux: $(OBJ) +linux-wayland: $(OBJ) for i in $(WAYLAND-LIB); \ do \ wayland-scanner client-header ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol.h; \ wayland-scanner private-code ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol-code.h; \ done - $(MAKE) DFLAGS="-D_GLFW_WAYLAND -D_GLFW_X11" libglfw.so + $(MAKE) DFLAGS="-D_GLFW_WAYLAND" libglfw.so + $(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm + +linux-x11: $(OBJ) + $(MAKE) DFLAGS="-D_GLFW_X11" libglfw.so $(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm run-linux: @@ -66,12 +71,12 @@ cocoa: $(OBJ) $(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw libglfw.so: - $(CC) -fPIC -shared $(DFLAGS)-D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@ + $(CC) -fPIC -shared $(DFLAGS) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@ clean: rm $(OBJ) $(BIN) ext/glfw/deps/wayland/*.h .SUFFIXES: .c .o -.c.o: +.c.o: src/main.h $(CC) $(CFLAGS) -c -o $@ $< diff --git a/README.md b/README.md index a69920c..805c89e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ Para poder compilar el proyecto hace falta lo siguiente. - `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C. ### Linux Para compilar `glfw` en linux hacen falta las siguientes librerías. (no incluidas) -- libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel libwayland-dev libxkbcommon-dev wayland-protocols +- `x11`: libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel +- `wayland`: libwayland-dev libxkbcommon-dev wayland-protocols # Descargas - [git](https://git-scm.com/downloads/win) @@ -42,7 +43,8 @@ Los siguientes comandos sirven para compilar `manigraph` deacuerdo al sistema op ``` make windows -make linux +make linux-x11 +make linux-wayland make cocoa ``` @@ -60,7 +62,8 @@ cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll #### Linux ``` -cc -fPIC -shared -D_GLFW_X11 -D_GLFW_WAYLAND -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so +cc -fPIC -shared -D_GLFW_X11 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so +cc -fPIC -shared -D_GLFW_WAYLAND -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so ``` #### Mac