mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 12:07:27 +00:00
Make build file more readable
This commit is contained in:
parent
96b84dec0a
commit
96f83b9104
85
build.zig
85
build.zig
@ -5,47 +5,34 @@
|
|||||||
// Date: 2020-02-15
|
// Date: 2020-02-15
|
||||||
//
|
//
|
||||||
|
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
const Builder = std.build.Builder;
|
||||||
|
|
||||||
pub fn build(b: *Builder) void
|
pub fn createExe(b: *Builder, name: []const u8, source: []const u8, desc: []const u8) *std.build.LibExeObjStep
|
||||||
{
|
{
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
var basicWindow = b.addExecutable("basic_window", "examples/core/basic_window.zig");
|
var exe = b.addExecutable(name, source);
|
||||||
basicWindow.setBuildMode(mode);
|
exe.setBuildMode(mode);
|
||||||
basicWindow.linkSystemLibrary("raylib");
|
exe.linkSystemLibrary("raylib");
|
||||||
basicWindow.addPackagePath("raylib", "lib/raylib-zig.zig");
|
exe.addPackagePath("raylib", "lib/raylib-zig.zig");
|
||||||
|
exe.addPackagePath("raylib-math", "lib/raylib-zig-math.zig");
|
||||||
|
|
||||||
var inputKeys = b.addExecutable("input_keys", "examples/core/input_keys.zig");
|
const runExe = exe.run();
|
||||||
inputKeys.setBuildMode(mode);
|
const exeStep = b.step(name, desc);
|
||||||
inputKeys.linkSystemLibrary("raylib");
|
exeStep.dependOn(&runExe.step);
|
||||||
inputKeys.addPackagePath("raylib", "lib/raylib-zig.zig");
|
return exe;
|
||||||
|
}
|
||||||
|
|
||||||
var inputMouse = b.addExecutable("input_mouse", "examples/core/input_mouse.zig");
|
pub fn build(b: *Builder) void
|
||||||
inputMouse.setBuildMode(mode);
|
{
|
||||||
inputMouse.linkSystemLibrary("raylib");
|
var basicWindow = createExe(b, "basic_window" , "examples/core/basic_window.zig" , "Creates a basic window with text");
|
||||||
inputMouse.addPackagePath("raylib", "lib/raylib-zig.zig");
|
var inputKeys = createExe(b, "input_keys" , "examples/core/input_keys.zig" , "Simple keyboard input");
|
||||||
|
var inputMouse = createExe(b, "input_mouse" , "examples/core/input_mouse.zig" , "Simple mouse input");
|
||||||
var inputMouseWheel = b.addExecutable("input_mouse_wheel", "examples/core/input_mouse_wheel.zig");
|
var inputMouseWheel = createExe(b, "input_mouse_wheel", "examples/core/input_mouse_wheel.zig", "Mouse wheel input");
|
||||||
inputMouseWheel.setBuildMode(mode);
|
var inputMultitouch = createExe(b, "input_multitouch" , "examples/core/input_multitouch.zig" , "Multitouch input");
|
||||||
inputMouseWheel.linkSystemLibrary("raylib");
|
var twoDCamera = createExe(b, "2d_camera" , "examples/core/2d_camera.zig" , "Shows the functionality of a 2D camera");
|
||||||
inputMouseWheel.addPackagePath("raylib", "lib/raylib-zig.zig");
|
var modelsLoading = createExe(b, "models_loading" , "examples/models/models_loading.zig" , "Loads a model and renders it");
|
||||||
|
|
||||||
var inputMultitouch = b.addExecutable("input_multitouch", "examples/core/input_multitouch.zig");
|
|
||||||
inputMultitouch.setBuildMode(mode);
|
|
||||||
inputMultitouch.linkSystemLibrary("raylib");
|
|
||||||
inputMultitouch.addPackagePath("raylib", "lib/raylib-zig.zig");
|
|
||||||
|
|
||||||
var twoDCamera = b.addExecutable("2d_camera", "examples/core/2d_camera.zig");
|
|
||||||
twoDCamera.setBuildMode(mode);
|
|
||||||
twoDCamera.linkSystemLibrary("raylib");
|
|
||||||
twoDCamera.addPackagePath("raylib", "lib/raylib-zig.zig");
|
|
||||||
twoDCamera.addPackagePath("raylib-math", "lib/raylib-zig-math.zig");
|
|
||||||
|
|
||||||
var modelsLoading = b.addExecutable("models_loading", "examples/models/models_loading.zig");
|
|
||||||
modelsLoading.setBuildMode(mode);
|
|
||||||
modelsLoading.linkSystemLibrary("raylib");
|
|
||||||
modelsLoading.addPackagePath("raylib", "lib/raylib-zig.zig");
|
|
||||||
|
|
||||||
const examplesStep = b.step("examples", "Builds all the examples");
|
const examplesStep = b.step("examples", "Builds all the examples");
|
||||||
examplesStep.dependOn(&basicWindow.step);
|
examplesStep.dependOn(&basicWindow.step);
|
||||||
@ -55,32 +42,4 @@ pub fn build(b: *Builder) void
|
|||||||
examplesStep.dependOn(&inputMultitouch.step);
|
examplesStep.dependOn(&inputMultitouch.step);
|
||||||
examplesStep.dependOn(&twoDCamera.step);
|
examplesStep.dependOn(&twoDCamera.step);
|
||||||
examplesStep.dependOn(&modelsLoading.step);
|
examplesStep.dependOn(&modelsLoading.step);
|
||||||
|
|
||||||
const runBasicWindow = basicWindow.run();
|
|
||||||
const basicWindowStep = b.step("basic_window", "Creates a basic window with text");
|
|
||||||
basicWindowStep.dependOn(&runBasicWindow.step);
|
|
||||||
|
|
||||||
const runInputKeys = inputKeys.run();
|
|
||||||
const inputKeysStep = b.step("input_keys", "Simple keyboard input");
|
|
||||||
inputKeysStep.dependOn(&runInputKeys.step);
|
|
||||||
|
|
||||||
const runInputMouse = inputMouse.run();
|
|
||||||
const inputMouseStep = b.step("input_mouse", "Simple mouse input");
|
|
||||||
inputMouseStep.dependOn(&runInputMouse.step);
|
|
||||||
|
|
||||||
const runInputMouseWheel = inputMouseWheel.run();
|
|
||||||
const inputMouseWheelStep = b.step("input_mouse_wheel", "Mouse wheel input");
|
|
||||||
inputMouseWheelStep.dependOn(&runInputMouseWheel.step);
|
|
||||||
|
|
||||||
const runInputMultitouch = inputMultitouch.run();
|
|
||||||
const inputMultitouchStep = b.step("input_multitouch", "Multitouch (duh)");
|
|
||||||
inputMultitouchStep.dependOn(&runInputMultitouch.step);
|
|
||||||
|
|
||||||
const run2DCamera = twoDCamera.run();
|
|
||||||
const twoDCameraStep = b.step("2d_camera", "Shows the functionality of a 2D camera");
|
|
||||||
twoDCameraStep.dependOn(&run2DCamera.step);
|
|
||||||
|
|
||||||
const runModelsLoading= modelsLoading.run();
|
|
||||||
const modelsLoadingStep = b.step("models_loading", "Loads a model and renders it");
|
|
||||||
modelsLoadingStep.dependOn(&runModelsLoading.step);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user