feat(build)!: add conditions checking for X11 vs Wayland on linux in config.mk and added a DEBUG_BUILD make option which enables debug options instead of having them by default
Signed-off-by: Lorenzo Torres <lorenzo@sagittarius-a.org>
This commit is contained in:
parent
aebe71fec2
commit
b9a8fb3722
2 changed files with 20 additions and 8 deletions
16
config.mk
16
config.mk
|
|
@ -1,14 +1,14 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
CC := cc
|
||||
CFLAGS := -Wall -Wextra -std=c99 -pedantic -ggdb -fsanitize=address -DDEBUG
|
||||
CFLAGS := -Wall -Wextra -std=c99 -pedantic
|
||||
LIBS := -lm
|
||||
# can be gl or vk
|
||||
# Can be gl or vk
|
||||
BACKEND := vk
|
||||
|
||||
PLATFORM := $(shell uname)
|
||||
|
||||
ifeq (${BACKEND},gl)
|
||||
ifeq (${GRAPHICS_BACKEND},gl)
|
||||
CFLAGS += -DBACKEND_GL
|
||||
ifeq (${PLATFORM},Darwin)
|
||||
LIBS += -framework OpenGL
|
||||
|
|
@ -24,5 +24,13 @@ ifeq (${PLATFORM},Darwin)
|
|||
CFLAGS += -DPLATFORM_MACOS
|
||||
LIBS += -framework Cocoa -framework CoreVideo -framework Metal -framework IOKit
|
||||
else ifeq (${PLATFORM},Linux)
|
||||
CFLAGS += -DPLATFORM_LINUX
|
||||
# Check for windowing platforms if it's linux
|
||||
LINUX_WINDOW_PLATFORM := $(shell echo $$DISPLAY)
|
||||
endif
|
||||
|
||||
# If LINUX_WINDOW_PLATFORM is "", it is Wayland, otherwise it's Xorg
|
||||
ifeq ($(LINUX_WINDOW_PLATFORM),)
|
||||
LIBS += -lwayland-client
|
||||
else
|
||||
LIBS += -lX11 -lXrandr
|
||||
endif
|
||||
|
|
|
|||
12
makefile
12
makefile
|
|
@ -1,18 +1,22 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
include config.mk
|
||||
ifeq (${DEBUG_BUILD},1)
|
||||
CFLAGS += -ggdb -fsanitize=address,undefined -DDEBUG
|
||||
endif
|
||||
|
||||
SRC:=\
|
||||
topaz.c\
|
||||
linear.c\
|
||||
core/arena.c\
|
||||
core/vector.c
|
||||
core/vector.c\
|
||||
|
||||
ifeq (${BACKEND},gl)
|
||||
ifeq (${GRAPHICS_BACKEND},gl)
|
||||
SRC += gl/gl.c\
|
||||
gl/platform.c
|
||||
gl/platform.c\
|
||||
gl/renderer.c
|
||||
endif
|
||||
ifeq (${BACKEND},vk)
|
||||
ifeq (${GRAPHICS_BACKEND},vk)
|
||||
SRC += vk/platform.c\
|
||||
vk/renderer.c\
|
||||
vk/instance.c\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue