mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -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
|
||||
### Compile Cubyz from source
|
||||
1. Install git and zig (latest master release)
|
||||
2. Clone this repository `git clone --recurse-submodules https://github.com/pixelguys/Cubyz` <br>
|
||||
If you forgot the `--recurse-submodules` flag you may need to run `git submodule update --init --recursive`
|
||||
2. Clone this repository `git clone https://github.com/pixelguys/Cubyz`
|
||||
3. Go into the folder `cd Cubyz`
|
||||
4. Run zig `zig build run`
|
||||
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");
|
||||
|
||||
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 {
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// 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:
|
||||
exe.addIncludePath(.{.path = "portaudio/include"});
|
||||
exe.addIncludePath(.{.path = "portaudio/src/common"});
|
||||
exe.addCSourceFiles(&[_][]const u8 {
|
||||
"portaudio/src/common/pa_allocation.c",
|
||||
"portaudio/src/common/pa_converters.c",
|
||||
"portaudio/src/common/pa_cpuload.c",
|
||||
"portaudio/src/common/pa_debugprint.c",
|
||||
"portaudio/src/common/pa_dither.c",
|
||||
"portaudio/src/common/pa_front.c",
|
||||
"portaudio/src/common/pa_process.c",
|
||||
"portaudio/src/common/pa_ringbuffer.c",
|
||||
"portaudio/src/common/pa_stream.c",
|
||||
"portaudio/src/common/pa_trace.c",
|
||||
const portaudio = b.dependency("portaudio", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
exe.addIncludePath(portaudio.path("include"));
|
||||
exe.addIncludePath(portaudio.path("src/common"));
|
||||
addPackageCSourceFiles(exe, portaudio, &[_][]const u8 {
|
||||
"src/common/pa_allocation.c",
|
||||
"src/common/pa_converters.c",
|
||||
"src/common/pa_cpuload.c",
|
||||
"src/common/pa_debugprint.c",
|
||||
"src/common/pa_dither.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"});
|
||||
if(target.getOsTag() == .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"});
|
||||
exe.addIncludePath(.{.path = "portaudio/src/os/win"});
|
||||
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(portaudio.path("src/os/win"));
|
||||
exe.linkSystemLibrary("ole32");
|
||||
exe.linkSystemLibrary("winmm");
|
||||
exe.linkSystemLibrary("uuid");
|
||||
// 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) {
|
||||
// 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"});
|
||||
exe.addIncludePath(.{.path = "portaudio/src/os/unix"});
|
||||
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(portaudio.path("src/os/unix"));
|
||||
// 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");
|
||||
} else {
|
||||
std.log.err("Unsupported target: {}\n", .{ target.getOsTag() });
|
||||
|
@ -6,5 +6,9 @@
|
||||
.url = "https://pkg.machengine.org/mach-freetype/92773615e2480c0a6f561748f2ba1180376bbb68.tar.gz",
|
||||
.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