Separate Wayland and x11

This commit is contained in:
PedroEdiaz
2024-10-29 20:02:36 -06:00
parent 8c565ffd25
commit 303f16d155
2 changed files with 16 additions and 8 deletions

View File

@@ -31,7 +31,8 @@ help:
@echo "Para compilar el proyecto a tu sistema operativo" @echo "Para compilar el proyecto a tu sistema operativo"
@echo "porfavor usa uno de los siguientes comandos:" @echo "porfavor usa uno de los siguientes comandos:"
@echo " $(MAKE) windows" @echo " $(MAKE) windows"
@echo " $(MAKE) linux" @echo " $(MAKE) linux-x11"
@echo " $(MAKE) linux-wayland"
@echo " $(MAKE) cocoa" @echo " $(MAKE) cocoa"
@echo "Para limpiar los archivos compilados se puede usar" @echo "Para limpiar los archivos compilados se puede usar"
@echo " $(MAKE) clean" @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 $(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@ -lgdi32
# LINUX # LINUX
linux: $(OBJ) linux-wayland: $(OBJ)
for i in $(WAYLAND-LIB); \ for i in $(WAYLAND-LIB); \
do \ do \
wayland-scanner client-header ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol.h; \ 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; \ wayland-scanner private-code ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol-code.h; \
done 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 $(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm
run-linux: run-linux:
@@ -66,12 +71,12 @@ cocoa: $(OBJ)
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw $(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
libglfw.so: 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: clean:
rm $(OBJ) $(BIN) ext/glfw/deps/wayland/*.h rm $(OBJ) $(BIN) ext/glfw/deps/wayland/*.h
.SUFFIXES: .c .o .SUFFIXES: .c .o
.c.o: .c.o: src/main.h
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<

View File

@@ -19,7 +19,8 @@ Para poder compilar el proyecto hace falta lo siguiente.
- `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C. - `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C.
### Linux ### Linux
Para compilar `glfw` en linux hacen falta las siguientes librerías. (no incluidas) 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 # Descargas
- [git](https://git-scm.com/downloads/win) - [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 windows
make linux make linux-x11
make linux-wayland
make cocoa make cocoa
``` ```
@@ -60,7 +62,8 @@ cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll
#### Linux #### 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 #### Mac