fix: windows compilation

windows needed some special things when it came to including packages.
This commit is contained in:
Quinn
2025-04-13 17:15:57 +02:00
committed by Quinn
parent cf1759a5c3
commit 0dacc79cac

View File

@@ -1,7 +1,8 @@
# dependencies: # dependencies:
# - make # - make
# - clang # - clang
# - git bash (windows) # - glfw3 (install glfw3:x64-mingw-dynamic via vcpkg for win cross compilation)
# - vcpkg (win cross-compilation)
NAME := mcaselector-lite NAME := mcaselector-lite
DEBUG ?= 0 DEBUG ?= 0
ARCH ?= 0 ARCH ?= 0
@@ -9,8 +10,8 @@ ARCH ?= 0
# C compiler options # C compiler options
CC := clang CC := clang
CSTD := c17 CSTD := c17
CFLAGS := $(shell pkg-config --cflags glfw3) -Wall -Wextra -Wpedantic -Wno-pointer-arith -static CFLAGS := -Wall -Wextra -Wpedantic -Wno-pointer-arith -static
LDFLAGS := $(shell pkg-config --libs glfw3) LDFLAGS :=
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -g -Og CFLAGS += -g -Og
@@ -22,11 +23,11 @@ endif
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
ifeq ($(ARCH),linux-x86_64) ifeq ($(ARCH),linux-x86_64)
CFLAGS += -target x86_64-pc-linux-gnu CFLAGS += -target x86_64-pc-linux-gnu $(shell pkg-config --cflags glfw3)
LDFLAGS += -target x86_64-pc-linux-gnu LDFLAGS += -target x86_64-pc-linux-gnu $(shell pkg-config --libs glfw3)
else ifeq ($(ARCH),win-x86_64) else ifeq ($(ARCH),win-x86_64)
CFLAGS += -target x86_64-pc-windows-gnu CFLAGS += -target x86_64-pc-windows-gnu -I$(VCPKG_ROOT)/installed/x64-mingw-dynamic/include
LDFLAGS += -target x86_64-pc-windows-gnu LDFLAGS += -target x86_64-pc-windows-gnu -L$(VCPKG_ROOT)/installed/x64-mingw-dynamic/lib -lglfw3dll -fuse-ld=lld
EXT := .exe EXT := .exe
else else
$(error you must set the ARCH environment variable to one of these: 'linux-x86_64' 'win-x86_64') $(error you must set the ARCH environment variable to one of these: 'linux-x86_64' 'win-x86_64')