mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-09 03:59:53 -04:00
Remove portaudio submodule, getting it through the zig package manager instead.
Resolves #103
This commit is contained in:
parent
6e43ec3d40
commit
86ab8ef782
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "portaudio"]
|
|
||||||
path = portaudio
|
|
||||||
url = git@github.com:PortAudio/portaudio.git
|
|
@ -30,8 +30,7 @@ Sorry, the zig version isn't there yet. You can test the old java version or ask
|
|||||||
Otherwise you can
|
Otherwise you can
|
||||||
### Compile Cubyz from source
|
### Compile Cubyz from source
|
||||||
1. Install git and zig (latest master release)
|
1. Install git and zig (latest master release)
|
||||||
2. Clone this repository `git clone --recurse-submodules https://github.com/pixelguys/Cubyz` <br>
|
2. Clone this repository `git clone https://github.com/pixelguys/Cubyz`
|
||||||
If you forgot the `--recurse-submodules` flag you may need to run `git submodule update --init --recursive`
|
|
||||||
3. Go into the folder `cd Cubyz`
|
3. Go into the folder `cd Cubyz`
|
||||||
4. Run zig `zig build run`
|
4. Run zig `zig build run`
|
||||||
5. If it's too slow, run it in release: `zig build run -Doptimize=ReleaseFast`
|
5. If it's too slow, run it in release: `zig build run -Doptimize=ReleaseFast`
|
||||||
|
48
build.zig
48
build.zig
@ -1,5 +1,11 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
fn addPackageCSourceFiles(exe: *std.Build.Step.Compile, dep: *std.Build.Dependency, files: []const []const u8, flags: []const []const u8) void {
|
||||||
|
for(files) |file| {
|
||||||
|
exe.addCSourceFile(.{ .file = dep.path(file), .flags = flags});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) !void {
|
pub fn build(b: *std.build.Builder) !void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
@ -43,35 +49,39 @@ pub fn build(b: *std.build.Builder) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ // compile portaudio from source:
|
{ // compile portaudio from source:
|
||||||
exe.addIncludePath(.{.path = "portaudio/include"});
|
const portaudio = b.dependency("portaudio", .{
|
||||||
exe.addIncludePath(.{.path = "portaudio/src/common"});
|
.target = target,
|
||||||
exe.addCSourceFiles(&[_][]const u8 {
|
.optimize = optimize,
|
||||||
"portaudio/src/common/pa_allocation.c",
|
});
|
||||||
"portaudio/src/common/pa_converters.c",
|
exe.addIncludePath(portaudio.path("include"));
|
||||||
"portaudio/src/common/pa_cpuload.c",
|
exe.addIncludePath(portaudio.path("src/common"));
|
||||||
"portaudio/src/common/pa_debugprint.c",
|
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {
|
||||||
"portaudio/src/common/pa_dither.c",
|
"src/common/pa_allocation.c",
|
||||||
"portaudio/src/common/pa_front.c",
|
"src/common/pa_converters.c",
|
||||||
"portaudio/src/common/pa_process.c",
|
"src/common/pa_cpuload.c",
|
||||||
"portaudio/src/common/pa_ringbuffer.c",
|
"src/common/pa_debugprint.c",
|
||||||
"portaudio/src/common/pa_stream.c",
|
"src/common/pa_dither.c",
|
||||||
"portaudio/src/common/pa_trace.c",
|
"src/common/pa_front.c",
|
||||||
|
"src/common/pa_process.c",
|
||||||
|
"src/common/pa_ringbuffer.c",
|
||||||
|
"src/common/pa_stream.c",
|
||||||
|
"src/common/pa_trace.c",
|
||||||
}, &[_][]const u8{"-g", "-O3"});
|
}, &[_][]const u8{"-g", "-O3"});
|
||||||
if(target.getOsTag() == .windows) {
|
if(target.getOsTag() == .windows) {
|
||||||
// windows:
|
// windows:
|
||||||
exe.addCSourceFiles(&[_][]const u8 {"portaudio/src/os/win/pa_win_coinitialize.c", "portaudio/src/os/win/pa_win_hostapis.c", "portaudio/src/os/win/pa_win_util.c", "portaudio/src/os/win/pa_win_waveformat.c", "portaudio/src/os/win/pa_win_wdmks_utils.c", "portaudio/src/os/win/pa_x86_plain_converters.c", }, &[_][]const u8{"-g", "-O3", "-DPA_USE_WASAPI"});
|
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {"src/os/win/pa_win_coinitialize.c", "src/os/win/pa_win_hostapis.c", "src/os/win/pa_win_util.c", "src/os/win/pa_win_waveformat.c", "src/os/win/pa_win_wdmks_utils.c", "src/os/win/pa_x86_plain_converters.c", }, &[_][]const u8{"-g", "-O3", "-DPA_USE_WASAPI"});
|
||||||
exe.addIncludePath(.{.path = "portaudio/src/os/win"});
|
exe.addIncludePath(portaudio.path("src/os/win"));
|
||||||
exe.linkSystemLibrary("ole32");
|
exe.linkSystemLibrary("ole32");
|
||||||
exe.linkSystemLibrary("winmm");
|
exe.linkSystemLibrary("winmm");
|
||||||
exe.linkSystemLibrary("uuid");
|
exe.linkSystemLibrary("uuid");
|
||||||
// WASAPI:
|
// WASAPI:
|
||||||
exe.addCSourceFiles(&[_][]const u8 {"portaudio/src/hostapi/wasapi/pa_win_wasapi.c"}, &[_][]const u8{"-g", "-O3"});
|
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {"src/hostapi/wasapi/pa_win_wasapi.c"}, &[_][]const u8{"-g", "-O3"});
|
||||||
} else if(target.getOsTag() == .linux) {
|
} else if(target.getOsTag() == .linux) {
|
||||||
// unix:
|
// unix:
|
||||||
exe.addCSourceFiles(&[_][]const u8 {"portaudio/src/os/unix/pa_unix_hostapis.c", "portaudio/src/os/unix/pa_unix_util.c"}, &[_][]const u8{"-g", "-O3", "-DPA_USE_ALSA"});
|
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {"src/os/unix/pa_unix_hostapis.c", "src/os/unix/pa_unix_util.c"}, &[_][]const u8{"-g", "-O3", "-DPA_USE_ALSA"});
|
||||||
exe.addIncludePath(.{.path = "portaudio/src/os/unix"});
|
exe.addIncludePath(portaudio.path("src/os/unix"));
|
||||||
// ALSA:
|
// ALSA:
|
||||||
exe.addCSourceFiles(&[_][]const u8 {"portaudio/src/hostapi/alsa/pa_linux_alsa.c"}, &[_][]const u8{"-g", "-O3"});
|
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {"src/hostapi/alsa/pa_linux_alsa.c"}, &[_][]const u8{"-g", "-O3"});
|
||||||
exe.linkSystemLibrary("asound");
|
exe.linkSystemLibrary("asound");
|
||||||
} else {
|
} else {
|
||||||
std.log.err("Unsupported target: {}\n", .{ target.getOsTag() });
|
std.log.err("Unsupported target: {}\n", .{ target.getOsTag() });
|
||||||
|
@ -6,5 +6,9 @@
|
|||||||
.url = "https://pkg.machengine.org/mach-freetype/92773615e2480c0a6f561748f2ba1180376bbb68.tar.gz",
|
.url = "https://pkg.machengine.org/mach-freetype/92773615e2480c0a6f561748f2ba1180376bbb68.tar.gz",
|
||||||
.hash = "12205a6057fe43a4940c6db304449ebf3e98ff15d0eec05b75f621d7616c2e7d7f2c",
|
.hash = "12205a6057fe43a4940c6db304449ebf3e98ff15d0eec05b75f621d7616c2e7d7f2c",
|
||||||
},
|
},
|
||||||
|
.portaudio = .{
|
||||||
|
.url = "https://github.com/PortAudio/portaudio/archive/refs/tags/v19.7.0.tar.gz",
|
||||||
|
.hash = "1220a96e42d87ae966106483e3351919c95b7c8129942c355fd173b38b2e7a0ae0a0",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
Subproject commit cb8d3dcbc6fa74c67f3e236be89b12d5630da141
|
|
Loading…
x
Reference in New Issue
Block a user