Skip to content

[rcore][win32] Adding native win32 backend #4869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
9 changes: 6 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend
.rgfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_RGFW", ""),
.sdl => raylib.root_module.addCMacro("PLATFORM_DESKTOP_SDL", ""),
.android => raylib.root_module.addCMacro("PLATFORM_ANDROID", ""),
else => {},
.drm => {},
.win32 => raylib.root_module.addCMacro("PLATFORM_DESKTOP_WIN32", ""),
}
}

Expand Down Expand Up @@ -180,11 +181,12 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
raylib.addIncludePath(b.path("src/platforms"));
switch (target.result.os.tag) {
.windows => {
try raylib_flags_arr.append("-DUNICODE");
switch (options.platform) {
.glfw => try c_source_files.append("src/rglfw.c"),
.rgfw, .sdl, .drm, .android => {},
.rgfw, .sdl, .drm, .android, .win32 => {},
}

raylib.linkSystemLibrary("shcore");
raylib.linkSystemLibrary("winmm");
raylib.linkSystemLibrary("gdi32");
raylib.linkSystemLibrary("opengl32");
Expand Down Expand Up @@ -440,6 +442,7 @@ pub const PlatformBackend = enum {
sdl,
drm,
android,
win32,
};

pub fn build(b: *std.Build) !void {
Expand Down
7 changes: 7 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ ifeq ($(PLATFORM_OS), LINUX)
CFLAGS += -fPIC
endif

ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS += -DUNICODE
endif

ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
CFLAGS += -g -D_DEBUG
endif
Expand Down Expand Up @@ -628,6 +632,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
LDLIBS += -latomic
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
LDLIBS = -lgdi32 -lwinmm -lopengl32 -lshcore
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
endif
Expand Down
Loading
Loading