Skip to content

Commit e2ee06b

Browse files
author
Jay
committed
Update build for 0.14
1 parent 61f2fbb commit e2ee06b

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

build.zig

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) !void {
1212
const sdl_ttf_dep = b.dependency("sdl_ttf", .{});
1313
const freetype_dep = b.dependency("freetype", .{});
1414
const wayland_scanner_dep = b.dependency("wayland_scanner", .{
15-
.target = b.host,
15+
.target = b.graph.host,
1616
.optimize = .ReleaseFast,
1717
});
1818
const font_dep = b.dependency("fonts", .{});
@@ -41,12 +41,12 @@ pub fn build(b: *std.Build) !void {
4141
.ReleaseFast, .ReleaseSmall, .ReleaseSafe => 0,
4242
.Debug => 3,
4343
};
44-
lib.defineCMacro("SDL_ASSERT_LEVEL", b.fmt("{d}", .{SDL_ASSERT_LEVEL}));
44+
lib.root_module.addCMacro("SDL_ASSERT_LEVEL", b.fmt("{d}", .{SDL_ASSERT_LEVEL}));
4545

4646
if (optimize != .Debug) {
47-
lib.defineCMacro("NDEBUG", "1");
48-
lib.defineCMacro("__FILE__", "\"__FILE__\"");
49-
lib.defineCMacro("__LINE__", "0");
47+
lib.root_module.addCMacro("NDEBUG", "1");
48+
lib.root_module.addCMacro("__FILE__", "\"__FILE__\"");
49+
lib.root_module.addCMacro("__LINE__", "0");
5050
}
5151

5252
lib.linkLibC();
@@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {
6565
lib.linkSystemLibrary("version");
6666
lib.linkSystemLibrary("oleaut32");
6767
lib.linkSystemLibrary("ole32");
68-
lib.defineCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
68+
lib.root_module.addCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
6969
},
7070
.macos => {
7171
lib.addCSourceFiles(.{
@@ -78,7 +78,7 @@ pub fn build(b: *std.Build) !void {
7878
.files = &objective_c_src_files,
7979
.flags = &.{"-fobjc-arc"},
8080
});
81-
lib.defineCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
81+
lib.root_module.addCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
8282

8383
// TODO: re-check which frameworks are needed
8484
lib.linkFramework("AudioToolbox");
@@ -94,14 +94,14 @@ pub fn build(b: *std.Build) !void {
9494
lib.linkFramework("CoreVideo");
9595
lib.linkFramework("ForceFeedback");
9696
lib.linkFramework("Foundation");
97-
lib.linkFrameworkWeak("GameController");
97+
lib.linkFramework("GameController");
9898
lib.linkFramework("IOKit");
99-
lib.linkFrameworkWeak("Metal");
100-
lib.linkFrameworkWeak("QuartzCore");
101-
lib.linkFrameworkWeak("UniformTypeIdentifiers");
99+
lib.linkFramework("Metal");
100+
lib.linkFramework("QuartzCore");
101+
lib.linkFramework("UniformTypeIdentifiers");
102102
lib.linkSystemLibrary("objc");
103103

104-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
104+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
105105
@panic("macOS SDK is missing");
106106
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
107107
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
@@ -376,7 +376,7 @@ pub fn build(b: *std.Build) !void {
376376

377377
inline for (std.meta.fields(@TypeOf(values))) |f| {
378378
const value = b.fmt("{any}", .{@field(values, f.name)});
379-
lib.defineCMacro(f.name, value);
379+
lib.root_module.addCMacro(f.name, value);
380380
}
381381

382382
// SDL3_DYNAMIC_API=/my/actual/libSDL3.so.0
@@ -387,7 +387,7 @@ pub fn build(b: *std.Build) !void {
387387

388388
// Avoid
389389
// SDL/include/build_config/SDL_build_config_minimal.h
390-
lib.defineCMacro("SDL_build_config_minimal_h_", "1");
390+
lib.root_module.addCMacro("SDL_build_config_minimal_h_", "1");
391391

392392
//--
393393

@@ -523,7 +523,7 @@ pub fn build(b: *std.Build) !void {
523523
SDL_ttf.linkLibrary(freetype_dep.artifact("freetype"));
524524

525525
if (target.result.os.tag == .macos) {
526-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
526+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
527527
@panic("macOS SDK is missing");
528528
SDL_ttf.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
529529
SDL_ttf.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
@@ -582,7 +582,7 @@ pub fn build(b: *std.Build) !void {
582582
exe.root_module.addImport("sdl", module);
583583

584584
if (target.result.os.tag == .macos) {
585-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
585+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
586586
@panic("macOS SDK is missing");
587587
exe.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
588588
exe.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
@@ -855,7 +855,7 @@ pub fn build(b: *std.Build) !void {
855855
exe.linkLibrary(test_utils);
856856

857857
if (target.result.os.tag == .macos) {
858-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
858+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
859859
@panic("macOS SDK is missing");
860860
exe.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
861861
exe.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
@@ -928,7 +928,7 @@ pub fn build(b: *std.Build) !void {
928928
exe.linkLibrary(lib);
929929

930930
if (target.result.os.tag == .macos) {
931-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
931+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
932932
@panic("macOS SDK is missing");
933933
exe.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
934934
exe.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });

build.zig.zon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// SPDX-License-Identifier: Zlib
44

55
.{
6-
.name = "sdl",
7-
.version = "0.0.0",
6+
.name = .sdl,
7+
.version = "0.0.1",
8+
.fingerprint = 0xec638ccb9c209e38,
89
.paths = .{""},
910
.dependencies = .{
1011
.sdl = .{

build/freetype/build.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ pub fn build(b: *std.Build) !void {
2020
});
2121
{
2222
if (optimize != .Debug) {
23-
lib.defineCMacro("NDEBUG", "1");
24-
lib.defineCMacro("__FILE__", "\"__FILE__\"");
25-
lib.defineCMacro("__LINE__", "0");
23+
lib.root_module.addCMacro("NDEBUG", "1");
24+
lib.root_module.addCMacro("__FILE__", "\"__FILE__\"");
25+
lib.root_module.addCMacro("__LINE__", "0");
2626
}
2727

2828
lib.addCSourceFiles(.{
@@ -72,9 +72,9 @@ pub fn build(b: *std.Build) !void {
7272
.flags = &.{},
7373
});
7474

75-
lib.defineCMacro("FT2_BUILD_LIBRARY", "1");
76-
lib.defineCMacro("HAVE_UNISTD_H", "");
77-
lib.defineCMacro("HAVE_FCNTL_H", "");
75+
lib.root_module.addCMacro("FT2_BUILD_LIBRARY", "1");
76+
lib.root_module.addCMacro("HAVE_UNISTD_H", "");
77+
lib.root_module.addCMacro("HAVE_FCNTL_H", "");
7878

7979
switch (target.result.os.tag) {
8080
.windows => {
@@ -109,7 +109,7 @@ pub fn build(b: *std.Build) !void {
109109
lib.installHeadersDirectory(freetype_dep.path("include/freetype"), "freetype", .{});
110110

111111
if (target.result.os.tag == .macos) {
112-
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.host.result) orelse
112+
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
113113
@panic("macOS SDK is missing");
114114
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
115115
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });

build/wayland_scanner/build.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void {
1515

1616
const expat = b.addStaticLibrary(.{
1717
.name = "expat",
18-
.target = b.host,
18+
.target = b.graph.host,
1919
.optimize = optimize,
2020
});
2121
{
@@ -68,7 +68,7 @@ pub fn build(b: *std.Build) !void {
6868

6969
const wayland_scanner = b.addExecutable(.{
7070
.name = "wayland-scanner",
71-
.target = b.host,
71+
.target = b.graph.host,
7272
.optimize = optimize,
7373
});
7474
{

0 commit comments

Comments
 (0)